1. wsgen

The wsgen tool is for the JAX-WS web service. It creates a WSDL file and JAX-RPC mapping files from Java classes. wsgen can also create web service policy configuration files.

wsgen creates the following from the service endpoint interface classes and classes implemented in Java.

  • Portable Artifacts

  • WSDL file of web services (option)

  • The web service policy wsit-<endpoint classname>.xml file (option)

The following describes how to use the tool and parameters.

  • Usage

    Usage: wsgen [options] <SEI>
    
    where [options] include:
      -classpath <path>        specify where to find input class files
      -cp <path>               same as -classpath <path>
      -d <directory>           specify where to place generated output files
      -extension               allow vendor extensions - functionality not specified
                               by the specification.  Use of extensions may
                               result in applications that are not portable or
                               may not interoperate with other implementations
      -help                    display help
      -keep                    keep generated files
      -r <directory>           resource destination directory, specify where to
                               place resouce files such as WSDLs
      -s <directory>           specify where to place generated source files
      -verbose                 output messages about what the compiler is doing
      -version                 print version information
      -wsdl[:protocol]         generate a WSDL file. The protocol is optional.
                               Valid protocols are [soap1.1, Xsoap1.2], the default is
                               soap1.1.
                               The non stanadard protocols [Xsoap1.2] can only be used
                               in conjunction with the -extension option.
      -inlineSchemas           inline schemas in the generated wsdl.
                               Must be used in conjunction with the -wsdl option.
      -servicename <name>      specify the Service name to use in the generated WSDL
                               Used in conjunction with the -wsdl option.
      -portname <name>         specify the Port name to use in the generated WSDL
                               Used in conjunction with the -wsdl option.
    
    Examples:
      wsgen -cp . example.Stock
      wsgen -cp . example.Stock -wsdl -servicename {http://mynamespace}MyService
  • Parameters

    Parameter Description

    -classpath <path>

    Path to Java class files.

    -cp <path>

    Alias for -classpath <path>.

    -d <directory>

    Result files directory.

    -extension

    Allows vendor extensions. This option may cause compatibility and portability issues.

    -help

    Displays help.

    -keep

    Keeps created files.

    -r <directory>

    WSDL file directory. Used with the genwsdl property.

    -s <directory>

    Source files directory.

    -verbose

    Displays verbose messages.

    -version

    Displays version information.

    -wsdl[:protocol]

    Normally, the wsgen tool does not create a WSDL file. This option allows developers to view the WSDL file before it is deployed.

    '[:protocol]' is optional, and the default value is soap1.1. To use Xsoap1.2, the -extension option must be specified.

    -inlineSchemas

    Enumerates the schema of the created WSDL.

    This option must be used along with the -wsdl option.

    -servicename <name>

    Name of a specific wsdl:service element of the created WSDL file. Used with the -wsdl property.

    -portname <name>

    Name of a specific wsdl:portname element of the created WSDL file. Used with the -wsdl property.

  • Example

    wsgen is a general script file located in JEUS_HOME/bin/.

    The following is an example of executing wsgen.

    $ wsgen -classpath build/classes -d build/classes -wsdl 
    fromjava.server.AddNumbersImpl

    The previous command organizes the JAX-WS web service from fromjava.server.AddNumbersImpl, the service endpoint implementation class. The class path to fromjava.server.AddNumbersImpl is "build/classes", and Java Bean files are created in the "build/classes" directory with the WSDL file.