Example: Developing Web services clients based on Web Services for J2EE
This example takes you through the steps to develop a Web service client. The development process is based on the Web Services for J2EE and the Java API for XML-based remote procedure call (JAX-RPC) specification. For a Java or J2EE application to act as a client of a Web service, map the WSDL file to the Java code. The JAX-RPC specification defines the mapping between a WSDL file, Java code and XML Schema types.
Steps for this example task
- Obtain the Web Services Description Language (WSDL) document for the Web service that you want to access.
You can obtain the WSDL document from the service provider by e-mail or by looking it up in a Universal Description, Discovery and Integration (UDDI) registry.
- Develop client bindings from your WSDL file.
The WSDL document is used to generate all the information needed to invoke the Web service, including the Service Endpoint Interface and implementations; generated service interface; webservicesclient.xml and ibm-webservicesclient-bnd.xmi and ibm-webservicesclient-ext.xmi deployment descriptors.
The WSDL2Java command-line tool is run against your WSDL file to develop client bindings.
- Implement the client.
See Chapter 4 of the JSR-109 specification. You can access the specification through Web services: Resources for learning.
You can also review the GetQuote sample available in the Samples Gallery.
- Assemble the module.
Assemble the client JAR file into an EAR file or assemble the client WAR file into an EAR file.
- Configure the deployment descriptors.
Configure the webservicesclient.xml deployment descriptor.
Configure the ibm-webservicesclient-bnd.xmi deployment descriptor.
- Test the Web services client.
You should test the client to make sure it correctly operates and binds to the Web service.