1. wsdl2java

The wsdl2java tool is for the JAX-RPC web service. The following are the codes created by wsdl2java from a WSDL file.

  • Web service Java source code stubs for clients

  • Web service interface Java source code for servers

The following describes how to use the tool and parameters.

  • Usage

    Usage: wsdl2java mode [options] wsdlURI
    
    where mode include:
    -gen:client              generate all client artifacts
    -gen:server              generate all server artifacts
    -gen                     same as -gen:client
    -import:client           generate client JSR-109 portable artifacts only
    -import:server           generate server JSR-109 portable artifacts only
    -import                  same as -import:client
    
    where [options] include:
    * destination directory
    -d <directory>           specify where to put output files
    -cd <directory>          specify where to put compiled class files
                             If not specifed, the compile class files will be
                             put in where '-d' specifies
    
    * WSDL and Java mapping
    -inputmapping <filename> specify the input JSR-109 JAX-RPC mapping file
                             (used for generating Java artifacts)
    -package <package_name>  specify the java package name to which
                             all namespaceURI in the WSDL map
    -ns2pkg NS=PKG           specify the namespaceURI and java package name mapping
                             (NS : namespaceURI, PKG : java package name)
                             This option can be used serveral times
    
    * output file
    -outputmapping <filename>  specify the output JSR-109 JAX-RPc mapping file
                             for the input WSDL
                             This option can not be used with '-inputmapping'
    -compile                 compile generated Java source files
                             ('tools.jar' must be in the classpath)
    -nokeepsrc               delete generated java source files
    
    * artifact generation options
    -nowrapped               disable wrapped mode detection for the WSDL
    -datahandleronly         force jakarta.activation.DataHandler for MIME types
    -nodatabinding           force jakarta.xml.soap.SOAPElement for all WSDL parts
    -soapver <VER>           specify SOAP version used in stub/tie class.
                             VER : '11' for SOAP 1.1, '12' for SOAP 1.2
    -resolvedir directory    specify directory where to be put local copies
                             of include/import schemas and import WSDL
    
    * other options
    -username                username to access the WSDL-URI
    -password                password to access the WSDL-URI
    
    * verbose options
    -level <LEVEL>           specify log level.
                             LEVEL : SEVERE, WARNING, INFO, FINE, FINER, FINEST
    -verbose                 same as -level FINE
  • Parameters

    Parameter Description

    -gen:client

    Creates Java classes for clients.

    -gen:server

    Creates Java classes for servers.

    -gen

    Same as -gen:client.

    -import:client

    Creates Portable Artifact for clients.

    -import:server

    Creates a Portable Artifact for servers

    -import

    Same as -import:client.

    -d <directory>

    Result files directory.

    -cd <directory>

    Compiled class files directory.

    -inputmapping <filename>

    Input JAX-RPC mapping files used to create Java classes.

    -package <package_name>

    Java package name for all namespace URIs in WSDL.

    -ns2pkg NS=PKG

    Java package name for the namespace URI.

    • NS: Namespace URI

    • PKG: Java package name

    -outputmapping <filename>

    Output JAX-RPC mapping files for the WSDL input.

    -compile

    Compiles created Java files.

    -nokeepsrc

    Deletes created Java source files.

    -nowrapped

    Disables the wrapped mode detection function for WSDL.

    -datahandleronly

    Applies jakarta.activation.DataHandler to the MIME type.

    -nodatabinding

    Applies jakarta.xml.soap.SOAPElement to all WSDL message parts.

    -soapver <VER>

    SOAP version used in stub/tie classes.

    • 11: SOAP 1.1

    • 12: SOAP 1.2

    -resolvedir <directory>

    Stores remote WSDL files, including schema files, in an accessible repository.

    -username

    Username to access WSDL-URI

    -password

    Password to access WSDL-URI

    -level <LEVEL>

    Log level.

    -verbose

    Displays verbose messages.

  • Example

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

    The following is an example of executing wsdl2java.

    $ wsdl2java -gen:client -d build/classes
    -outputmapping build/classes/web/WEB-INF/jaxrpcmapping.xml
    -compile http://localhost:8088/AddNumbers/addnumbers?wsdl

    The previous command created service interfaces and stubs for web service clients using the remote "http://localhost:8088/AddNumbers/addnumbers?wsdl" WSDL file.

    The stubs and service interfaces are created in the "build/classes" directory. The JAX-RPC mapping files are created in the "build/classes/web/WEB-INF" directory. The stub and interface files created using the "-compile" option are compiled.