The WSDL2Client tool generates a client from a web service's
WSDL document.
Syntax
Once you have set up your command line, you can use the
following syntax and arguments to run the tool:
To
create a skeleton client implementation:
- Windows: WSDL2Client
[<optional arguments>] -project <ProjectDir> <WSDL URI>
- Linux: WSDL2Client.sh
[<optional arguments>] -project <ProjectDir> <WSDL URI>
- <WSDL URI> must be the final argument.
- In order to successfully run the -createEar argument, you must
specify the -clientType argument when creating a skeleton web service
client implementation.
To create the client archive:
- Windows: WSDL2Client
[<optional arguments>] -createEar <name of target ear file>
-clientType <application | servlet | EJB> <ProjectDir>
- Linux: WSDL2Client.sh
[<optional arguments>] -createEar <name of target ear file>
-clientType <application | servlet | EJB> <ProjectDir>
Arguments
To create a skeleton client
implementation:
Mandatory arguments:
- -project <ProjectName>
- Specifies the fully-qualified path name of the target project
directory for the output. If this directory does not exist, it is
created by WSDL2Client. The default is the current directory.
- <WSDL-URI>
- Specifies the location of the WSDL document as a URI. This URI
can be either remote or on the local file system. If your WSDL is
split over multiple WSDL documents, you must specify the document
at the top of the import chain, usually the implementation WSDL.
Optional arguments:
- -NSToPkg <mappings>
- Specifies a list of namespace=package mappings.
- -fileNSToPkg <mappings file>
- Specifies the path to a properties file that contains namespace=package
mappings. Note that colons (':') in the namespaces must be escaped
with a backslash in this file. For example, http\://my.namespace.
WSDL2Client ignores any namespace references that do not contain an
escaped colon.
- -all
- Generates Java™ classes for
all the complex types defined in the WSDL document. The default is
to generate the classes that are both defined and referenced in the
WSDL document only.
- -genResolver
- Generates an import resolver, which contains all the information
from imported xsd (xml schema) files. See Note 1 for additional information
about this parameter.
- -wsSecDir <directory>
- Specifies the full path to a directory that contains the templates
used to configure the deployment descriptors generated by WSDL2Client
with WS-Security information. The directory must also contain the
files ibm-webservicesclient-bnd.xmi and ibm-webservicesclient-ext.xmi.
- -clientType <J2SE | Application | Servlet | EJB>
- Generates a skeleton implementation class for the type of client
specified. You can only use this argument in conjunction with the
-genMain argument.
- -genMain <name of main class>
- Specifies the name of the main class to generate. You can only
use this argument in conjunction with the -clientType argument.
- -user
- Specifies the user name to use to access the WSDL URI.
- -password
- Specifies the password to use to use to access the WSDL URI.
- -verbose
- Displays extra information as the tool runs.
- -help
- Displays the help information.
- -clientName <client name>
- Generate the client under a directory called <client name>
in <ProjectDirectory>.
- -overwrite
- Overwrite any existing client directories.
To create the client archive:
Mandatory
arguments:
- -createEar<name of target ear file>
- Specifies the fully-qualified path name of the EAR file to be
created. If it already exists, it will be backed up with a .ear~ extension
before the new one is overwritten.
- -clientType <application | servlet | EJB>
- Specifies the type of client to implement.
- -ri
- Specifies the name of the client remote interface. This must be
a fully-qualified package name. This argument is mandatory if you
specify -clientType EJB. For all other types, the argument is invalid.
- -main
- Specifies the name of the client main class. This must be a fully-qualified
package name. This argument is mandatory if you specify -clientType <Application
| Servlet>. For all other types, the argument is invalid.
- <ProjectDir>
- The path name of the project directory created either by stage
1 of WSDL2Client, or one of the other tools such as Bean2WebService.
This directory must contain a Client-side directory with a compiled
implementation of a client.
Optional arguments:
- -verbose
- Displays extra information as the tool runs.
- -help
- Displays the help information.
- -rootModule <root module base name>
- Merge and aggregate individual web service clients of the client
same type into one single module. Valid only if clients are generated
with the -clientName option. The Web module will be named <root
module base name>_WEB.war, the EJB client module will be named <root
module base name>_EJB.jar, and the application client module will
be named <root module base name>_APP.jar.
Note 1: Only select the
-genResolver argument
to bring a remote, absolute reference local so that when the web service
run, it does not have to be connected to the Internet. It should
not be used for local or relative imports. Also, the -genResolver
option should not be used on a WSDL file that contains WSDL imports
that import an XSD file. For example, instead of having a WSDL import
outside the schema element:
<import location="a.xsd" namespace="http://namespaceA"/>
<types>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://namespaceA"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
replace it with a schema import inside the schema element:
<types>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://namespaceA"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<import schemaLocation="a.xsd" namespace="http://namespaceA"/>