This section explains you the system requirements and initial configuration required to setup the web service for Java Client.
The following software is required to setup web service java client in a system.
JDK Package of Version 1.5 or higher.
Please download and extract the sample client to a local folder from JavaClient.zip.
Create a virtual directory for the webservices.
This section explains the configuration steps to setup the Java client. Perform the following configuration steps.
Install JDK Package of Version 1.5 or higher.
Add "bin" folder path of Installed JDK to "path" environment variable.
Write Java Code to prepare a string for SOAP Envelope after placing the jar files in local folder. SOAP Envelope structure should be in the following format:
<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem=\"http://tempuri.org/\">"
<soapenv:Header>
<tem:UserNameToken>"
<tem:UserId><UserName></tem:UserId>
<tem:Password><Password></tem:Password>
<tem:ExternalPartyName><ExternalPartyName>
</tem:ExternalPartyName>
</tem:UserNameToken>"
</soapenv:Header>"
<soapenv:Body>
<SOAP Body>
</soapenv:Body>
</soapenv:Envelope>"
In SOAP Body values <UserName>, <Password>, and <ExternalPartyName> placeholders, set Authenticated User ID, Password, and External Party Name respectively.
SOAP Body is unique for each method. It is available
at host website. At Web Service URL, click required webservice method
to view SOAP Body.
Example: SOAP Body to find out Subscription Validity of contracts
holding by a Customer is given as
<tem:GetSubscriptionValidity>
<tem:SubscriptionvalidityXML>
<RequestXML> </tem:SubscriptionvalidityXML>
<tem:ReferenceNo><ReferenceNum></tem:ReferenceNo>"
</tem:GetSubscriptionValidity>
<RequestXML> is the XML specific to the called API Method. The format should be as specified in API Reference Guide. <ReferenceNum> is an unique string for each request being processed.
Example: RequestXML for Subscription Validity is as follows:
<<REQUESTINFO>>
<KEY_NAMEVALUE>
<KEY_NAME>CUSTOMERNO</KEY_NAME>
<KEY_VALUE>1015</KEY_VALUE>
</KEY_NAMEVALUE>
</<REQUESTINFO>>
Write "main" method to initiate Web Service Request call. Save the file as "Service.java".
Open Command Prompt and navigate to the local folder where JAR files are placed.
Use the following command to compile "Service.java".
javac -classpath "commons-httpclient.jar;commons-logging.jar;commons- collections.jar;commons-io.jar;commons-logging.jar;commons-codec-1.3.jar;commons- lang.jar" Service.java
Use the following command to run the program after successful compilation.
java -classpath "commons-httpclient.jar;commons-logging.jar;commons- collections.jar;commons-io.jar;commons-logging.jar;commons-codec-1.3.jar;commons- lang.jar;." Service
Web Service returns a response in XML format based on the given input.
Example: For Subscription Validity webservice request, Response XML is displayed as :
<GetSubscriptionValidityResponsexmlns="http://tempuri.org/">
<GetSubscriptionValidityResult>
<RESPONSEINFO>
<STATUS>
<TRANSACTIONNO>>85</TRANSACTIONNO>
<ERRORNO>>0</ERRORNO>
<MESSAGE>SUCCESS</MESSAGE>
</STATUS>
<CONTRACTINFO>
<CONTRACT>
<CONTRACTNO>15</CONTRACTNO>
<STARTDATE>22-09-2009</STARTDATE>
<ENDDATE>31-12-9999</ENDDATE>
<CONTRACTSTATUS>Active</CONTRACTSTATUS>
</CONTRACT>
</CONTRACTINFO>
</RESPONSEINFO>
</GetSubscriptionValidityResult>
</GetSubscriptionValidityResponse>