Client application generation using WSDL tool

One of the benefits of using web services and WSDL files is to allow clients to use tools to assist in generating code to communicate with these services. The challenge has been for these tools to catch up and be able to understand the complex and lengthy schema definitions that are used by the WSSE, OTA, and EB groups. The following sections are meant to serve as a guide and Reference Implementation of tools known to work with both these schema sets and Enterprise Connectivity web services.

Client Generation for Java

  1. To generate client code in Java, Enterprise Connectivity recommends the use of the Apache Axis2 web services engine available at http://ws.apache.org/axis2. Version 1.4 has been tested and verified against the HCD XML Update Interface, but later releases are assumed to be backward compatible. The following are steps to build a client in Java using Axis2 1.4. The steps were executed on a Solaris UNIX system, but similar steps can be run on a Windows environment as well. Download and install Apache Axis2 version 1.4 from the above URL.

$AXIS2_HOME/bin/wsdl2java.sh -uri HotelDescriptiveContentNotifWS.wsdl -p com.pegs.webservices -d xmlbeans -s -o generated

This will read the web service definition from the “HotelDescriptiveContentNotifWS.wsdl” file, put all generated source code in the “generated” directory, use the xmlbeans databinding API, and create the service stub file in the com.pegs.webservices package. This step takes some time to complete, on the order of 10 minutes.

Note that if the WSDL was downloaded from the location listed above, this is the production location of the web service, and transactions sent to this end point will only be successful if the client has been implemented in production. The end point can be updated in the WSDL file manually prior to generating the source code to a different location that the client has access to.

  • The wsdl2java.sh script generates a build.xml file for using Ant to compile the source code it creates. This file will be in the output directory defined above, in this case, the “generated” directory.

  • Generate a client class that implements your business logic, placing it in the following directory:

generated/src/com/pegs/webservices

Enterprise Cinnectivity will supply example code that constructs the appropriate objects and sends a message to the web service if this is desired. Please contact your Service Manager for details.

  • Compile the source code using Ant. From the “generated” directory, execute the following command to compile and JAR a client application:

ant jar.client

The client jar file will be placed in this directory:

generated/build/lib

If the ENTERPRISE CONNECTIVITY sample client code was used as the business logic, execute a request to the web service using the following command:

java –cp classpath com.pegs.webservices.Client

The classpath must include all Axis2 jar files, as well as the jar file created by the compilation step.

Last updated