Developing implementation templates and bindings from a Web Services Description Language file

 

To develop the implementation templates and bindings from a Web Services Description (WSDL) file, obtain the Uniform Resource Locator (URL) of the WSDL file to use.

If it is a local file and you are running the Windows platform, the URL looks like this: file:drive:\path\file_name.wsdl. If you are using the UNIX platform, the URL looks like this: file:/path/file_name.wsdl. One can also specify local files using the absolute or relative file system path.

Implementation templates are generated using the -role develop-server option in combination with the -container option of the WSDL2Java command. This option takes the following parameters:

  • -container EJB

    Generates templates for an EJB implementation in an EJB module.

  • -container Web

    Generates templates for a Java bean implementation in a Web module.

Templates are generated for an EJB implementation for the following:

The WSDL2Java command also generates bindings and deployment descriptors. To develop implementation templates and bindings from a WSDL file:

 

  1. Run the WSDL2Java -verbose -role develop-server -container type wsdlURL command.

    Where:type is EJB for an enterprise JavaBean -based implementation or Web for a Java bean-based implementation. Since the verbose option is specified, a list of all generated files is displayed when the command runs.

 

Results

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.

 

Usage scenario

The following example uses an enterprise bean named AddressBook and a WSDL file named AddressBook.wsdl . After generating the template files from the WSDL2Java -verbose -role develop-server -container EJB AddressBook.wsdl command, the following files are generated:

Parsing XML file:  file:e:/example/app/topdown/step1/AddressBook.wsdl 
WSWS3185I: Info: Parsing XML file:  AddressBookW2JB.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 addr\AddressBook_RI.java.
WSWS3282I: Info: Generating addr\AddressBookHome.java.
WSWS3282I: Info: Generating META-INF\webservices.xml.
WSWS3282I: Info: Generating META-INF\ibm-webservices-bnd.xmi.
WSWS3282I: Info: Generating META-INF\AddressBookW2JB_mapping.xml.
WSWS3282I: Info: Generating META-INF\ibm-webservices-ext.xmi.
If you are using a Java bean, you can generate the files with the WSDL2Java -verbose -role develop-server -container Web AddressBook.wsdl command.

 

What to do next

Complete the EJB implementation.

Complete the Java bean implementation.


Developing a new Web service with an existing Web Services Description Language file using a stateless session enterprise bean