+

Search Tips   |   Advanced Search

Develop client bindings from a WSDL file for a JAX-RPC Web services client

We can develop client bindings from a Web Services Description (WSDL) file for a JAX-RPC web services client.

To develop the client bindings from a WSDL file for JAX-RPC web service applications, we must obtain the Uniform Resource Locator (URL) of the WSDL file to use. You need bindings and deployment descriptors in order for a client to use a web service.

(Windows) (ZOS) If the WSDL file is a local file, the URL looks like the following example: file:drive:\path\file_name.wsdl.

(Linux) (AIX) (HPUX) (Solaris) (iSeries) If the WSDL file is a local file, the URL looks like the following example: file:/path/file_name.wsdl.

We can also specify local files using the absolute or relative file system path.

Client bindings are generated using the -role develop-client option in combination with the -container option of the WSDL2Java command. The -container option takes the following parameters:

(ZOS) The WSDL2Java command-line tool is not supported on the z/OS platform. This functionality is provided by the assembly tools provided with the z/OS version of the product. Read about the WSDL2Java command-line tool for Java API for XML-based Remote Procedure Call (JAX-RPC) applications to learn more about this tool.

Develop client bindings from a WSDL file by running the appropriate command.

It is a best practice to use absolute namespaces within the WSDL or schema. By default, the WSDL2Java tool does not permit the use of relative namespaces. Relative namespaces have been deprecated by the XML Plenary Interest Group and the use of relative namespaces causes the XML Digital Signature to fail as required by the Canonical XML Version 1.0 specification. We can convert any relative namespaces to absolute namespaces. To learn more about the use of namespaces with the WSDL2Java tool, see the WSDL2Java command for JAX-RPC applications documentation. bprac


Tasks

Run the WSDL2Java -verbose -role develop-client -container type wsdlURL command,

where type is ejb for an enterprise EJB client, web for a JavaBeans client, or client for an application client.

Use the following combinations in the command-line:

Because the verbose option is specified, a list of all generated files is displayed when the command runs.

We have the bindings and deployment descriptors needed by a client to use a web service.


Example

The following example uses the AddressBook enterprise bean the AddressBook.wsdl WSDL file. After generating the bindings from the WSDL2Java -verbose -role develop-client -container client AddressBook.wsdl command, the following files are generated:

Parsing XML file:  file:e:/example/app/topdown/step1/AddressBook.wsdl 
WSWS3185I: Info: Parsing XML file:  AddressBook.wsdl
WSWS3282I: Info: Generating addr\Address.java.
WSWS3282I: Info: Generating addr\Phone.java.
WSWS3282I: Info: Generating addr\StateType.java.
WSWS3282I: Info: Generating addr\AddressBook.java.
WSWS3282I: Info: Generating addr\AddressBookService.java.
WSWS3282I: Info: Generating META-INF\ibm-webservicesclient-bnd.xmi.
WSWS3282I: Info: Generating META-INF\AddressBook_mapping.xml.
WSWS3282I: Info: Generating META-INF\ibm-webservicesclient-ext.xmi.


What to do next

Complete the client implementation by writing the client application and then assembling the client artifacts.

.


Related:

  • Development and assembly tools
  • Implement JAX-RPC web services clients
  • Assembling a web services-enabled client JAR file into an EAR file
  • WSDL2Java command for JAX-RPC applications