The Java2WSDL script
The Java2WSDL command tool 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.
The WSDL file generated by the Java2WSDL command can contain unexpected elements. Review Mapping between Java, WSDL and XML and the JAX-RPC specification available through Web services: Resources for learning, for more information on the transformations performed. You can create WSDL files that cannot be compiled when regenerated into Java code using the WSDL2Java command because the JAX-RPC mapping from Java to WSDL is not reversible back to the original Java code. Inspect and modify the WSDL file if you encounter this problem.
Product
This script is available in WAS and WAS Network Deployment.
Authority
To run this script, your user profile must have *RX authority.
Syntax
The syntax of the script is:
Java2WSDL class [argument...]Parameters
The parameters of the script are:
class
This is a required parameter. The value class 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
Optional. The value name specifies the name to use for the binding element. If not specified, the binding name is the portTypeName.-help
Displays the help message.-helpX
Displays the help message for extended options.-debug
Displays debug messages.-outputImpl
Optional. The value impl-wsdl specifies if you want an interface and implementation WSDL file emitted.-locationImport
Optional. The value location-uri specifies the location of the interface WSDL file if you use the -outputImpl argument specified.-MIMEStyle
Optional. The value style specifies a style representing Multipurpose Internet Mail Extensions (MIME) information. Valid values are Axis and WSDL11. The default value is WSDL11.-soapAction
Optional. Valid arguments are:
- DEFAULT
Sets the soapAction field according to deployment information.- NONE
Sets the soapAction field to "".- OPERATION
Sets the soapAction field to the operation name.
-stopClasses
Optional. 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 value parent specifies an additional class that cause the search to stop. To specify multiple classes, separate them with commas:-stopClasses class1,class2-namespaceImpl
Optional. The value namespace specifies the target namespace for the implementation WSDL if -outputImpl specified.-voidReturn
Valid arguments are:
- ONEWAY
Methods with void returns are one-way. This is the default for JMS transport.- TWOWAY
Methods with void returns are two-way. This the default for HTTP transport.
-wrapped
Optional. The value boolean specifies if the WSDL file should be generated according to wrapped rules. This is only valid if the value of the -use parameter is LITERAL. The option defaults to true.-extraClasses
Optional. The value classes specifies other classes that should be represented in the WSDL file.-input
Optional. The value 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
Optional. 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. The value impl-class specifies an alternative class from which to obtain method parameter names. The specified class does not need to implement the class if the class is an interface, but it must implement the same methods as class.-location
Optional. The value location specifies 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
Optional. The value targetNamespace specifies 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
Optional. The value wsdl-uri specifies 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
Optional. If you specify this parameter, the script maps the package specified by package to the namespace specified by namespace. If there is a package without a namespace, the Java2WSDL command generates a namespace name. Specify this parameter once for each mapping.-portTypeName
Optional. The value name specifies the name to use for the portType element. If not specified, the class name is used.-serviceElementName
Optional. The value name specifies the name of the service element.-servicePortName
Optional. The value name specifies the name of the service. If not specified, the service name is derived from the -location parameter.-style
Optional. The value style specifies the WSDL style to use in the generated WSDL file. Valid values are RPC and DOCUMENT. This parameter is used with the -use parameter.
- 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.
For more information about styles, see Mapping between Java, WSDL and XML.
-transport
Optional. The value transport_type specifies the type of tranpsort for which the script generates Simple Object Access Protocol (SOAP) bindings. Valid values are http and jms. The default value is http. If you specify jms, the characters "jms" are appended to the WSDL file name to prevent overwriting an existing WSDL file for another transport. You can specify the transport option only once.-use
Optional. The value use specifies the use that is generated into the WSDL file. Valid values are LITERAL and ENCODED. This parameter is used with the -style parameter.For more information, see Mapping between Java, WSDL and XML.
-verbose
Displays verbose messages.