wsimport

You use the wsimport command to generate Java API for XML Web Services (JAX-WS) portable artifacts.

Synopsis

wsimport [ options ] wsdl_URI
options

This represents the wsimport command-line options. See Options for the wsimport Command.

wsdl_URI

The file that contains the machine-readable description of how the web service can be called, what parameters it expects, and what data structures it returns.

Description

The wsimport command generates the following JAX-WS portable artifacts. These artifacts can be packaged in a WAR file with the Web Services Description Language (WSDL) file and schema documents and the endpoint implementation to be deployed. The wsimport command also provides a wsimport Ant task.

  • Service Endpoint Interface (SEI)

  • Service

  • Exception class is mapped from wsdl:fault (if any)

  • Async Response Bean is derived from response wsdl:message (if any)

  • Java Architecture for XML Binding (JAXB) generated value types (mapped Java classes from schema types)

To start the wsgen command, enter the following commands:

  • Oracle Solaris/Linux:

    /bin/wsimport.sh -help
    
  • Windows:

    \bin\wsimport.bat -help
    

Options for the wsimport Command

-b path

Specifies external JAX-WS or JAXB binding files. Multiple JAX-WS and Java Architecture for XML Binding (JAXB) binding files can be specified with the -b option. You can use these files to customize package names, bean names, and so on.

-B jaxbOption

Passes the jaxbOption option to the JAXB schema compiler.

-catalog file

Specifies a catalog file to resolve external entity references. The -catalog option supports the TR9401, XCatalog, and OASIS XML Catalog formats.

-classpath path or -cp path

Specifies where to find user class files and wsimport extensions.

-d directory

Specifies where to place generated output files.

-encoding encoding

Specifies the character encoding used by the source files.

-extension

Allows vendor extensions. Use of extensions can result in applications that aren’t portable or that don’t work with other implementations.

-help

Displays a help message for the wsimport command.

-httpproxy:proxy

Specifies an HTTP proxy server. The format is:

[user[:password]@]proxyHost:proxyPort

-JjavacOption

Passes this option to javac.

-keep

Keeps generated files.

-p name

Specifies a target package name to override the WSDL file and schema binding customizations, and the default algorithm defined in the specification.

—m name

Generates module-info.java with the given Java module name.

-quiet

Suppresses the wsimport command output.

-s directory

Specifies where to place generated source files.

-target version

Generates code according to the specified JAX-WS specification version. Version 2.0 generates compliant code for the JAX-WS 2.0 specification.

-verbose

Displays compiler messages.

-version

Prints version information.

-fullversion

Prints full version information.

-wsdllocation location

Specifies the @WebServiceClient.wsdlLocation value.

-clientjar jarfile

Creates the jar file of the generated artifacts along with the WSDL metadata required for invoking the web service.

-generateJWS

Generates a stubbed Java Web Start (JWS) implementation file.

-implDestDir directory

Specifies where to generate the JWS implementation file.

-implServiceName name

Specifies the local portion of service name for generated JWS implementations.

-implPortName name

Specifies the local portion of the port name for generated JWS implementations.

Multiple JAX-WS and JAXB binding files can be specified using the -b option, and they can be used to customize various things such as package names and bean names.

Extensions for the wsimport Command

-XadditionalHeaders

Maps headers not bound to a request or response message to Java method parameters.

-Xauthfile file

Specifies the WSDL URI that identifies the file that contains authorization information. This URI is in the following format:

http://user-name:[email protected]host-name/web-service-name>?wsdl.
-Xdebug

Prints debugging information.

-Xno-addressing-databinding

Enables binding of W3C EndpointReferenceType to Java.

-Xnocompile

Doesn’t compile the generated Java files.

-XdisableAuthenticator

Disables Authenticator used by the JAX-WS reference implementation. -Xauthfile option will be ignored if set.

-XdisableSSLHostnameVerification

Disables the SSL Hostname verification while fetching wsdl files.

Examples

The following are examples of using the wsimport command:

 wsimport stock.wsdl -b stock.xml -b stock.xjb
 wsimport -d generated http://example.org/stock?wsdl