Develop client bindings from a WSDL file for a JAX-RPC client
To develop the client bindings from a WSDL file for JAX-RPC Web service applications, obtain the URL of the WSDL file to use. we need bindings and deployment descriptors in order for a client to use a Web service.
For example, if the WSDL file is a local file, the URL looks like...
file:/path/file_name.wsdlWe can also specify local files using the absolute or relative file system path. Client bindings are generated using the WSDL2Java options, -role develop-client and -container
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.
Run...
WSDL2Java -verbose -role develop-client -container type wsdlURLUse 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
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...
WSDL2Java -verbose -role develop-client -container client AddressBook.wsdl
...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.
Next steps
Complete the client implementation by writing the client application and then assembling the client artifacts. .
Related tasks
Implementing JAX-RPC Web services clients
Assembling a Web services-enabled client JAR file into an EAR file
Related
WSDL2Java command for JAX-RPC applications