The Java2WSDL command maps a Java class to a 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 isJava2WSDL [argument...] class
The following command-line arguments are supported:
Represents the fully qualified name of one of the following Java classes:
- Stateless session EJB remote interface that extends the javax.ejb.EJBObject class
- Service Endpoint Interface that extends the java.rmi.Remote class
- Java bean
The Java2WSDL command locates the class in CLASSPATH.
- -bindingName name
Name to use for the binding element. If not specified, the binding name is the portTypeName.
Displays the help message.
Displays the help message for extended options.
Displays debug messages.
- -outputImpl impl-wsdl
Specifies if you want an interface and implementation WSDL file emitted.
- -locationImport location-uri
Specifies the location of the interface WSDL file if you use the -outputImpl argument specified.
Specifies a style representing Multipurpose Internet Mail Extensions (MIME) information. Valid arguments are...
- WSDL11 (default)
Valid arguments are...
Sets the soapAction field according to deployment information.
Sets the soapAction field to "".
Sets the soapAction field to the operation name.
- -stopClasses parent [, parent]
If the -all argument is specified, the Java2WSDL command searches inherited classes and interfaces to construct the list of methods for WSDL file operations. 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.
- -namespaceImpl namespace
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.
- -wrapped boolean
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.
- -extraClasses classes
Specifies other classes that should be represented in the WSDL file.
- -input wsdl-uri
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.
- -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 class.
- -location location
Provides the location or Uniform Resource Locator (URL) of the service. Typically, this value fills automatically when the Web service deploys. 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.
- -namespace targetNamespace
Indicates the target namespace for the WSDL file being generated. See Mapping between Java, WSDL and XML for the algorithm used to obtain the default namespace.
- -output wsdl-uri
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.
- -PkgtoNS package namespace
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.
- -portTypeName name
Name to use for the portType element. If not specified, the class name is used.
- -serviceElementName name
Name of the service element.
- -servicePortName name
Name of the service. If not specified, the service name is derived from the -location argument.
- -style RPC | DOCUMENT
Specifies the WSDL style to use in the generated WSDL file. For more information about styles, see Mapping between Java, 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.
- -transport http | jms
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.
- -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. For more information, see Mapping between Java language, WSDL and XML.
Displays verbose messages.
See AlsoMapping between Java language, WSDL and XML