Configuration for Java Client

This section explains you the system requirements and initial configuration required to setup the web service for Java Client.

System Requirements

The following software is required to setup web service java client in a system.

Configuration Steps

This section explains the configuration steps to setup the Java client. Perform the following configuration steps.

  1. Install JDK Package of Version 1.5 or higher.

  2. Add "bin" folder path of Installed JDK to "path" environment variable.

  3. 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>"

  1. In SOAP Body values <UserName>, <Password>, and <ExternalPartyName> placeholders, set Authenticated User ID, Password, and External Party Name respectively.

  2. 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>

  1. <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>>

  1. Write "main" method to initiate Web Service Request call. Save the file as "Service.java".

  2. Open Command Prompt and navigate to the local folder where JAR files are placed.

  3. 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

  1. 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

  1. 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>