wsgen

You use the wsgen command to generate Java API for XML Web Services (JAX-WS) portable artifacts used in JAX-WS web services.

Synopsis

wsgen [options] SEI
options

This represents the wsgen command-line options. See Options for wsgen.

SEI

The web service endpoint implementation (SEI) class to be read.

Description

The wsgen command generates JAX-WS portable artifacts used in JAX-WS web services. The tool reads a web service endpoint class and generates all the required artifacts for web service deployment and invocation.

To start the wsgen tool, enter the following commands:

  • Oracle Solaris, Linux, and OS X:

    export JAXWS_HOME=/pathto/jaxws-ri
    $JAXWS_HOME/bin/wsgen.sh -help
    
  • Windows:

     set JAXWS_HOME=c:\pathto\jaxws-ri
    %JAXWS_HOME%\bin\wsgen.bat -help
    

Options for wsgen

-classpath path or -cp path

This option sets the location of the input class files.

-d directory

This option sets the location for where to place generated output files.

-encoding encoding

This option specifies the character encoding used by source files.

-extension

This option allows the use of vendor extensions. Use of extensions can result in applications that aren’t portable or that don’t work with other implementations.

-help

This option displays a help message about the wsgen command.

-Joption
-keep

This option keeps the generated files.

-r directory

This option with the -wsdl option is used to specify where to place generated resource files such as web Services Definition Language (WSDL) files.

-s directory

This option sets the location for where to place generated source files.

-verbose

This option displays compiler messages.

-version

This option prints release information.

-fullversion

This option prints full version information.

-wsdl[:protocol]

This is an optional command that generates a WSDL file to review before endpoint deployment. The WSDL file contains a machine-readable description of how the service can be called, what parameters it expects, and what data structures it returns.

Note:

You don’t have to generate WSDL at development time because the JAX-WS run time environment generates a WSDL file for you when you deploy your service.

By default, the wsgen command doesn’t generate a WSDL file. The protocol value is optional and is used to specify what protocol should be used for the WSDL binding (wsdl:binding). Valid protocols are soap1.1 and Xsoap1.2. The default is soap1.1. The Xsoap1.2 protocol isn’t standard and can be used only with the -extension option.

-inlineSchemas

This option produces inline schemas in the generated wsdl. This must be used in conjunction with the -wsdl option.

-servicename name

This option is used only with the -wsdl option to specify a particular WSDL service (wsdl:service) name to be generated in the WSDL file, for example: -servicename "{http://mynamespace/}MyService".

-portname name

This option is used only with the -wsdl option to specify a particular WSDL port (wsdl:port) name to be generated in the WSDL file, for example: -portname "{http://mynamespace/}MyPort".

-x file

This option specifies the External Web Service Metadata XML descriptor.

Extensions of wsgen

-Xnocompile

This option doesn’t compile generated Java files.

Examples

The following example generates the wrapper classes for StockService with @WebService annotations inside the stock directory.

wsgen -d stock -cp myclasspath stock.StockService

The following example generates a Simple Object Access Protocol (SOAP) 1.1 WSDL file and schema for the stock.StockService class with @WebService annotations.

wsgen -wsdl -d stock -cp myclasspath stock.StockService

The following example generates a SOAP 1.2 WSDL file.

wsgen -wsdl:Xsoap1.2 -d stock -cp myclasspath stock.StockService