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
optionsThis represents the wsgen command-line options. See Options for wsgen.
SEIThe 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 pathThis option sets the location of the input class files.
-d directoryThis option sets the location for where to place generated output files.
-encoding encodingThis option specifies the character encoding used by source files.
-extensionThis 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.
-helpThis option displays a help message about the wsgen command.
-Joption-keepThis option keeps the generated files.
-r directoryThis option with the -wsdl option is used to specify where to place generated resource files such as web Services Definition Language (WSDL) files.
-s directoryThis option sets the location for where to place generated source files.
-verboseThis option displays compiler messages.
-versionThis option prints release information.
-fullversionThis 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.
-inlineSchemasThis option produces inline schemas in the generated wsdl. This must be used in conjunction with the -wsdl option.
-servicename nameThis 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 nameThis 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 fileThis option specifies the External Web Service Metadata XML descriptor.
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