The Java2WSDL command tool maps a Java class to a Web Services Description Language (WSDL) file by following the Java API for XML-based remote procedure call (JAX-RPC) specification. The Java2WSDL command accepts a Java class as input and produces a WSDL file representing the input class. If there is an existing file at the output location, it is overwritten. The WSDL file generated by the Java2WSDL command contains WSDL and XML schema constructs that are automatically derived from the input class. You can override these default values with command-line arguments.
The Java2WSDL command supports multiple protocols. When you run the Java2WSDL command, you can specify command-line options that generate both SOAP and non-SOAP protocol bindings in the WSDL file.
The WSDL file generated by the Java2WSDL command can contain unexpected elements. Review Mapping between Java, WSDL and XML and the JAX-RPC specification available through Web services resources for more information on the transformations performed. You can create WSDL files that cannot be compiled when regenerated into Java code using the WSDL2Java command because the JAX-RPC mapping from Java to WSDL is not reversible back to the original Java code. Inspect and modify the WSDL file if you encounter this problem.
Product
This script is available in WebSphere Application Server - Express. The script is located in the /QIBM/ProdData/WebASE51/ASE/bin directory.
Authority
To run this script, your user profile must have *RX authority.
Syntax
The syntax of the script is:
Java2WSDL class [argument...]
Parameters
The parameters of the script are:
Required parameter
class
This is a required parameter. The value class represents the fully qualified name of one of the following Java classes:
The Java2WSDL command locates the class in CLASSPATH.
Optional parameters
-bindingName
This is an optional parameter. The value name specifies the name to use for the binding element. If not specified, the binding name is derived from class.
-help
Displays the help message.
-helpX
Displays the help message for extended options. Also displays help messages for various options supported by binding generators.
-extraClasses classes
Specifies other classes that should
be represented in the WSDL file.
-input wsdl-uri
Specifies the input WSDL file used to
build an output WSDL file. Information from an existing WSDL file, whose name
is specified in this option, is used with the input Java class to generate
the desired output.
-implClass impl-class
The Java2WSDL command uses
method parameter names to construct the WSDL file message part names. The
command automatically obtains the message names from the debug information
in the class. If the class is compiled without debug information, or if the
class is an interface, the method parameter names are not available. In this
case, you can use the -implClass argument to provide an alternative class
from which to obtain method parameter names. The impl-class does not need
to implement the class if the class is an interface, but it must implement
the same methods as class.
-namespace targetNamespace
Indicates the target namespace
for the WSDL file being generated. See Map
between Java, WSDL and XML for the algorithm used to obtain
the default namespace.
-output wsdl-uri
Indicates the path and file name of the
output WSDL file. If not specified, the default file, class.wsdl,
is written into the current directory.
-PkgtoNS package namespace
Specifies the mapping of a
Java package to a namespace. If there is a package without a namespace, the Java2WSDL command generates a namespace name. This argument can be repeated to specify mapping for multiple packages.
-portTypeName name
Specifies the name to use for the
portType element. If not specified, the class name is used.
-serviceElementName name
Specifies the name of the service
element.
-servicePortName name
Specifies the name of the service.
If not specified, the service name is derived from the -location argument.
-style RPC | DOCUMENT
Specifies the WSDL style to use in the
generated WSDL file. For more information about styles, see Map between Java, WSDL and XML. This
argument is used with the -use argument.
If RPC is specified with -use ENCODED, or omitting use, a style=rpc/use=encoded WSDL file is generated. If RPC is specified with -use LITERAL, a style=rpc/use=literal WSDL file is generated. If DOCUMENT is specified with -use LITERAL or omitting use, a style=document/use=literal WSDL file is generated. This setting applies to all SOAP bindings.
-transport http | jms
Generates SOAP bindings for either Hyper Text Transport Protocol (HTTP) (default) or
Java Messaging Service (JMS). If jms is specified, the characters
"jms" are appended to the WSDL file name to prevent overwriting an existing
WSDL file for another transport. The transport option can only be specified
once. The jms option is not used in WebSphere Application Server - Express.
Note: This option is deprecated in Version 5.1.1. The -bindingTypes option replaces the -transport option, allowing you to generate bindings that are non-SOAP specific.
-bindingTypes
Specifies the list of binding types that should be written to the output WSDL file.
Each binding generator in the Java2WSDL tool supports specific binding
types. The valid binding type values are http (SOAP over HTTP), jms (SOAP over JMS) and ejb (local or remote EJB invocation). Only the http value is valid on WebSphere Application Server - Express for iSeries.
-location location
Provides the location or Uniform Resource
Locator (URL) of the service. Typically, this value is automatically supplied
when the Web service is deployed. Use this argument to specify the location
if you want to generate a WSDL file containing a location URL without deploying.
A warning displays to remind you that the generated WSDL file should not be
published if the final location is not yet been determined. The name after
the last slash or backslash is the name of the service port, unless the name
is overridden by the -servicePortName argument. The service port address
location attribute is assigned the specified value.
-properties
You can use the -properties option to pass command line options to various binding
generators. Use the -properties option multiple times on the command line
to specify a set of property values to be passed to each binding generator
method called by the Java2WSDL command. You can also use a single
-properties option to specify multiple properties by separating them with
a comma, for example:
java2wsdl -properties prop1=value1 -properties prop2=value2is equivalent to:
java2wsdl -properties prop1=value1,prop2=value2
The -properties option provides flexibility to specify each command line option for each binding generator individually, if required. The value specified in the -properties option overrides the value specified in the equivalent command line option if both are specified.
-use LITERAL | ENCODED
Specifies which style and use combinations
are generated into the WSDL file when used with the -style argument. The combinations
are rpc and encoded, rpc and literal, or doc and literal. This setting applies
to all SOAP bindings. For more information, see the Map between Java, WSDL and XML.
-verbose
Displays verbose messages.
HelpXoptions
-debug
Displays debug messages.
-outputImpl impl-wsdl
When specified, this option indicates
two WSDL files should be generated; one for the interface and one for the
implementation. The implementation file is named by this option and the interface
WSDL is named by the output option. Typically, the -locationImport option is specified when -outputImpl is specified.
-locationImport location-uri
Typically, the Java2WSDL command
produces a single WSDL file. If you use the -outputImpl <file> option,
the Java2WSDL command produces two WSDL files: an interface WSDL file and
an implementation WSDL file. The interface WSDL file includes everything except
the <service> construct.
In the "split WSDL" mode, the implementation WSDL file must import the interface WSDL file. The -locationImport argument is used to set the <import location>=<location-uri>> in the implementation WSDL file. These settings enable the implementation WSDL file to import the interface WSDL file.
If locationImport is not specified in conjunction with outputImpl, an import location is not included in the implementation WSDL file.
-MIMEStyle
Specifies a style representing Multipurpose Internet
Mail Extensions (MIME) information. Valid arguments are:
-soapAction
Valid arguments are:
DEFAULT
Sets the soapAction field according to deployment information.
NONE
Sets the soapAction field to "".
OPERATION
Sets the soapAction field to the operation
name.
-stopClasses parent [, parent]
The Java2WSDL command
searches inherited classes and interfaces when generating extended complexTypes.
The search stops when a class or interface is found within a package that
begins with java or javax. The -stopClasses argument can
be used to define additional classes that cause the search to stop.
-namespaceImpl namespace
Specifies the target namespace
for the implementation WSDL if -outputImpl specified.
-voidReturn
Valid arguments are:
ONEWAY
Methods with void returns are one-way. This is the default for JMS transport.
TWOWAY
Methods with void returns are two-way. This the default
for HTTP transport.
-wrapped boolean
Specifies if the WSDL file should be
generated according to wrapped rules. This is only valid if use is
literal. The option defaults to true. This setting applies to all
SOAP bindings.