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) specification. The Java2WSDL command accepts a Java class as input and produces a WSDL file representing the input class. If there is an existing file at the output location, it is overwritten. The WSDL file 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.
Command line syntax and arguments
The command line syntax is:
Java2WSDL [argument...] class
The following command-line arguments are supported:
Required arguments
Represents the fully qualified name of one of the following Java classes:
Important arguments
Specifies the name to use for the binding element. If not specified, the binding name is derived from class .
Displays the help message.
Displays the help message for extended options.
Specifies other classes that should be represented in the WSDL file.
Specifies the input WSDL file used to build an output WSDL file. Information from an existing WSDL file, whose name is specified in this option, is used with the input Java class to generate the desired output.
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 class.
Indicates the target namespace for the WSDL file being generated. See Mapping between Java language, WSDL and XML for the algorithm used to obtain the default namespace.
Indicates the path and file name of the output WSDL file. If not specified, the default file, class.wsdl, is written into the current directory.
Specifies the mapping of a Java package to a namespace. If there is a package without a namespace, the Java2WSDL command generates a namespace name. This argument can be repeated to specify mappings for multiple packages.
Specifies the name to use for the portType element. If not specified, the class name is used.
Specifies the name of the service element.
Specifies the name of the service. If not specified, the service name is derived from the -location argument.
Specifies the WSDL style to use in the generated WSDL file. For more information about styles, see Mapping between Java language, WSDL and XML. This argument is used with the -use argument.
If RPC is specified with -use ENCODED, or omitting use, a style=rpc/use=encoded WSDL file is generated. If RPC is specified with -use LITERAL, a style=rpc/use=literal WSDL file is generated. If DOCUMENT is specified with -use LITERAL or omitting use, a style=document/use=literal WSDL file is generated. This setting applies to all SOAP bindings.
Generates SOAP bindings for either Hyper Text Transport Protocol (HTTP) (default) or Java Messaging Service (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 only be specified once.
Provides the location or Uniform Resource Locator (URL) of the service. Typically, this value is automatically supplied when the Web service is deployed. Use this argument to specify the location if you want to generate a WSDL file containing a location URL without deploying. A warning displays to remind you that the generated WSDL file should not be published if the final location is not yet been determined. The name after the last slash or 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.
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. For more information, see the Mapping between Java language, WSDL and XML.
Displays verbose messages.
Displays debug messages.
When specified, this option indicates two WSDL files should be generated; one for the interface and one for the implementation. The implementation file is named by this option and the interface WSDL is named by the output option. Typically, the -locationImport option is specified when -outputImpl is specified.
Typically, the Java2WSDL command produces a single WSDL file. If you use the -outputImpl <file> option, the Java2WSDL command produces two WSDL files: an interface WSDL file and an implementation WSDL file. The interface WSDL file includes everything except the <service> construct.
In the "split WSDL" mode, the implementation WSDL file must import the interface WSDL file. The -locationImport argument is used to set the <import location>=<location-uri>> in the implementation WSDL file. These settings enable the implementation WSDL file to import the interface WSDL file.
If locationImport is not specified in conjunction with outputImpl, an import location is not included in the implementation WSDL file.
Specifies a style representing Multipurpose Internet Mail Extensions (MIME) information. Valid arguments are:
Valid arguments are:
Sets the soapAction field according to deployment information.
Sets the soapAction field to "".
Sets the soapAction field to the operation name.
The Java2WSDL command searches inherited classes and interfaces when generating extended complexTypes. The search stops when a class or interface is found within a package that begins with java or javax. The -stopClasses argument can be used to define additional classes that cause the search to stop.
Specifies the target namespace for the implementation WSDL if -outputImpl specified.
Valid arguments are:
Methods with void returns are one-way. This is the default for JMS transport.
Methods with void returns are two-way. This the default for HTTP transport.
Specifies if the WSDL file should be generated according to wrapped rules. This is only valid if use is literal. The option defaults to true. This setting applies to all SOAP bindings.
Review the Javadoc for a complete list of API's. You can also review several articles about the development of Web services at Web services: Resources for learning.