The wsimport command-line tool processes an existing Web Services
Description Language (WSDL) file and generates the required portable artifacts
for developing Java API for XML-Based Web Services (JAX-WS) Web service applications.
The wsimport command-line tool supports the top-down approach to
developing JAX-WS Web services. When you start with an existing WSDL file,
use the wsimport command-line tool to generate the required JAX-WS
portable artifacts.
The
wsimport tool reads an existing WSDL file and generates the
following portable artifacts:
- Service Endpoint Interface (SEI) - The SEI is the annotated Java representation
of the WSDL file for the Web service. This interface is used for implementing
JavaBeans endpoints or creating dynamic proxy client instances.
- javax.xml.ws.Service extension class - This is a generated
class that extends the javax.xml.ws.Service class. This class
is used to configure and create both dynamic proxy and dispatch instances.
- required data beans, including any Java Architecture for XML Binding (JAXB)
beans that are required to model the Web service data.
You can package the generated artifacts in a Web archive (WAR) file with
the WSDL file and schema documents along with the endpoint implementation
to be deployed.
Supported configurations: To correctly use the
wsimport tool, you
must adhere to the following requirements:
- You must define all your services within the main WSDL file. Services
that are defined within an imported WSDL file are not processed by the wsimport tool.
- If you run the wsimport tool on a WSDL file that implements a Document
or Literal style pattern, the complexTypes elements that define the input
and output types must be composed of unique parameter names to prevent naming
conflicts in the parameter list for the operation when the portType is used.
- If you run the wsimport tool and pass a ?wsdl Uniform
Resource Identifier (URI) as a parameter for a WSDL file, ensure that you
are using the actual resolved WSDL URI. The wsimport tool correctly
resolves the ?wsdl URI, but other relative URIs that are
referenced might not resolve correctly.
- If you pass in a JAXB binding file into the wsimport tool, the
JAXB bind file must be valid. If your JAXB binding file is not correctly constructed,
the wsimport tool runs, but ignores, any errors that are found in the
binding file. Because the wsimport tool does not capture or report
these errors, you might not learn about the errors until you discover that
the JAXB customizations did not take effect in your application. To determine
if you have a JAXB binding file that is not correctly constructed, run the xjc tool
with your WSDL file or schema document and your custom binding file. The xjc tool
reports errors that are found within the custom binding file. For more information
on the xjc tool, see the using JAXB tools to generate JAXB classes
from an XML schema file documentation.
sptcfg
Syntax
The command-line syntax is:
app_server_root/bin wsimport [options] WSDL_URI
Parameters
The WSDL_URI is the only parameter
that is required. The following parameters are optional for the wsimport command:
- -d <directory>
- Specifies where to place the generated output files.
- -b <path>
- Specifies the external JAX-WS or JAXB binding files. You can specify multiple
JAX-WS and JAXB binding files by using the -b option; however,
each file must be specified with its own -b option.
- -catalog
- Specifies the catalog file to resolve external entity references. It supports
the TR9401, XCatalog, and the OASIS XML Catalog formats
- -extension
- Specifies whether to accept custom extensions for functionality that are
not specified by the JAX-WS specification. The use of custom extensions can
result in applications that are not portable or do not interoperate with other
implementations.
- -help
- Displays the help menu.
- -httpproxy:<host>:<port>
- Specifies an HTTP proxy. The default port value is 8080.
- -keep
- Specifies whether to keep the generated source files.
- -p
- Specifies a target package with this command-line option and overrides
any WSDL file and schema binding customization for the package name and the
default package name algorithm defined in the JAX-WS specification.
- -s <directory>
- Specifies the directory to place the generated source files.
- -verbose
- Specifies to output messages about what the compiler is doing.
- -version
- Prints the version information. If you specify this option, only the version
information is included in the output and normal command processing does not
occur.
- -wsdlLocation
- Specifies the @WebServiceClient.wsdlLocation value.
Supported configurations: The
wsimport tool does not set the
@WebsService.wsdlLocation value
either by default or when the -wsdlLocation attribute is specified. The wsimport
command-line tool updates the @WebServiceClient.wsdlLocation annotation only.
You can manually update the @WebService.wsdlLocation annotation with a relative
URL that specifies the location of the Web Services Description Language (WSDL)
file. If the @WebService.wsdlLocation annotation is present on an endpoint
implementation class, then the value must be a relative URL and the WSDL document
that it references must be packaged with the application.
sptcfg