Professional Documents
Culture Documents
Version 2.0
GOSI IT Department
Table of contents
Abstract:.......................................................................................................................................................3
1. Introduction: ...........................................................................................................................................4
2. Web Services Technology: ...................................................................................................................4
2.1 What is Web Service:...............................................................................................................4
2.2 Agents & Services:...................................................................................................................5
2.3 Consumers & Providers:.........................................................................................................5
2.4 Service Description: ................................................................................................................6
2.5 Overview of Engaging a Web Service: ................................................................................6
3. Monthly Movement Web Service Specifications:...........................................................................7
3.1 Monthly Movement Web Service Description: .................................................................7
3.1.1 Monthly Movement Web Service Function: .......................................................7
3.1.2 Methods Definition:.................................................................................................8
3.1.3 Input and Output Description: ..............................................................................8
3.2 Advantages & Assumptions: .................................................................................................9
3.2.1 Monthly Movement Web Service Benefits & Advantages:..............................9
3.2.2 Assumptions: .............................................................................................................9
3.3 Exceptions & Messages:........................................................................................................12
4. Building the Web Service: .................................................................................................................17
4.1 Security Requirements: ........................................................................................................17
4.2 Building Steps: .......................................................................................................................18
4.3 Examples:.................................................................................................................................19
5. Contact Details: ....................................................................................................................................22
Table of figures
Figure 1 Web Service Lifecycle. ..............................................................................................................5
Figure 2 The general process of engaging Web Service.....................................................................6
Figure 3 GOSI Web Service Security Methodology. ........................................................................18
Table of tables
Table 1. Functionality Assumptions table ............................................................................................2
Table 2. Methods Definition table .........................................................................................................9
Abstract
With the growing need of e-government and e-services in general, there is an increasing attention
paid to business-to-business or system-to-system interaction. Having such a technology can afford valuable
benefits to the organization. Reducing effort and attaining greater data accuracy are some of these
advantages. Many methodologies can be adopted in achieving B2B. Web Services is a modern and awarding
technology. It is considered as the most attractive technology for distributed applications. Many large-scale
companies are looking forward to adopting this methodology that will ease business and trading with
partners and suppliers. Web Services are rapidly becoming the most prominent reusable, distributed,
component-based technology with widespread acceptance from many industry players including: IBM,
Microsoft, and HP. This technology has been recently adopted by GOSI. This document serves as start guide
for the Monthly Movement Web Service. It describes and illustrates the idea of the web service along with
examples.
Requester Entity
Consumer
Human
Provider Entity
Provider
Human
WSDL
WSDL
Consumer
Agent
WSDL
Provider
Agent
4: Exchange messages
SOAP format
Methods Definition:
Method
Input
Output
Description
processMonthMoveAsyn
MonthlyMovementReques
tHeaderBean
long
monthMoveResponse
long
MonthlyMovementRespon
seHeaderBean
3.1.3
Item
MonthlyMovementRequestHeaderBean
Data Item
RegistrationNumber
Type
Input
Type
Number
Method
processMonthMoveAsyn
Width
Mandatory
Yes
Remarks
Employer Registration
Number
DataBean
MonthlyMovementReque
Yes
stBean
Table3: Class MonthlyMovementRequestHeaderBean table.
Item
MonthlyMovementRequestBean
Data Item
Type
Record Number
Varchar
Record Type
Number
Type
Input
Width
Method
processMonthMoveAsyn
Mandator
y
Remarks
Yes
Yes
SocialInsuranceNumber
Number
No
NationalityCode
Number
Yes
FirstName
Varchar
30
No
Varchar
30
No
ThirdName
Varchar
30
No
FourthName
Varchar
30
No
NameEnglish
Varchar
60
No
Name in English
Sex
Number
No
MaritalStatus
Number
No
Birth Date
Date
10
No
Education
Number
No
New NI Number
Number
10
No
Old NI number
Varchar
40
No
Number
10
No
Date
10
No
IQAMA number
Number
10
No
Passport number
Varchar
30
No
Date
10
No
Date
10
No
CompanyWorkerNumber
Varchar
30
No
Occupation
Varchar
No
Location
Number
10
No
Joining Date
Date
10
No
Number
No
Wage
Number
10.2
No
Contributor
Number
No
Leaving Date
Date
10
No
Leaving date
Number
No
P.O.Box
Varchar
20
No
Postal Code
ZipCode
Varchar
20
No
Zip Code
City
Number
10
No
Mobile Number
Varchar
30
No
Item
tranId
Data Item
tranId
Type
Width
Mandator
y
Yes
Number
Remarks
Monthly Movement Web Service
Transaction Key. Will be used later to
get the response details.
Item
Type
tranId
Input
Data Item
tranId
Type
Width
Mandator
y
Yes
Number
Method
monthMoveResponse
Remarks
Monthly Movement Web Service
Transaction Key. Will be used to get
the response details.
Item
MonthlyMovementResponseHeaderBean
Data Item
Type
Type
Output
Width
Mandator
y
Method
monthMoveResponse
Remarks
RegistrationNumber
Number
Yes
FieldOffice Code
Number
Yes
ErrorCode
Varchar
Yes
Error Description
Varchar
Yes
ReferenceNumber
Varchar
Yes
ProcessedDate
Varchar
Status
Varchar
Yes
DataBean
MonthlyMo
Yes
vementRes
ponseBean
Table7: Class MonthlyMovementResponseHeaderBean table.
Yes
Type
Record Number
Varchar
Record Type
Number
Type
Output
Width
Method
monthMoveResponse
Mandator
y
Remarks
Yes
Yes
SocialInsuranceNumber
Number
No
ErrorCode
Varchar
Yes
Error Description
Varchar
Yes
Process status
Varchar
Yes
NationalityCode
Number
Yes
Domain
Table8: Class MonthlyMovementResponseBean table.
Record Type
Nationality
2 or 3
1
1
1
1
1
1 or 2
1 or 2
1 or 2
1 or 2
1 or 2
1 or 2
3
3
1 or 2
1 or 2
Message
Field Office Code is corrupted in the record
No :
Registration Number is corrupted in the
record No :
Social Insurance Number is corrupted in the
record No :
Field Office Code is corrupted in the record
No :
Nationality Code is corrupted in the record
No :
Given registration Number does not exist in
GOSI system
New NI Number should be entered for Saudi
Contributor
New NI Number is not valid
Contributor exist for given person details
Cause
REG_001_ERR_037
REG_001_MSG_001
REG_001_ERR_038
REG_001_ERR_039
REG_001_ERR_040
REG_001_ERR_041
REG_001_ERR_042
REG_001_ERR_043
REG_001_ERR_044
REG_001_ERR_045
REG_001_ERR_046
REG_001_ERR_047
REG_001_ERR_050
REG_001_ERR_051
REG_001_ERR_052
REG_001_ERR_053
REG_001_ERR_054
REG_001_ERR_055
REG_001_ERR_056
REG_001_ERR_057
REG_001_ERR_058
REG_001_ERR_059
REG_001_ERR_060
REG_001_MSG_002
REG_001_ERR_061
REG_001_ERR_062
REG_001_ERR_063
REG_001_ERR_072
REG_001_ERR_099
REG_001_ERR_100
REG_001_ERR_073
REG_001_ERR_074
REG_001_ERR_075
REG_001_ERR_076
REG_001_ERR_077
REG_001_ERR_078
REG_001_ERR_079
REG_001_ERR_080
REG_001_ERR_081
REG_001_ERR_082
REG_001_ERR_083
REG_001_ERR_084
REG_001_ERR_085
REG_001_ERR_086
REG_001_ERR_087
REG_001_ERR_088
REG_001_ERR_089
REG_001_ERR_090
REG_001_ERR_091
REG_001_ERR_092
REG_001_ERR_093
REG_001_ERR_094
REG_001_ERR_095
REG_001_ERR_096
REG_001_ERR_097
REG_001_ERR_098
REG_001_ERR_115
REG_001_ERR_116
REG_001_ERR_117
REG_001_ERR_118
REG_001_ERR_119
REG_001_ERR_120
REG_001_ERR_121
REG_001_ERR_122
REG_001_ERR_124
REG_001_ERR_125
Date
Contributor can not work under more than
one establishment within a group
Authentication
SSL
HTTPS
Digital
Certificate
Trust
Integrity
Digital
Signature
Message Level
Non-Repudiation
Transmitter Level
Confidentiality
Security Methods
/// <summary>
/// Provide the Security methods to the web service.
/// </summary>
public class WebServiceSecurity
{
public WebServiceSecurity()
{
// Empty Constructor.
}
#region Static Method Collections
#region Certificate
/// <summary>
/// Get a Certificate from the Local Store.
/// </summary>
/// <param name="CertificateName"></param>
/// <returns></returns>
public static X509Certificate GetCertificate(string CertificateName)
{
X509CertificateStore Store = null;
X509Certificate Certificate =null;
try
{
// WSE 2.0 method
// Open the Local machine store
// (Use X509CertificateStore.CurrentUserStore() to open user store)
Store = X509CertificateStore.CurrentUserStore(X509CertificateStore.MyStore);
// Open the store.
Store.OpenRead();
// Looks for the first Certificate called [CertificateName] in the Local
// machine store
X509CertificateCollection Collections =
(X509CertificateCollection) Store.FindCertificateBySubjectString(CertificateName);
// Get the first certificate.
// if Collections is eqaul to null then it will catched by the catch statement.
Certificate = Collections[0];
Store.Close();
}
return Certificate;
}
#endregion
#region Digital Signature
/// <summary>
/// Get the Digital Signature, to add it to the security header of a message.
/// </summary>
/// <param name="CertificateName">The Certificate name</param>
/// <returns></returns>
public static X509SecurityToken GetSecurityToken(string CertificateName)
{
X509SecurityToken SecurityToken
= null;
X509CertificateStore Store
= null;
X509Certificate Certificate
=null;
try
{
// WSE 2.0 method
// Open the Local machine store
// (Use X509CertificateStore.CurrentUserStore() to open user store)
Store = X509CertificateStore.CurrentUserStore(X509CertificateStore.MyStore);
// Open the store
Store.OpenRead();
// Looks for the first Certificate called [CertificateName] in the Local
// machine store
X509CertificateCollection Collections=
(X509CertificateCollection) Store.FindCertificateBySubjectString(CertificateName);
// Get the first certificate.
// if Collections is eqaul to null then it will catched by the catch statement.
Certificate = Collections[0];
// if the Certificate doesn't exists
if (Certificate == null)
{
throw new Exception("You chose not to select an X.509 " +
"certificate for signing your messages.");
}
// if the Certificate doesn't support the digital Signature.
else if (!Certificate.SupportsDigitalSignature || (Certificate.Key == null))
{
throw new Exception(
"The certificate must support digital " +
"signatures and have a private key available.");
}
else
{
SecurityToken = new X509SecurityToken(Certificate);
}
}
finally
{
if (Store != null)
Store.Close();
}
return SecurityToken;
}
#endregion
#endregion
}
Contact Details:
General Organization for Social Insurance
Email: support@gosi.gov.sa
Tel: 4777735 Ext: 2142
B.O Box 2963 Riyadh 11461