Usage: java org.apache.axis.wsdl.WSDL2Java [options] WSDL-URI
Options:
-h, --help
print this message and exit
-v, --verbose
print informational messages
-n, --noImports
only generate code for the immediate WSDL document
-O, --timeout
<argument>
timeout in seconds (default is 45, specify -1 to disable)
-D, --Debug
print debug information
-W, --noWrapped
turn off support for "wrapped" document/literal
-s, --server-side
emit server-side bindings for web service
-S, --skeletonDeploy
<argument>
deploy skeleton (true) or implementation (false) in deploy.wsdd.
Default is false. Assumes --server-side.
-N, --NStoPkg
<argument>=<value>
mapping of namespace to package
-f, --fileNStoPkg
<argument>
file of NStoPkg mappings (default NStoPkg.properties)
-p, --package
<argument>
override all namespace to package mappings, use this package
name instead
-o, --output
<argument>
output directory for emitted files
-d, --deployScope
<argument>
add scope to deploy.xml: "Application", "Request", "Session"
-t, --testCase
emit junit testcase class for web service
-a, --all
generate code for all elements, even unreferenced ones
-T, --typeMappingVersion
indicate 1.1 or 1.2. The default is 1.1 (SOAP 1.1 JAX-RPC compliant.
1.2 indicates SOAP 1.1 encoded.)
-F, --factory
<argument>
name of a custom class that implements GeneratorFactory interface
(for extending Java generation functions)
-i, --nsInclude
<namespace>
namescape to specifically include in the generated code (defaults to
all namespaces unless specifically excluded with the -x option)
-x, --nsExclude
<namespace>
namespace to specifically exclude from the generated code (defaults to
none excluded until first namespace included with -i option)
-p, --property
<name>=<value>
name and value of a property for use by the custom GeneratorFactory
-H, --helperGen
emits separate Helper classes for meta data
-U, --user <argument>
username to access the WSDL-URI
-P, --password
<argument>
password to access the WSDL-URI
-c, --implementationClassName
<argument>
use this as the implementation class
-w, --wrapArrays
Prefer generating JavaBean classes like "ArrayOfString" for certain schema array patterns (default is to use String [])
<service name="AddressBook" provider="java:RPC">
<parameter name="className" value="samples.addr.AddressBookSOAPBindingSkeleton"/>
...
</service>
and for "false" it would look like:
<service name="AddressBook" provider="java:RPC">
<parameter name="className" value="samples.addr.AddressBookSOAPBindingImpl"/>
...
</service>
The default for this option is false. When you use this option, the --server-side option is assumed, so you don't have to explicitly specify --server-side as well.
--NStoPkg urn:AddressFetcher2=samples.addr(Note that if you use the short option tag, "-N", then there must not be a space between "-N" and the namespace.)
The entries in this file are of the same form as the arguments to the --NStoPkg command line option. For example, instead of providing the command line option as above, we could provide the same information in NStoPkg.properties:
urn\:AddressFetcher2=samples.addr(Note that the colon must be escaped in the properties file.)
If an entry for a given mapping exists both on the command line and in the properties file, the command line entry takes precedence.
A note about what it means to be referenced. We cannot simply
say: start with the services, generate all bindings referenced by
the service, generated all portTypes referenced by the referenced
bindings, etc. What if we're generating code from a WSDL file
that only contains portTypes, messages, and types? If WSDL2Java
used service as an anchor, and there's no service in the file, then
nothing will be generated. So the anchor is the lowest element
that exists in the WSDL file in the order:
For example, if a WSDL file only contained types, then all the listed types would be generated. But if a WSDL file contained types and a portType, then that portType will be generated and only those types that are referenced by that portType.
Note that the anchor is searched for in the WSDL file appearing on the command line, not in imported WSDL files. This allows one WSDL file to import constructs defined in another WSDL file without the nuisance of having all the imported WSDL file's constructs generated.
http://user:password@hostname:port/path/to/service?WSDL
Set the name of the implementation class.Especially useful when exporting an existing class as a web service using java2wsdl followed by wsdl2java. If you are using the skeleton deploy option you must make sure, after generation, that your implementation class implements the port type name interface generated by wsdl2java. You should also make sure that all your exported methods throws java.lang.RemoteException.
When processing a schema like this:
<element name="array"> <complexType> <sequence> <element name="item" type="xs:string"/> </sequence> </complexType> </element>The default behavior (as of Axis 1.2 final) is to map this XML construct to a Java String array (String[]). If you would rather a specific JavaBean class (i.e. ArrayOfString) be generated for these types of schemas, you may specify the -w or --wrapArrays option.
Here is the help message generated from the current tool:
Java2WSDL emitter
Usage: java org.apache.axis.wsdl.Java2WSDL [options] class-of-portType
Options:
-h, --help
print this message and exit
-I, --input
-h , --help
Prints the help message.
-I, --input <WSDL file>
Optional parameter that indicates the name of the input wsdl file. The
output wsdl file will contain everything from the input wsdl file plus
the new constructs. If a new construct is already present in the input
wsdl file, it is not added. This option is useful for constructing a
wsdl file with multiple ports, bindings, or portTypes.
-o, --output <WSDL file>
Indicates the name of the output WSDL file. If not specified, a
suitable default WSDL file is written into the current directory.
-l, --location <location>
Indicates the url of the location of the service. The name after
the last slash or backslash is the name of the service port (unless
overridden by the -s option). The service port address location
attribute is assigned the specified value.
-P, --portTypeName <name>
Indicates the name to use use for the portType element. If not
specified, the class-of-portType name is used.
-b, --bindingName <name>
Indicates the name to use use for the binding element. If not
specified, the value of the --servicePortName + "SoapBinding" is used.
-S, --serviceElementName <name>
Indicates the name of the service element. If not specified, the
service element is the <portTypeName>Service.
-s, --servicePortName <name>
Indicates the name of the service port. If not specified, the
service port name is derived from the --location value.
-n, --namespace <target namespace>
Indicates the name of the target namespace of the WSDL.
-p, --PkgToNS <package> <namespace>
Indicates the mapping of a package to a namespace. If a package
is encountered that does not have a namespace, the Java2WSDL emitter
will generate a suitable namespace name. This option may be
specified multiple times.
-m, --methods <arguments>
If this option is specified, only the indicated methods in your
interface class will be exported into the WSDL file. The methods
list must be comma separated. If not specified, all methods
declared in the interface class will be exported into the WSDL file.
-a, --all
If this option is specified, the Java2WSDL parser will look into
extended classes to determine the list of methods to export into the
WSDL file.
-w, --outputWSDLMode <mode>
Indicates the kind of WSDL to generate. Accepted values are:
-N, --namespaceImpl <namespace>
Namespace of the implementation WSDL.
-O, --outputImpl <WSDL file>
Use this option to indicate the name of the output implementation WSDL
file. If specified, Java2WSDL will produce interface and
implementation WSDL files. If this option is used, the -w option
is ignored.
-i, --implClass <impl-class>
Sometimes extra information is available in the implementation class
file. Use this option to specify the implementation class.
-x, --exclude <list>
List of methods to not exclude from the wsdl file.
-c, --stopClasses <list>
List of classes which stop the Java2WSDL inheritance search.
-T, --typeMappingVersion <version>
Choose the default type mapping registry to use. Either 1.1 or 1.2.
-A, --soapAction <argument>
The value of the operations soapAction field. Values are DEFAULT,
OPERATION or NONE. OPERATION forces soapAction to the name of the
operation. DEFAULT causes the soapAction to be set according to the
operation's meta data (usually ""). NONE forces the soapAction to "".
The default is DEFAULT.
-y, --style <argument>
The style of the WSDL document: RPC, DOCUMENT or WRAPPED. The default
is RPC. If RPC is specified, an rpc wsdl is generated. If DOCUMENT is
specified, a document wsdl is generated. If WRAPPED is specified, a
document/literal wsdl is generated using the wrapped approach. Wrapped
style forces the use attribute to be literal.
-u, --use <argument>
The use of the WSDL document: LITERAL or ENCODED. If LITERAL is
specified, the XML Schema defines the representation of the XML for the
request. If ENCODED is specified, SOAP encoding is specified in the
generated WSDL.
-e, --extraClasses <argument>
Specify a space or comma seperated list of class names which should be
included in the types section of the WSDL document. This is
useful in the case where your service interface references a base class
and you would like your WSDL to contain XML Schema type defintions for
these other classes. The -extraClasses option can be specified
duplicate times. Each specification results in the additional classes
being added to the list.
-C, --importSchema
A file or URL to an XML Schema that should be physically imported into the generated WSDL
-X, --classpath
Additional classpath elements
<parameter name="name"
value="value"/>
, and common ones include:Java RPC Provider (provider="java:RPC") by default all public
methods specified by the class in the className option, including any
inherited methods are available as web services.
For more details regarding the Java Provider please see WHERE???.
Java MsgProvder (provider="java:MSG")
In order to further restrict the above methods, the allowedMethods option may be used to specify in a space delimited list the names of only those methods which are allowed as web services. It is also possible to specify for this option the value "*" which is functionally equivalent to not specify the option at all. Also, it is worth mentioning that the operation element is used to further define the methods being offered, but it does not affect which methods are made available.
Note, while this is true for Axis supplied providers, it is implementation dependent on each individual provider. Please review your providers documentation on how or if it supports this option.
Note, Exposing any web service has security implications.
As a best practices guide it is highly recommend when offering
a web service in un secure environment to restrict allowed methods to
only those required for the service being offered. And, for those that
are made available, to fully understand their function and how
they may access and expose your systems's resources.
If you wish to define handlers which should be invoked either before or after the service's provider, you may do so with the <requestFlow> and the <responseFlow> subelements. Either of those elements may be specified inside the <service> element, and their semantics are identical to the <chain> element described below - in other words, they may contain <handler> and <chain> elements which will be invoked in the order they are specified.
To control the roles that should be recognized by your service Handlers, you can specify any number of <role> elements inside the service declaration.
Example:<service name="test"> <parameter name="className" value="test.Implementation"/> <parameter name="allowedMethods" value="*"/> <namespace>http://testservice/</namespace> <role>http://testservice/MyRole</role> <requestFlow> <!-- Run these before processing the request --> <handler type="java:MyHandlerClass"/>\ <handler type="somethingIDefinedPreviously"/> </requestFlow> </service>Metadata may be specified about particular operations in your service by using the <operation> tag inside a service. This enables you to map the java parameter names of a method to particular XML names, to specify the parameter modes for your parameters, and to map particular XML names to particular operations.
<chain name="myChain">or may refer to previously defined <handlers>, with the "type" of the handler referring to the name of the other handler definition:
<handler type="java:org.apache.axis.handlers.LogHandler"/>
</chain>
<handler name="logger" type="java:org.apache.axis.handlers.LogHandler"/>
<chain name="myChain"/>
<handler type="logger"/>
</chain>
<transport name="http">
<parameter name="useDefaultQueryStrings" value="false" />
<parameter name="qs.name" value="class.name" />
</transport>
class.name
. The name
attribute
of the <parameter> element must start with the string "qs." to
indicate that this <parameter> element defines a query string
handler. The value
attribute must point to the name of a class
implementing the org.apache.axis.transport.http.QSHandler
interface.
By default, Axis provides for three Axis servlet query string handlers (?list,
?method, and ?wsdl). See the Axis server configuration file
for their definitions. If the user wishes not to use these default query string
handlers (as in the example), a <parameter> element with a name
attribute equal to "useDefaultQueryStrings" should have its value
attribute set to false
. By default it is set to true
and the element is not necessary if the user wishes to have this default behavior.
<operation name="echoString" >
<documentation>This operation echoes a string</documentation>
<parameter name="param">
<documentation>a string</documentation>
</parameter>
</operation>
In the server-config file, there is a global configuration section, which supports parameter name/value pairs as nested elements. Here are the options that we currently document, though there may be more (consult the source, as usual).
<globalConfiguration> <parameter name="adminPassword" value="admin"/> <parameter name="axis.servicesPath" value="/services/"/> <parameter name="attachments.Directory" value="c:\temp\attachments"/> <parameter name="sendMultiRefs" value="true"/> <parameter name="sendXsiTypes" value="true"/> <parameter name="attachments.implementation" value="org.apache.axis.attachments.AttachmentsImpl"/> <parameter name="sendXMLDeclaration" value="true"/> <parameter name="enable2DArrayEncoding" value="true"/> <parameter name="dotNetSoapEncFix" value="false"/> </globalConfiguration>
adminPassword | Adminstrator password, as used by AdminService. |
attachments.Directory | The directory where attachments end up. This should be in the syntax appropriate for the target platform. |
attachments.implementation | Name of class that implements attachments support. Default is org.apache.axis.attachments.AttachmentsImpl |
axis.enableListQuery | Flag to enable the "list the WSDD" feature. Set to false by default, because listing the current system config can expose information (such as the adminservice password) that one does not want widely avaialable. |
axis.disableServiceList | Flag to disable the list of services feature. Set to false by default, which enables the list of services by the AxisServlet when a GET request is performed on the servlet root. |
axis.servicesPath | Path to the Axis servlet. This should be the same as the services servlet-mapping defined in web.xml. Used for displaying the list of services. Default is "/services/". |
axis.Compiler | Compiler adapter classname for JWS compilation. Default is org.apache.axis.components.compiler.Javac; change this to org.apache.axis.components.compiler.Jikes to invoke jikes instead. |
axis.development.system | Flag to switch the system from production (false) to development (true). A development system gives out stack traces and other information that production boxes should not. |
axis.xmlEncoding | Encoding used for XML messages -either UTF-8 (default) or UTF-16 |
axis.engineConfigClass | Name of a class that provides Axis configuration. Implement a new class implementing EngineConfiguration and name it here to use alternate configuration mechanisms. |
axis.jws.servletClassDir | Path to where compiled JWS pages are placed. |
axis.sendMinimizedElements | Flag to turn on support for a when .NET1.0 can't correctly handle some bits of XML that it should. The flag defaults to true; if some .NET clients are failing to handle a Web Service returning an empty array inside another object, set this flag to false. |
enable2DArrayEncoding | Set this to "true" to turn 2D array encoding on; this encoding is incompatible with .NET 1.0: default="false". |
sendMultiRefs | true/false flag to control whether multirefs are sent or not. |
sendXMLDeclaration | true/false flag to control whether the <?xml?> declaration is sent in messages |
sendXsiTypes | true/false flag to enable/disable sending the type of every value sent over the wire. Defaults to true. |
SingleSOAPVersion | When set to either "1.1" or "1.2", this configures the engine to only accept the specified SOAP version. Attempts to connect to the engine using another version will result in a fault. |
use-servlet-security | Set this flag to hand authentication off to the servlet container. |
dotNetSoapEncFix | Set this flag to true to turn on a preference for the XML Schema (xsd) types in the
Axis engine. This improved interop with .NET. In particular, .NET seems to have problems
accepting SOAP encoded types (soapenc) in arrays. Due to bugs in the Axis 1.1 type mapping
system, Axis generally perferred the schema types. Axis 1.2 now correctly uses the SOAP
encoded types when it is using SOAP encoding for a service. See JAX-RPC 1.1, section 4.2.1.
Note: You can also set this flag by setting the static property on the TypeMappingImpl class:
TypeMappingImpl.dotnet_soapenc_bugfix = true; |
Here is a service element with examples of the current set of options you can set. More may exists (consult the source, as usual).
<service name="MyServiceName" provider="java:RPC" style="rpc|document|wrapped" use="encoded|literal" streaming="off|on" attachment="MIME|DIME|NONE"> <parameter name="className" value="org.apache.mystuff.MyService"/> <parameter name="allowedMethods" value="method1 method2 method3"/> <parameter name="wsdlTargetNamespace" value="http://mystuff.apache.org/MyService"/> <parameter name="wsdlServiceElement" value="MyService"/> <parameter name="wsdlServicePort" value="MyServicePort"/> <parameter name="wsdlPortType" value="MyPort"/> <parameter name="wsdlSoapActionMode" value="NONE|DEFAULT|OPERATION"/> <parameter name="SingleSOAPVersion" value="1.1|1.2/> <documentation>Service level info</documentation> <endpointURL>http://example.com:5050/my/custom/url/to/service</endpointURL> <wsdlFile>/path/to/wsdl/file</wsdlFile> <namespace>http://my.namespace.com/myservice</namespace> <handlerInfoChain>handlerChainName</handlerInfoChain> <operation ... /> <typeMapping ... /> <beanMapping ... /> </service>
The path to a WSDL File; can be an absolute path or a resource that axis.jar can load. Useful to export your custom WSDL file. When specify a path to a resource, place a forward slash to start at the beginning of the classpath (e.g "/org/someone/res/mywsdl.wsdl"). How does Axis know whether to return a file or resource? It looks for a file first, if that is missing a resource is returned.
Documentation text that will get inserted in to the document element of the WSDL for the service
Specify the endpoint URL of the service, which will override the transport level URL created by the Axis servlet. This is usefull if you have a proxy handling requests and you need the endpoint URL to reflect a different hostname than the one Axis is executing on.
Specify the default namespace for the service.
Specify the JAX RPC handler chain for this service.
In addition, as described above, the <requestFlow> and/or <responseFlow> elements are also allowed in the service element.
className | The fully qualified name of the implemenation class of the service. |
allowedMethods | A space or comma seperated list of method names, or "*" for all methods in the service class. If this parameter isn't specified, all methods ("*") is the default. |
wsdlPortType | The name of the portType element in the generated WSDL for the service. |
wsdlServiceElement | The name of the Service element in the generated WSDL for the service. |
wsdlServicePort | The name of the port in the generated WSDL for the service. |
wsdlTargetNamespace | The target namespace in the generated WSDL for the service. |
wsdlInputSchema | A comma separated list of of input Schema for the generated WSDL for the service. |
wsdlSoapActionMode | Values are DEFAULT, OPERATION or NONE. OPERATION forces soapAction to the name of the operation. DEFAULT causes the soapAction to be set according to the operations meta data, specifically the soapAction attribute of the operation in the deployment information. NONE forces the soapAction to "". The default is DEFAULT. |
SingleSOAPVersion | When set to either "1.1" or "1.2", this configures a service to only accept the specified SOAP version. Attempts to connect to the service using another version will result in a fault. |
Here is an <operation> element with examples of the current set of options you can set. More may exists (consult the source, as usual).
<operation name="GetQuote" qname="operNS:GetQuote" returnQName="GetQuoteResult" returnType="xsd:float" soapAction="" returnHeader="true|false"> <documentation>Operation level documentation here</documentation> <parameter name="ticker" type="tns:string"/> <fault name="InvalidTickerFaultMessage" qname="tickerSymbol" class="test.wsdl.faults.InvalidTickerFaultMessage" type="xsd:string"/>
</operation>
The example above omits the XML Namespace declarations (xmlns:foo="http://my.namespace/") that could appear in each of the elements for the namespaces used.
Defines a parameter for the operation. Valid attributes are:
name | The name of the parameter. |
qname | The QName of the parameter, used in preference to name. |
mode | The mode of the parameter. One of "in", "out" or "inout". |
inHeader | If "true", this parameter is an input header. |
outHeader | If "true", this parameter is an output header. |
type | The QName of the type of the parameter. |
NOTE: A <documentation> element may appear as a child of parameter.
name | The name of the fault. |
qname | The QName of the fault. |
class | The Java class that represents this fault. |
type | The QName of the type that represents the data for this fault. |
Log4J can be configured using the file log4j.properties in the classpath; later versions also support an XML configuration. Axis includes a preconfigured log4j.properties file in axis.jar. While this is adequate for basic use, any complex project will want to modify their own version of the file. Here is what to do
org.apache.axis.TIME | A log that records the time to execute incoming messages, splitting up into preamble, invoke, post and send times. These are only logged at debug level. |
org.apache.axis.EXCEPTIONS | Exceptions that are sent back over the wire. AxisFaults, which are normally created in 'healthy' operation, are logged at debug level. Other Exceptions are logged at the Info level, as they are more indicative of server side trouble. |
org.apache.axis.enterprise | ''Enterprise'' level stuff, which generally means stuff that an enterprise product might want to track, but in a simple environment (like the Axis build) would be nothing more than a nuisance. |
% java org.apache.axis.client.AdminClient -llocal:// list