243 lines
12 KiB
HTML
243 lines
12 KiB
HTML
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||
|
<html>
|
||
|
<head>
|
||
|
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||
|
<LINK rel="stylesheet" type="text/css" href="../../../rzahg/ic.css">
|
||
|
|
||
|
<title>The Java2WSDL script</title>
|
||
|
</head>
|
||
|
|
||
|
<BODY>
|
||
|
<!-- Java sync-link -->
|
||
|
<SCRIPT LANGUAGE="Javascript" SRC="../../../rzahg/synch.js" TYPE="text/javascript"></SCRIPT>
|
||
|
|
||
|
<h3><a name="qshjava2wsdl"></a>The Java2WSDL script</h3>
|
||
|
|
||
|
<p>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.</p>
|
||
|
|
||
|
<p>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.</p>
|
||
|
|
||
|
<p>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 <a href="wsrefs.htm">Web services resources</a> 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.</p>
|
||
|
|
||
|
<p><strong>Product</strong></p>
|
||
|
<p>This script is available in WebSphere Application Server - Express. The script is located in the /QIBM/ProdData/WebASE51/ASE/bin directory.</p>
|
||
|
|
||
|
<p><strong>Authority</strong></p>
|
||
|
<p>To run this script, your user profile must have *RX authority.</p>
|
||
|
|
||
|
<p><strong>Syntax</strong></p>
|
||
|
<p>The syntax of the script is:</p>
|
||
|
|
||
|
<pre>Java2WSDL <em>class</em> [argument...]</pre>
|
||
|
|
||
|
<p><strong>Parameters</strong></p>
|
||
|
<p>The parameters of the script are:</p>
|
||
|
|
||
|
<p><b>Required parameter</b></p>
|
||
|
<ul>
|
||
|
<li><p><strong><em>class</em></strong>
|
||
|
<br>This is a required parameter. The value <em>class</em> represents the fully qualified name of one of the following Java classes:</p>
|
||
|
<ul>
|
||
|
<li>A Service Endpoint Interface that extends the java.rmi.Remote class</li>
|
||
|
<li>A Java bean</li>
|
||
|
</ul>
|
||
|
<p>The Java2WSDL command locates the class in CLASSPATH.</p></li>
|
||
|
</ul>
|
||
|
<p><b>Optional parameters</b></p>
|
||
|
<ul>
|
||
|
<li><p><strong>-bindingName</strong>
|
||
|
<br>This is an optional parameter. The value <em>name</em> specifies the name to use for the binding element. If not specified, the binding name is derived from <em>class</em>.</p></li>
|
||
|
|
||
|
<li><p><strong>-help</strong>
|
||
|
<br>Displays the help message.</p></li>
|
||
|
|
||
|
<li><p><strong>-helpX</strong>
|
||
|
<br>Displays the help message for extended options. Also displays help messages for various options supported by binding generators.</p></li>
|
||
|
|
||
|
<li><p><strong>-extraClasses <em>classes</em></strong>
|
||
|
<br>Specifies other classes that should
|
||
|
be represented in the WSDL file.</p></li>
|
||
|
|
||
|
<li><p><strong>-input <em>wsdl-uri</em></strong>
|
||
|
<br>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.</p></li>
|
||
|
|
||
|
<li><p><strong>-implClass <em>impl-class</em></strong>
|
||
|
<br>The <strong>Java2WSDL</strong> 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 <em>class</em>.</p></li>
|
||
|
|
||
|
<li><p><strong>-namespace <em>targetNamespace</em></strong>
|
||
|
<br>Indicates the target namespace
|
||
|
for the WSDL file being generated. See <a href="wsdevmap.htm">Map
|
||
|
between Java, WSDL and XML</a> for the algorithm used to obtain
|
||
|
the default namespace.</p></li>
|
||
|
|
||
|
<li><p><strong>-output <em>wsdl-uri</em></strong>
|
||
|
<br>Indicates the path and file name of the
|
||
|
output WSDL file. If not specified, the default file, <tt><em>class</em>.wsdl</tt>,
|
||
|
is written into the current directory.</p></li>
|
||
|
|
||
|
<li><p><strong>-PkgtoNS <em>package namespace</em></strong>
|
||
|
<br>Specifies the mapping of a
|
||
|
Java package to a namespace. If there is a package without a namespace, the <strong>Java2WSDL</strong> command generates a namespace name. This argument can be repeated to specify mapping for multiple packages.</p></li>
|
||
|
|
||
|
<li><p><strong>-portTypeName <em>name</em></strong>
|
||
|
<br>Specifies the name to use for the
|
||
|
portType element. If not specified, the class name is used.</p></li>
|
||
|
|
||
|
<li><p><strong>-serviceElementName <em> name</em></strong>
|
||
|
<br>Specifies the name of the service
|
||
|
element.</p></li>
|
||
|
|
||
|
<li><p><strong>-servicePortName <em>name</em></strong>
|
||
|
<br>Specifies the name of the service.
|
||
|
If not specified, the service name is derived from the -location argument.</p></li>
|
||
|
|
||
|
<li><p><strong>-style RPC | DOCUMENT </strong>
|
||
|
<br>Specifies the WSDL style to use in the
|
||
|
generated WSDL file. For more information about styles, see <a href="wsdevmap.htm">Map between Java, WSDL and XML</a>. This
|
||
|
argument is used with the -use argument.</p>
|
||
|
|
||
|
<p>If RPC is specified with -use ENCODED, or omitting use, a <tt>style=rpc/use=encoded</tt> WSDL file is generated. If RPC is specified with -use LITERAL, a <tt>style=rpc/use=literal </tt> WSDL file is generated. If DOCUMENT is specified with -use LITERAL or omitting
|
||
|
use, a <tt>style=document/use=literal</tt> WSDL file is generated. This setting
|
||
|
applies to all SOAP bindings.</p></li>
|
||
|
|
||
|
<li><p><strong>-transport http | jms</strong>
|
||
|
<br>Generates SOAP bindings for either Hyper Text Transport Protocol (HTTP) (default) or
|
||
|
Java Messaging Service (JMS). If <tt>jms</tt> 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 <tt>jms</tt> option is not used in WebSphere Application Server - Express.</p>
|
||
|
|
||
|
<p><strong>Note: </strong>This option is deprecated in Version 5.1.1. The <strong>-bindingTypes</strong> option replaces
|
||
|
the <strong>-transport</strong> option, allowing you to generate bindings that are non-SOAP specific.</p></li>
|
||
|
|
||
|
<li><p><strong>-bindingTypes </strong>
|
||
|
<br>Specifies the list of binding types that should be written to the output WSDL file.
|
||
|
Each binding generator in the <strong>Java2WSDL</strong> tool supports specific binding
|
||
|
types. The valid binding type values are <strong>http</strong> (SOAP over HTTP), <strong>jms</strong> (SOAP over JMS) and <strong>ejb</strong> (local or remote EJB invocation). Only the <strong>http</strong> value is valid on WebSphere Application Server - Express for iSeries.</p></li>
|
||
|
|
||
|
<li><p><strong>-location <em>location </em></strong>
|
||
|
<br>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.</p></li>
|
||
|
|
||
|
<li><p><strong>-properties</strong>
|
||
|
<br>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 <strong>Java2WSDL </strong> command. You can also use a single
|
||
|
-properties option to specify multiple properties by separating them with
|
||
|
a comma, for example:</p>
|
||
|
<pre>
|
||
|
java2wsdl -properties prop1=value1 -properties prop2=value2
|
||
|
</pre>
|
||
|
is equivalent to:
|
||
|
<pre>
|
||
|
java2wsdl -properties prop1=value1,prop2=value2
|
||
|
</pre>
|
||
|
<p>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.</p></li>
|
||
|
|
||
|
<li><p><strong>-use LITERAL | ENCODED</strong>
|
||
|
<br>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 <a href="wsdevmap.htm">Map between Java, WSDL and XML</a>.</p></li>
|
||
|
|
||
|
<li><p><strong>-verbose </strong>
|
||
|
<br>Displays verbose messages.</p></li>
|
||
|
</ul>
|
||
|
|
||
|
<p><strong>HelpXoptions</strong></p>
|
||
|
<ul>
|
||
|
<li><p><strong>-debug</strong>
|
||
|
<br>Displays debug messages.</p></li>
|
||
|
|
||
|
<li><p><strong>-outputImpl <em>impl-wsdl</em></strong>
|
||
|
<br>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 <em><strong>output</strong></em> option. Typically, the -locationImport option is specified when -outputImpl is specified.</p></li>
|
||
|
|
||
|
<li><p><strong>-locationImport <em>location-uri</em></strong>
|
||
|
<br>Typically, the <strong>Java2WSDL</strong> 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.</p>
|
||
|
<p>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.</p>
|
||
|
<p>If locationImport is not specified in conjunction
|
||
|
with outputImpl, an import location is not included in the implementation
|
||
|
WSDL file.</p></li>
|
||
|
|
||
|
<li><p><strong>-MIMEStyle </strong>
|
||
|
<br>Specifies a style representing Multipurpose Internet
|
||
|
Mail Extensions (MIME) information. Valid arguments are:</p>
|
||
|
<ul>
|
||
|
<li><strong>Axis</strong></li>
|
||
|
<li><strong>WSDL11</strong> (default)</li>
|
||
|
</ul><p></p></li>
|
||
|
|
||
|
<li><p><strong>-soapAction </strong>
|
||
|
<br>Valid arguments are:</p>
|
||
|
<ul>
|
||
|
<li><p><strong>DEFAULT</strong><br>Sets the <tt>soapAction</tt> field according to deployment information.</p></li>
|
||
|
<li><p><strong>NONE</strong><br>Sets the <tt>soapAction</tt> field to "".</p></li>
|
||
|
<li><p><strong>OPERATION</strong><br>Sets the <tt>soapAction</tt> field to the operation
|
||
|
name.</p></li>
|
||
|
</ul>
|
||
|
<p></p></li>
|
||
|
|
||
|
<li><p><strong>-stopClasses <em>parent</em> [, <em>parent</em>]</strong>
|
||
|
<br>The <strong>Java2WSDL</strong> 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 <tt>java</tt> or <tt>javax</tt>. The -stopClasses argument can
|
||
|
be used to define additional classes that cause the search to stop.</p></li>
|
||
|
|
||
|
<li><p><strong>-namespaceImpl <em>namespace</em></strong>
|
||
|
<br>Specifies the target namespace
|
||
|
for the implementation WSDL if -outputImpl specified.</p></li>
|
||
|
|
||
|
<li><p><strong>-voidReturn</strong>
|
||
|
<br>Valid arguments are:</p>
|
||
|
<ul>
|
||
|
<li><p><strong>ONEWAY</strong><br>Methods with void returns are one-way. This is the default for JMS transport.</p></li>
|
||
|
<li><p><strong>TWOWAY</strong><br>Methods with void returns are two-way. This the default
|
||
|
for HTTP transport.</p></li>
|
||
|
</ul>
|
||
|
<p></p></li>
|
||
|
|
||
|
<li><p><strong>-wrapped <em>boolean</em></strong>
|
||
|
<br>Specifies if the WSDL file should be
|
||
|
generated according to wrapped rules. This is only valid if <tt>use</tt> is
|
||
|
literal. The option defaults to <tt>true</tt>. This setting applies to all
|
||
|
SOAP bindings.</p></li>
|
||
|
</ul>
|
||
|
|
||
|
|
||
|
</body>
|
||
|
</html>
|