ANT WSDL2Java Task  Locate

Overview  Locate

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]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 NameTask Class
WSDL2Javacom.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>

Attributes of WSDL2Java ANT task  Locate

[Note]Note

All of these attributes are optional.

Attribute NameDescriptionCommand-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
forceOverwrites 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
generatedPortSpecifies the port to be generated.--port
generatedPortTypeSpecifies the QName of the port type to be generated.--port-type
generatedServiceSpecifies the QName of the service to be generated.--service
generateInterfacesIf set to true, structures are generated as interfaces.--generate-interfaces
generateJavaBeansIf set to true, JavaBeans are generated instead of structures.--generate-javabeans
interfacePackagePackage to be used for generated interfaces.--interface-package
mixedToDomMap XML Schema types with mixed content to org.w3c.dom.Element.--mixed-to-dom
outputDirectorySets the directory where the output files will be stored.-output-directory
outputLanguageSets the output language. The possibilities are: java, java-async, java-impl, java-async-server.-output-language
processingSets the name of the processing node(block) in the deployment descriptor.--processing
protocolChoose protocol type. Other protocols will be ignored. Supported protocol values are soap11 and soap12. Default protocol is soap11. --protocol
strictSchemaIf set to true, no beautification is performed and the generated classes strictly follow xml schema.--strict-schema
structurePackagePackage to be used for generated structures.--structure-package
unwrapIf 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
usernameSets username for HTTP-Basic authentication.--username user name
passwordSets password for HTTP-Basic authentication.--password password
targetJavaGenerated 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

wsdlFileSets 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. 
wsdlURLSets 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

Sub-elements of the WSDL2Java ANT Task  Locate

All sub-elements are optional.

<schema2java>   Locate

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 schema2javaDescription
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.

classFully qualified name of the Java class to which the schema type will be mapped
<schema2JavaException>  Locate

Equivalent of option --map-type-fault. Both attributes are mandatory.

Attribute of schema2JavaExceptionDescription

type

Name of XML Schema type in format {namespace}localPart

class

Desired name of Java class; must be a valid fully qualified name
<namespace2package>   Locate

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 namespace2packageDescription

namespace

Source XML schema namespace

package

Target Java package