Developing Java artifacts for JAX-RPC applications from a WSDL file

You can develop Java artifacts from a Web Services Description (WSDL) file for JAX-RPC applications from a WSDL file by using the WSDL2Java command-line tool to create Java implementation templates and bindings.

Before you begin

To develop the JavaBeans implementation templates and bindings from a WSDL file, you must obtain the Uniform Resource Locator (URL) of the WSDL file.

If the WSDL file is a local file, the URL looks like this example: file:/path/file_name.wsdl.

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

Implementation templates are generated using the -role develop-server option of the WSDL2Java command. The WSDL2Java command also generates bindings and deployment descriptors.

About this task

Develop JavaBeans implementation templates and bindings from a WSDL file by issuing the proper command.

Best practice Best practice: It is a best practice to use absolute namespaces within your 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. You 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

Procedure

Run the WSDL2Java -verbose -role develop-server -container web wsdlURL command. Since the -verbose option is specified, a list of all the generated files is displayed when the command runs.

Results

You have templates for the implementation and deployment descriptors required to implement a Web service, as well as bindings files. These templates are partially filled with information from the WSDL file.

Example

The following example uses the AddressBook JavaBeans implementation and the AddressBook.wsdl WSDL file. After generating the template files from the WSDL2Java -verbose -role develop-server -container web 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\AddressBookSoapBindingImpl.java..
WSWS3282I: Info: Generating WEB-INF\webservices.xml.
WSWS3282I: Info: Generating WEB-INF\ibm-webservices-bnd.xmi.
WSWS3282I: Info: Generating WEB-INF\AddressBook_mapping.xml.
WSWS3282I: Info: Generating WEB-INF\ibm-webservices-ext.xmi.

The AddressBookSOAPBindingImpl.java file is the template for the implementation bean. It is named after the port in the WSDL file. Generally, this class is renamed to a more meaningful name.

What to do next

Complete the Java bean implementation.



In this information ...


Related concepts

IBM Redbooks, demos, education, and more

(Index)

Use IBM Suggests to retrieve related content from ibm.com and beyond, identified for your convenience.

This feature requires Internet access.

Task topic Task topic    

Terms and conditions for information centers | Feedback

Last updatedLast updated: Aug 30, 2013 10:47:11 PM CDT
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=pix&product=was-nd-iseries&topic=twbs_devbeanbindings
File name: twbs_devbeanbindings.html