Java2WSDL command for JAX-RPC applications

The Java2WSDL command-line tool maps Java classes to a WSDL file for Java API for XML-based RPC (JAX-RPC) applications.

The Java2WSDL command maps a Java class to a Web Services Description Language (WSDL) file by following the Java API for XML-based Remote Procedure Call (JAX-RPC) 1.1 specification.

The Java2WSDL command accepts a Java class as input and produces a WSDL file that represents the input class. If a file exists at the output location, it is overwritten. The WSDL file that is generated by the Java2WSDL command contains WSDL and XML schema constructs that are automatically derived from the input class. You can override these default values with command-line arguments.

The Java2WSDL command is protocol independent; when you run the Java2WSDL command, you can specify command-line options that generate both SOAP and non-SOAP protocol bindings in the WSDL file. For each binding that can be generated, the Java2WSDL command has a binding generator to generate the WSDL for that binding.

Command line syntax and arguments

The command line syntax is:
Java2WSDL [argument...] class

The following command-line arguments are supported:

Required arguments

Important arguments

  • -location location

    Provides the published location or the Uniform Resource Locator (URL) of the service. If this information is not provided, a warning is issued that indicates that the final published location is not determined yet. The service location is typically overridden when the web service is deployed.

    The name after the last backslash is the name of the service port, unless the name is overridden by the -servicePortName argument. The service port address location attribute is assigned the specified value. Multiple endpoint addresses can be specified. Using the -location option is recommended only if a single binding type is required. If multiple binding types are requested, protocol binding-specific location properties are passed over the command line using the -x flag.

    The following example illustrates how to produce both SOAP over HTTP, and SOAP over Java Message Service (JMS) bindings :
    java2wsdl -bindingTypes http,jms \
    		-x http.location=http://your.server.name:9080/StockQuoteService/services/StockQuote \
    		-x jms.location= \
    	jms:/queue?destination=jms/MyQueue&connectionFactory=jms/MyCF&targetService=StockQuote	
    Use the -location option to determine to which port the -location option value applies by requiring the endpoint URLs to be specified through the binding-specific property values.
  • -output wsdl-uri

    Indicates the path and file name of the output WSDL file. If not specified, the default class.wsdl file is written into the current directory.

  • -input wsdl-uri

    Specifies the input WSDL file that is used to build an output WSDL file. Information from an existing WSDL file, is specified in this option and is used with the input Java class to generate the output.

  • -bindingTypes
    Specifies the list of binding types write to the output WSDL file. Each binding generator in the Java2WSDL command supports specific binding types. The valid binding type values are http (SOAP over HTTP), jms (SOAP over JMS) and ejb (local or remote EJB invocation). For example, the following command can be used to generate SOAP over HTTP, EJB bindings for the my.pkg.MySEI Service Endpoint Interface and the my.pkg.MyEJBClass implementation class :
    java2wsdl -bindingTypes http,ejb -implClass my.pkg.MyEJBClass my.pkg.MySEI
    The following command is an example of using the -bindingTypes option to generate SOAP over HTTP and SOAP over JMS bindings:
    java2wsdl -bindingTypes http,jms -implClass my.pkg.MyEJBClass my.pkg.MySEI
  • -style RPC | DOCUMENT

    Specifies the WSDL style to use in the generated WSDL file. To learn more, see the Mapping between Java language, WSDL and XML for JAX-RPC applications information. This argument is used with the -use argument.

    If RPC is specified with -use ENCODED, a style=rpc/use=encoded WSDL file is generated. If RPC is specified with the -use LITERAL option, a style=rpc/use=literal WSDL file is generated. If DOCUMENT is specified with the -use LITERAL option, a style=document/use=literal WSDL file is generated.

  • -use LITERAL | ENCODED

    Specifies which style and use combinations are generated into the WSDL file when used with the -style argument. The combinations are rpc and encoded, rpc and literal, or doc and literal. This setting applies to all SOAP bindings. To learn more, see the Mapping between Java language, WSDL and XML for JAX-RPC applications information.

  • -transport http | jms

    Generates SOAP bindings for either HTTP (default) or JMS. If JMS is specified, the characters jms are appended to the WSDL file name to prevent overwriting an existing WSDL file for another transport. The transport option can be specified only once.

    This option is deprecated. The -bindingTypes option replaces the -transport option, so that you can generate bindings that are non-SOAP specific.

  • -portTypeName name

    Specifies the name to use for the portType element. If not specified, the binding name is the port type name.

  • -bindingName name

    Specifies the name to use for the binding element. If not specified, the binding name is the port type name.

  • -serviceElementName name

    Specifies the name of the service element.

  • -servicePortName name

    Specifies the name of the service. If not specified, the service name is derived from the -location argument.

  • -namespace targetNamespace

    Indicates the target namespace for the WSDL file being generated. To learn about the algorithm that is used to obtain the default namespace, see the Mapping between Java language, WSDL and XML for JAX-RPC applications information.

  • -PkgtoNS package namespace

    Specifies the mapping of a Java package to a namespace. If a package does not have a namespace, the Java2WSDL command generates a namespace name. You can repeat the -PkgtoNS argument to specify mappings for multiple packages.

  • -extraClasses classes

    Specifies other classes that are represented in the WSDL file.

  • -implClass impl-class

    The Java2WSDL command uses method parameter names to construct the WSDL file message part names. The command automatically obtains the message names from the debug information in the class. If the class is compiled without debug information, or if the class is an interface, the method parameter names are not available. In this case, you can use the -implClass argument to provide an alternative class from which to obtain method parameter names. The impl-class does not need to implement the class if the class is an interface, but it must implement the same methods as the class.

  • -verbose

    Displays verbose messages.

  • -help

    Displays the help message.

  • -helpX

    Displays the help message for extended options and for various options that are supported by binding generators.

Other arguments




Related concepts
Assembly tools
Related tasks
Implementing web services applications with JAX-RPC
Implementing web services applications from existing WSDL files with JAX-RPC
Related reference
Mapping between Java language, WSDL and XML for JAX-RPC applications
WSDL2Java command for JAX-RPC applications
Web services specifications and APIs
Reference topic Reference topic    

Terms of Use | Feedback

Last updatedLast updated: Sep 19, 2011 6:15:55 PM CDT
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=matt&product=was-express-dist&topic=rwbs_java2wsdl
File name: rwbs_java2wsdl.html