The WSDL2Java command tool creates Java classes and deployment descriptor templates from a WSDL file. See Mapping between Java language, WSDL and XML for more information.
Classes and files generated
The following kinds of classes and files are generated:
This class is a WebSphere product-specific implementation of the service interface, and is not used directly.
When the role is a server role, the container argument specifies which J2EE container the implementation uses. When the -role develop-server -container ejb arguments are specified, the webservices.xml, ibm-webservices-bnd.xmi, ibm-webservicesclient-ext.xmi and the mapping file are generated into the META-INF subdirectory. When the -role develop-server -container web arguments are specified, the files are generated into the WEB-INF directory.
Command line syntax
The command line syntax is:
WSDL2Java [arguments] WSDL-URI
Required arguments
Specifies the location of the input WSDL document using a Universal Resource Identifier (URI). You can also use a regular file path if the WSDL file is on the local file system.
Important arguments
Indicates the J2EE container to be used. Valid arguments are:
Indicates client container.
Indicates enterprise JavaBean (EJB) container.
Indicates no container.
Indicates Web container.
Indicates how to deploy the server implementation. Valid arguments are:
Uses one instance of the implementation class for all requests.
Creates a new instance of the implementation class for each request.
Creates a new instance of the implementation class for each session.
Generates an absolute-import resolver class. The purpose of this class is to record the contents of the imported WSDL files used by the WSDL URI. This class is used by the runtime. It can also be used for future WSDL2Java command runs. This is desirable when the imported WSDL files are remote and can be inaccessible or slow to access. It also eliminates the possibility that a remote WSDL file might have different contents at run time than it did at development time. The generated class is named _AbsoluteImportResolver.java. You should compile and package this class with the other Java classes generated by the WSDL2Java command.
Displays a help message and exits.
Displays a help message for extended options. The options are:
Generates Java files for all types, even those that are not referenced.
Prints debugging information.
Specifies the file of namespace to package mappings. The default is NStoPKG.properties.
Generates Java files. Valid arguments are:
Generates the .xml and .xmi files. Valid arguments are:
Specifies the login user password to access the WSDL URI.
Generates the template for a JUnit test case for testing a Web service.
Specifies the login user name to access the WSDL URI.
Specifies the file name of the Java to WSDL mapping file. If the input WSDL file is generated from Java code by the Java2WSDL command or another vendor's tool by following the JAX-RPC standard, a mapping file is also generated. By supplying the inputMappingFile, you ensure the Java classes generated by the WSDL2Java command are compatible with the Java classes originally used to generate the WSDL file.
By default, package names are automatically derived from the namespace strings in the WSDL file. For example, if the namespace is of the form http://x.y.com or urn:x.y.com, the corresponding package is com.y.x.
You can provide your own mapping by using the -NStoPkg argument, which you can repeat as often as necessary, once for each unique namespace mapping. For example, if there is a namespace in the WSDL file called urn:AddressFetcher2, and you want files generated from the objects in this namespace to reside in the package samples.addr, provide the -NStoPkg urn:AddressFetcher2=samples.addr argument to the WSDL2Java command.
Sets the root directory for emitted files.
Specifies the J2EE development role that identifies which files to generate. Valid arguments are:
Combination of develop-client and deploy-client
.Generates binding files for client deployment.
Generates binding files for server deployment.
Generates files for client development.
Generates files for server development.
Combination of develop-server and deploy-server.
Specifies how long the WSDL2Java command should wait, in seconds, for the WSDL-URI to respond before giving up. The default is 45 seconds, -1 disables the timeout.
Specifies an absolute-import resolver class to use during parsing. This class must have been created during a previous execution of the WSDL2Java command using the -genResolver option. The class must be available in CLASSPATH.
Displays processing information, including the names of the generated files.
Review the Javadoc for a complete list of API's. You can also review several articles about the development of Web services at Web services: Resources for learning.