WebServices - Axis

Axis-wsdl2java Task

Create Java classes from local or remote WSDL.


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.


Attribute Description Type
all flag to generate code for all elements, even unreferenced ones default=false; boolean
debug flag for debug output; default=false boolean
deployscope add scope to deploy.xml: "Application", "Request", "Session" optional; java.lang.String
factory name of the Java2WSDLFactory class for extending WSDL generation functions java.lang.String
helpergen Turn on/off Helper class generation; default is false boolean
namespacemappingfile set the mapping file. This is a properties file of package=namespace order. Optional, default is to look for a file called NStoPkg.properties in the project directory. java.io.File
noimports only generate code for the immediate WSDL document, and not imports; default=false; boolean
output output directory for emitted files java.io.File
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 org.apache.axis.tools.ant.wsdl.TypeMappingVersionEnum
url URL to fetch and generate WSDL for. Can be remote or a local file. java.lang.String
verbose flag for verbose output; default=false boolean

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