Develop Web service deployment descriptor templates from the WSDL file
To develop the deployment descriptor templates from a WSDL file, obtain the Uniform Resource Locator (URL) of the WSDL file to use. If it is a local file, the URL has this format:
file:/path/file_name.wsdlwhere path is the directory path that contains the file, and file_name is the name of the wsdl file. You can also specify local files using the absolute or relative file system path.
To develop deployment descriptor templates, run the WSDL2Java command at a command prompt.
For a J2EE Web services application, run this command:
WSDL2Java -verbose -role develop-server -container type -genJava No wsdlURLThis command generates the server deployment descriptor files in the META-INF or WEB-INF subdirectory:
- webservices.xml
- ibm-webservices-bnd.xmi
For a Web services client, run this command:
WSDL2Java -verbose -role develop-client -container type -genJava No wsdlURLThis command generates the client deploment descriptor files in the META-INF or WEB-INF subdirectory:
- webservicesclient.xml
- ibm-webservicesclient-bnd.xmi
In these commands, type is EJB for an enterprise bean-based implementation or Web for a Java bean-based implementation, and wsdlURL is the URL of the WSDL file. The value that you specify for the -container parameter determines to which subdirectory the templates are generated:
- When the WSDL2Java -container EJB parameter is specified, all deployment descriptors and the JAX-RPC mapping file are generated into the META-INF subdirectory of the output directory.
- When -container Web parameter is specified, all deployment descriptors and the JAX-RPC mapping file are generated into the WEB-INF subdirectory of the output directory.
The Java API for XML-based remote procedure call (JAX-RPC) mapping file is needed for both server and client use, and is generated by default when you run the WSDL2Java command. To generate the deployment descriptors only, and not any Java classes, specify the -genJava No parameter with the WSDL2Java command tool.
If the -verbose option is specified, the command displays a list of all generated files.
Examples
The following example uses a WSDL file named AddressBookJ2WB.wsdl:
Generate the template files:
WSDL2Java -verbose -role develop-client -container Web -genJava No META-INF\AddressBookJ2WB.wsdlWSDL2Java -verbose -role develop-server -container Ejb -genJava No META-INF\AddressBookJ2WB.wsdlThe deployment descriptor templates are generated into the WEB-INF for client and META-INF for EJB server subdirectories as follows:
Parsing XML file: META-INF/AddressBookJ2WB.wsdl Generating: WEB-INF\webservicesclient.xml Generating: WEB-INF\ibm-webservicesclient-bnd.xmi Generating: WEB-INF\AddressBookJ2WB_mapping.xml Generating: META-INF\webservices.xml Generating: META-INF\ibm-webservices-bnd.xmi Generating: META-INF\AddressBookJ2WB_mapping.xml