The WSDL2Java ANT Task is for launching the WSDL2Java command-line tool in Apache ANT. WSDL2Java translates a WSDL definition of a Web service's interface into a Java class. The translation process is highly customizable via both input parameters and the possibility to write custom WSDL2Java plug-ins. More detailed information is given in WSDL2Java.
![]() | Note |
|---|---|
Examples You can find usage examples of ANT tasks in WASP_HOME/src/example/tools/ant and in the build.xml files in Demos. See also Example 213. | |
| Task Name | Task Class |
|---|---|
| WSDL2Java | com.idoox.wasp.tools.ant.WSDL2JavaTask |
Example 213. WSDL2Java ANT Task
<project basedir="." default="main" name="test">
<taskdef classname="com.idoox.wasp.tools.ant.WSDL2JavaTask"
name="WSDL2Java"/>
<target name="main">
<WSDL2Java generatedPort="PingPort"
generatedPortType="pingns:PingInterface"
generatedService="PingService" interfacePackage="test.interface"
outputDirectory="../test_output" outputLanguage="java"
structurePackage="test.structure" wsdlFile="ping.wsdl"/>
</target>
</project>
![]() | Note |
|---|---|
All of these attributes are optional. | |
| Attribute Name | Description | Command-line Option |
|---|---|---|
| deploymentDescriptor | Specifies the filename of the deployment descriptor to be used. When you specify it, you must also set the processing attribute. | --deployment-descriptor |
| force | Overwrites existing file, when a file with same path as the file being generated exists already. This prevents File already exists-type errors. (=true/false) | --force |
| generatedPort | Specifies the port to be generated. | --port |
| generatedPortType | Specifies the QName of the port type to be generated. | --port-type |
| generatedService | Specifies the QName of the service to be generated. | --service |
| generateInterfaces | If set to true, structures are generated as interfaces. | --generate-interfaces |
| generateJavaBeans | If set to true, JavaBeans are generated instead of structures. | --generate-javabeans |
| interfacePackage | Package to be used for generated interfaces. | --interface-package |
| mixedToDom | Map XML Schema types with mixed content to org.w3c.dom.Element. | --mixed-to-dom |
| outputDirectory | Sets the directory where the output files will be stored. | -output-directory |
| outputLanguage | Sets the output language. The possibilities are: java, java-async, java-impl, java-async-server. | -output-language |
| processing | Sets the name of the processing node(block) in the deployment descriptor. | --processing |
| protocol | Choose protocol type. Other protocols will be ignored. Supported protocol values are soap11 and soap12. Default protocol is soap11. | --protocol |
| strictSchema | If set to true, no beautification is performed and the generated classes strictly follow xml schema. | --strict-schema |
| structurePackage | Package to be used for generated structures. | --structure-package |
| unwrap | If false, the WSDL2Java ANT task does not unwrap wrapping elements in wrapped document/literal binding. Default value is true. (Please see Document/Literal Wrapped for more information about binding, and the Example of the --unwrap Option. | --unwrap |
| useMtom | Sets mode for base64Binary schema types. The possibilities are: never, auto and always. The default is auto. | --use-mtom |
| username | Sets username for HTTP-Basic authentication. | --username user name |
| password | Sets password for HTTP-Basic authentication. | --password password |
| targetJava | Generated sources will compile with this version of Java. | --target-java |
verbose | Additional information during processing will be printed to stderr. Value is a level from 0-10. Default=0 | --verbose |
| wsdlFile | Sets the WSDL file to be used for output generation. It must be the name of a file. Either the wsdlFile or the wsdlURL attribute must be present. | |
| wsdlURL | Sets the URL of the WSDL file to be used for output generation. It must be a valid URL, such as http://mycomputer/wasp/HelloService/. Either the wsdlFile or wsdlURL attribute must be present. | --url |
All sub-elements are optional.
Specifies the type mapping from a schema type named in the format {ns}local to a Java class. Equivalent to the --map-type {ns}local javaName command-line parameter.
| Attribute of schema2java | Description |
|---|---|
| type | Name of the schema type in the format {ns}local, where ns is the namespace and local is the name of the schema type from that namespace. |
| class | Fully qualified name of the Java class to which the schema type will be mapped |
Equivalent of option --map-type-fault. Both attributes are mandatory.
| Attribute of schema2JavaException | Description |
|---|---|
type | Name of XML Schema type in format {namespace}localPart |
class | Desired name of Java class; must be a valid fully qualified name |
Specifies mapping from schema namespace to Java package. Equivalent to the --map-ns namespace=package command-line parameter.
Example:
<Namespace2Package namespace="http://tempuri.org" package="org.tempuri" />
| Attribute of namespace2package | Description |
|---|---|
namespace | Source XML schema namespace |
package | Target Java package |