WSDL2Client tool reference

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:

To create the client archive:

 

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, 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 EJB2WebService with WS-Security information. The directory must contain ibm-webservices-bnd.xmi and ibm-webservices-ext.xmi files. If you are generating client-side bindings, 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.

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.
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"/>

 

Parent topic

Creating a Web service client using the WSDL2Client Tool

Related Tasks
Creating a Web service using the Bean2WebService tool

Related Reference
Java2WSDL tool reference