The WSDL2Java script
The WSDL2Java command tool creates Java classes and deployment descriptor templates from a WSDL file using the Java API for XML-based remote procedure call (JAX-RPC) 1.0 specification. See Mapping between Java, WSDL and XML for more information.
Classes and files generated
The WSDL2Java script generates these kinds of classes and files:
For each portType in the WSDL document (<wsdl:portType> element tag):
- Service Endpoint Interface
For each service in the WSDL document (<wsdl:service> element tag):
- Service Interface when the -role develop-client argument is specified.
- ServiceLocator when the -role deploy-client argument is specified.
This class is a WebSphere product-specific implementation of the service interface, and is not used directly.- webservices.xml deployment descriptor template when the -role develop-server argument is specified.
- ibm-webservices-bnd.xmi deployment descriptor template when the -role develop-server argument is specified.
- ibm-webservices-ext.xmi deployment descriptor template when the -role develop-server argument is specified.
- wsdlfile_mapping.xml JAX-RPC mapping file when the -role develop-client or -role develop-server is specified.
- webservicesclient.xml deployment descriptor template when the -role develop-client argument is specified.
- ibm-webservicesclient-bnd.xmi deployment descriptor template when the -role develop-client argument is specified.
- ibm-webservicesclient-ext.xmi deployment descriptor template when the -role develop-client argument is specified.
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.
For each binding in the WSDL file (<wsdl:binding> element tag):
- A stub generates that implements the Service Endpoint Interface(deploy-client role).
- An implementation template for an enterprise bean and templates for the EJB remote interface and home generate when the -role develop-server and -container-ejb arguments are specified.
- An implementation template for the Java bean generates when the -role develop-server and -container-web arguments are specified.
Other classes and files:
- A Java bean representing the structure of the type when the -role develop-server or -role develop-client arguments are specified for each complexType or simpleType.
- Three classes, *_Ser.java, *_Deser.java, and *_Helper.java, generate for each complexType to assist in converting the bean to Simple Object Access Protocol (SOAP) and back when the -role deploy-server or -role deploy-client argument is specified.
- A *Holder.java class generates when the -role develop-server or -role develop-client arguments are specified for each out and inout parameter.
Product
This script is available in WAS and WAS Network Deployment.
Authority
To run this script, your user profile must have *RX authority.
Syntax
The syntax of the script is:
WSDL2Java WSDL-URI [arguments]Parameters
The parameters of the script are:
WSDL-URI 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.
-container
Optional. The value j2ee-container specifies the J2EE container to be used. Valid values are client, ejb, web, and none. If client is role, the default argument is none. If server is role, the container must be ejb or web. The same container option must be used for both development and deployment.-deployScope
Optional. The value scope specifies how to deploy the server implementation. These are the valid values:
- Application - Uses one instance of the implementation class for all requests.
- Request - Creates a new instance of the implementation class for each request.
- Session - Creates a new instance of the implementation class for each session.
-genResolver
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.-help
Displays a help message.-helpX
Displays a help message for extended options.-inputMappingFile
Optional. The value mapfile specifies the file name of the Java to WSDL mapping file.-NStoPkg
Optional. If you specify this parameter, the script maps the namespace specified by namespace to the package specified by package. Specify this parameter 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. 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.Note: The default XML namespace to Java package mapping does not take the context root into account. If two namespaces are the same up to the first slash, they are mapped to the same Java package. For example, the XML namespaces http://www.ibm.com/foo and http://www.ibm.com/bar both map to the Java package com.ibm.www. Use the -NStoPkg option to specify the package for the fully qualified namespace.
-output
Optional. The value directory sets the root directory for the files that the script generates.-role
Optional. The value j2eeRole specifies the J2EE development role that identifies which files to generate. Valid values are:
- client
Combination of develop-client and deploy-client.- deploy-client
Generates binding files for client deployment.- deploy-server
Generates binding files for server deployment.- develop-client (default)
Generates files for client development. This is the default value.- develop-server
Generates files for server development.- server
Combination of develop-server and deploy-server.
-timeout
Optional. The value seconds 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.-useResolver
Optional. The value resolver-class 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.-verbose
Displays processing information, including the names of the generated files.