Axis-wsdl2java Task
Create Java classes from local or remote WSDL.
Apache Ant
 
Description
Create Java classes from local or remote WSDL. Mappings from namespaces to packages can be provided as nested <mapping> elements.

Proxy settings are taken from the java runtime settings of http.ProxyHost, http.ProxyPort, etc. The Ant task <setProxy> can set these. As well as the nested mapping elements, this task uses the file NStoPkg.properties in the project base directory for namespace mapping

This task does no dependency checking; files are generated whether they need to be or not. The exception to this is the Impl class, which is not overwritten if it exists. This is a safety measure. However, all other classes are generated overwriting anything that exists.

The safe way to use this task is to have it generate the java source in a build directory, then have a <copy> task selectively copy the files you need into a safe location. Again, copying into the source tree is dangerous, but a separate build/src tree is safe. Then include this separate tree in the <javac> task's src attribute to include it in the build. Implement your own implementation classes of the server stub and the test cases using the generated templates. If you want to add methods to autogenerated data types, consider subclassing them, or write helper classes.

Tip: if you <get> the wsdl, and use the <filesmatch> condition to compare the fetched wsdl with a catched copy, you can make the target that calls the axis-wsd2ljava task conditional on the WSDL having changed. This stops spurious code regeneration and follow-on rebuilds across the java source tree.

 
Parameters
Attribute Description Type Requirement
all flag to generate code for all elements, even unreferenced ones default=false; boolean Optional
debug flag for debug output; default=false boolean
deployscope add scope to deploy.xml: "Application", "Request", "Session" optional; String
factory name of the Java2WSDLFactory class for extending WSDL generation functions String
failonnetworkerrors should the task fail the build if there is a network error? optional: defaults to false boolean
helpergen Turn on/off Helper class generation; default is false boolean
namespacemappingfile set the mapping file. This is a properties file of namespace=package order. Optional, default is to look for a file called NStoPkg.properties in the project directory. File
noimports only generate code for the immediate WSDL document, and not imports; default=false; boolean
nowrapped Set the noWrapped flag. boolean
output output directory for emitted files File
password set any password required for BASIC authenticated access to the WSDL; optional; only used if username is set String
printstacktraceonfailure should we print a stack trace on failure? Optional, default=true. boolean
protocolhandlerpkgs append any protocol handler pkgs specified with the task String
serverside emit server-side bindings for web service; default=false boolean
skeletondeploy deploy skeleton (true) or implementation (false) in deploy.wsdd. Default is false. Assumes server-side="true". boolean
testcase flag for automatic Junit testcase generation default is false boolean
timeout timeout in milliseconds for URL retrieval; default is 45 seconds. Set this to -1 to disable timeouts altogether: other negative values are not allowed) long
typemappingversion the default type mapping registry to use. Either 1.1 or 1.2. Default is 1.1 "1.1", "1.2"
url URL to fetch and generate WSDL for. Can be remote or a local file. String
username set any username required for BASIC authenticated access to the WSDL; optional. String
verbose flag for verbose output; default=false boolean
allowInvalidURL flag used to allow Stub generation even if WSDL endpoint URL is not a valid URL. It's the responsibility of the user to update the endpoint value before using generated classes; default=false boolean
implementationClassName Set the name of the implementation class. Especially useful when exporting an existing class as a web service using java2wsdl followed by wsdl2java. String
 
Parameters as nested elements
 
mapping (org.apache.axis.tools.ant.wsdl.NamespaceMapping)
add a mapping of namespaces to packages
 
mappingset (org.apache.axis.tools.ant.wsdl.MappingSet)
add a mapping of namespaces to packages
 
classpath (org.apache.tools.ant.types.Path)
set the classpath
 
nsexclude (org.apache.axis.wsdl.toJava.NamespaceSelector)
Adds an additional namespace to the list to be excluded from source code generation.
 
nsinclude (org.apache.axis.wsdl.toJava.NamespaceSelector)
Adds an additional namespace to the list to be included in source code generation.
 
property (org.apache.axis.wsdl.toJava.FactoryProperty)
Adds a property name/value pair for specialized JavaGeneratorFactories.

Copyright © 2000-2003, Apache Software Foundation