Develop client bindings from a WSDL file for a JAX-RPC client
You can develop client bindings from a Web Services Description (WSDL) file for a JAX-RPC client.
To develop the client bindings from a WSDL file for JAX-RPC Web service applications, obtain the Uniform Resource Locator (URL) of the WSDL file to use. We need bindings and deployment descriptors in order for a client to use a Web service.
If the WSDL file is a local file, the URL looks like the following example: file:drive:\path\file_name.wsdl.
If the WSDL file is a local file, the URL looks like the following example: file:/path/file_name.wsdl.
You 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:
- -container client
Generates bindings and deployment descriptors for a client residing in the application client container.
- -container ejb
Generates bindings and deployment descriptors for a client that is an enterprise bean in the EJB module.
- -container web
Generates bindings and deployment descriptors for a client residing in the Web container.
Overview
Develop client bindings from a WSDL file by running the appropriate command:
Procedure
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. You can use the following combinations in the command-line:
- -container web
- -container ejb
- -container client
Because the verbose option is specified, a list of all generated files is displayed when the command runs.
Results
You 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.
Assemble a Web services-enabled client JAR and EAR file.
Developing and deploying Web services clients