2 Ant Task Reference
WebLogic web services includes a variety of Ant tasks that you can use to centralize many of the configuration and administrative tasks into a single Ant build script.
This chapter includes the following sections:
- Overview of WebLogic Web Services Ant Tasks
Ant is a Java-based build tool, similar to themakecommand but much more powerful. Ant uses XML-based configuration files (calledbuild.xmlby default) to execute tasks written in Java. - clientgen
TheclientgenAnt task generates, from an existing WSDL file, the client component files that client applications use to invoke both WebLogic and non-WebLogic web services. - wsdlc
ThewsdlcAnt task generates, from an existing WSDL file, a set of artifacts that together provide a partial Java implementation of the web service described by the WSDL file. By specifying thetypeattribute, you can generate a partial implementation based on JAX-WS. - wsdlget
ThewsdlgetAnt task downloads to the local directory a WSDL and its imported XML resources.
Overview of WebLogic Web Services Ant Tasks
make command but much more powerful. Ant uses XML-based configuration files (called build.xml by default) to execute tasks written in Java. Oracle provides a number of Ant tasks that help you generate important web service-related artifacts.
The Apache Web site provides other useful Ant tasks for packaging EAR, WAR, and EJB JAR files. See the Apache Ant Manual at http://jakarta.apache.org/ant/manual/.
Note:
The Apache Jakarta Web site publishes online documentation for only the most current version of Ant, which might be different from the version of Ant that is bundled with WebLogic Server. To determine the version of Ant that is bundled with WebLogic Server, run the following command after setting your WebLogic environment:
prompt> ant -version
To view the documentation for a specific version of Ant, download the Ant zip file from http://archive.apache.org/dist/ant/binaries/ and extract the documentation.
The following table provides an overview of the web service Ant tasks provided by Oracle.
Table 2-1 WebLogic Web Service Ant Tasks
| Ant Task | Description |
|---|---|
|
Generates the |
|
|
Generates a partial web service implementation based on a WSDL file. |
|
|
Downloads to the local directory a WSDL and its imported XML targets, such as XSD and WSDL files. |
For detailed information about how to integrate and use these Ant tasks in your development environment to program a web service and a client application that invokes the web service, see:
-
Using Oracle WebLogic Server Ant Tasks in Understanding WebLogic Web Services for Oracle WebLogic Server
Parent topic: Ant Task Reference
clientgen
The clientgen Ant task generates, from an existing WSDL file, the client component files that client applications use to invoke both WebLogic and non-WebLogic web services.
The generated artifacts for JAX-WS web services include:
-
The Java class for the
Serviceinterface implementation for the particular web service you want to invoke. -
JAXB data binding artifacts.
-
The Java class for any user-defined XML Schema data types included in the WSDL file.
Two types of client applications use the generated artifacts of clientgen to invoke web services:
-
Standalone Jakarta clients that do not use the Jakarta Platform, Enterprise Edition client container.
-
Jakarta EE clients, such as EJBs, JSPs, and web services, that use the Jakarta EE client container.
If you are generating client artifacts for a JAX-WS web service, you can set the type attribute to JAXWS. For example: type="JAXWS".
You typically use the destDir attribute of clientgen to specify the directory into which all the artifacts should be generated, and then compile the generate Java files yourself using the javac Ant task. However, clientgen also provides a destFile attribute if you want the Ant task to compile the Java files for you and package them, along with the other generated artifacts, into the specified JAR file. You must specify one of either destFile or destDir, although you cannot specify both.
The following sections provide more information about the clientgen Ant task:
Parent topic: Ant Task Reference
Taskdef Classname
The following shows the task definition for the clientgen classname which must appear in your Ant build file.
<taskdef name="clientgen"
classname="weblogic.wsee.tools.anttasks.ClientGenTask" />
Parent topic: clientgen
Child Elements
The following sections describe the WebLogic-specific child elements for the clientgen Ant task.
Parent topic: clientgen
binding
Use the <binding> child element to specify JAX-WS.
For JAX-WS, one or more customization files that specify one or more of the following:
-
JAX-WS and JAXB custom binding declarations. See Customizing XML Schema-to-Java Mapping Using Binding Declarations in Developing JAX-WS Web Services for Oracle WebLogic Server.
-
SOAP handler files. See Creating and Using SOAP Message Handlers in Developing JAX-WS Web Services for Oracle WebLogic Server.
You use the <binding> element the same way as the standard Ant FileSet data type, using the same attributes. For example, the following <binding> element specifies the JAX-WS custom binding declarations defined in the file jaxws-binding.xml:
<binding file="./jaxws-binding.xml"/>
The following example specifies the JAX-WS customization files that are located in the ${basedir} directory:
<binding dir="${basedir}"/>For information about the full set of attributes you can specify using the FileSet data type, obtain the documentation for the version of Ant you are using at http://ant.apache.org/index.html and navigate to the description of the FileSet type.
Parent topic: Child Elements
jmstransportclient
Note:
The <jmstransportclient> child element applies to JAX-WS only.
The <jmstransportclient> element enables and configures SOAP over JMS transport.
Optionally, you can configure the destination name, destination type, delivery mode, request and response queues, and other JMS transport properties, using the <jmstransportclient> element. For a complete list of JMS transport properties supported, see Configuring JMS Transport Properties in Developing JAX-WS Web Services for Oracle WebLogic Server.
The following example shows how to enable and configure JMS transport when generating the web service client using clientgen.
<target name="clientgen">
<clientgen
wsdl="./WarehouseService.wsdl"
destDir="clientclasses"
packageName="client.warehouse"
type="JAXWS">
<jmstransportclient
targetService="JWSCEndpointService"
destinationName="com.oracle.webservices.jms.SoapJmsRequestQueue"
jndiInitialContextFactory="weblogic.jndi.WLInitialContextFactory"
jndiConnectionFactoryName="weblogic.jms.ConnectionFactory"
jndiURL="t3://localhost:7001"
deliveryMode="NON_PERSISTENT"
timeToLive="60000"
priority="1"
messageType="TEXT"
replyToName="com.oracle.webservices.jms.SoapJmsResponseQueue"
/>
</clientgen>
Parent topic: Child Elements
xmlcatalog
Note:
The <xmlcatalog> child element applies to JAX-WS only.
The <xmlcatalog> child element specifies the ID of an embedded XML catalog. The following shows the element syntax:
<xmlcatalog refid="id"/>
The ID referenced by <xmlcatalog> must match the ID of an embedded XML catalog. You embed an XML catalog in the build.xml file using the following syntax:
<xmlcatalog id="id">
<entity publicid="public_id" location="uri"/>
</xmlcatalog>
In the above syntax, public_id specifies the public identifier of the original XML resource (WSDL or XSD) and uri specifies the replacement XML resource.
The following example shows how to embed an XML catalog and reference it using clientgen. Relevant code lines are shown in bold.
<target name="clientgen">
<clientgen
type="JAXWS"
wsdl="${wsdl}"
destDir="${clientclasses.dir}"
packageName="xmlcatalog.jaxws.clientgen.client"
catalog="wsdlcatalog.xml">
<xmlcatalog refid="wsimportcatalog"/>
</clientgen>
</target>
<xmlcatalog id="wsimportcatalog">
<entity publicid="http://helloservice.org/types/HelloTypes.xsd"
location="${basedir}/HelloTypes.xsd"/>
</xmlcatalog>
See Using XML Catalogs in Developing JAX-WS Web Services for Oracle WebLogic Server.
Parent topic: Child Elements
Attributes
The following table describe the WebLogic-specific attributes of the clientgen Ant task for JAX-WS web services.
Table 2-2 WebLogic-specific Attributes of the clientgen Ant Task
| Attribute | Description | Data Type | Required? |
|---|---|---|---|
|
|
Specifies an external XML catalog file. See Using XML Catalogs in Developing JAX-WS Web Services for Oracle WebLogic Server. |
String |
No |
|
|
Controls whether the WSDL should be copied in the destination directory defined by |
Boolean |
No |
|
|
Directory into which the You can set this attribute to any directory you want. However, if you are generating the client component files to invoke a web service from an EJB, JSP, or other web service, you typically set this attribute to the directory of the Java EE component which holds shared classes, such as |
String |
You must specify either the |
|
|
Name of a JAR file or exploded directory into which the To create or update a JAR file, use a If you specify a JAR file or directory that does not exist, the |
String |
You must specify either the |
|
|
Specifies whether the Valid values for this attribute are |
Boolean |
No |
|
|
Specifies whether the |
Boolean |
No |
|
|
Package name into which the generated client interfaces and stub files are packaged. If you do not specify this attribute, the If you do specify this attribute, Oracle recommends you use all lower-case letters for the package name. |
String |
No |
|
|
Specifies the type of web service for which you are generating client artifacts. Valid values is |
String |
No |
|
|
Full path name or URL of the WSDL that describes a web service (either WebLogic or non-WebLogic) for which the client component files should be generated. The generated stub factory classes in the client JAR file use the value of this attribute in the default constructor. |
String |
Yes |
|
|
Specifies the value of the |
String |
No |
Parent topic: clientgen
Examples
The following examples illustrate how to build a clientgen Ant target.
- Example 1 Building a Basic clientgen Ant Target
-
In the following example, when the sample
build_clienttarget is executed,clientgenuses the WSDL file specified by thewsdlattribute to generate all the client-side artifacts needed to invoke the web service specified by theserviceNameattribute. TheclientgenAnt task generates all the artifacts into the/output/clientclassesdirectory. All generated Java code is in themyapp.myservice.clientpackage. Afterclientgenhas finished, thejavacAnt task then compiles the Java code, bothclientgen-generated as well as your own client application that uses the generated artifacts and contains your business code. By default,clientgengenerates client artifacts based on a JAX-WS web service.<taskdef name="clientgen" classname="weblogic.wsee.tools.anttasks.ClientGenTask" /> ... <target name="build_client"> <clientgen wsdl="http://example.com/myapp/myservice.wsdl" destDir="/output/clientclasses" packageName="myapp.myservice.client" serviceName="StockQuoteService" /> <javac ... /> </target> - Example 2 Generating a JAX-WS Web Service Client
-
In the preceding example, it is assumed that the web service for which you are generating client artifacts is based on JAX-WS; the following example shows how to use the
typeattribute to specify that the web service is based on JAX-WS:<clientgen type="JAXWS" wsdl="http://${wls.hostname}:${wls.port}/JaxWsImpl/JaxWsImplService?WSDL" destDir="/output/clientclasses" packageName="examples.webservices.jaxws.client" /> - Example 3 Compiling and Packaging the Generated Artifacts
-
If you want the
clientgenAnt task to compile and package the generated artifacts for you, specify thedestFileattribute rather thandestDir. In this example, you do not need to also specify thejavacAnt task afterclientgenin thebuild.xmlfile because the Java code has already been compiled.<clientgen type="JAXWS" wsdl="http://example.com/myapp/myservice.wsdl" destFile="/output/jarfiles/myclient.jar" packageName="myapp.myservice.client" serviceName="StockQuoteService" /> - Example 4 Executing clientgen on a Static WSDL File
-
You typically execute the
clientgenAnt task on a WSDL file that is deployed on the Web and accessed using HTTP. Sometimes, however, you might want to executeclientgenon a static WSDL file that is packaged in an archive file, such as the WAR or JAR file generated by thejwscAnt task. In this case you must use the following syntax for thewsdlattribute:wsdl="jar:file:archive_file!WSDL_file"
where
archive_filerefers to the full or relative (to the current directory) name of the archive file andWSDL_filerefers to the full pathname of the WSDL file, relative to the root directory of the archive file.The following example shows how to execute
clientgenon a static WSDL file calledSimpleService.wsdl, which is packaged in theWEB-INFdirectory of a WAR file calledSimpleImpl.war, which is located in theoutput/myEAR/examples/webservices/simplesub-directory of the directory that contains thebuild.xmlfile.<clientgen type="JAXWS" wsdl="jar:file:output/myEAR/examples/webservices/simple/SimpleImpl.war!/WEB-INF/SimpleService.wsdl" destDir="/output/clientclasses" packageName="myapp.myservice.client" /> - Example 5 Setting Java Properties
-
You can use the standard Ant
<sysproperty>nested element to set Java properties, such as the username and password of a valid WebLogic Server user (if you have enabled access control on the web service) or the name of a client-side trust store that contains trusted certificates, as shown in the following example:<clientgen type="JAXWS" wsdl="http://example.com/myapp/mySecuredService.wsdl" destDir="/output/clientclasses" packageName="myapp.mysecuredservice.client" serviceName="SecureStockQuoteService" <sysproperty key="javax.net.ssl.trustStore" value="/keystores/DemoTrust.jks"/> <sysproperty key="weblogic.wsee.client.ssl.stricthostchecking" value="false"/> <sysproperty key="javax.xml.ws.security.auth.username" value="juliet"/> <sysproperty key="javax.xml.ws.security.auth.password" value="secret"/> </clientgen>
Parent topic: clientgen
wsdlc
The wsdlc Ant task generates, from an existing WSDL file, a set of artifacts that together provide a partial Java implementation of the web service described by the WSDL file. By specifying the type attribute, you can generate a partial implementation based on JAX-WS.
By default, it is assumed that the WSDL file includes a single <service> element from which the wsdlc Ant task generates artifacts. You can, however, use the srcServiceName attribute to specify a specific web service, in the case that there is more than one <service> element in the WSDL file, or use the srcPortName attribute to specify a specific port of a web service in the case that there is more than one <port> child element for a given web service.
The wsdlc Ant task generates the following artifacts:
-
A JWS interface file—or service endpoint interface—that implements the web service described by the WSDL file. The interface includes full method signatures that implement the web service operations, and JWS annotations (such as
@WebServiceand@SOAPBinding) that implement other aspects of the web service. You should not modify this file. -
Data binding artifacts used by WebLogic Server to convert between the XML and Java representations of the web service parameters and return values. The XML Schema of the data types is specified in the WSDL, and the Java representation is generated by the
wsdlcAnt task. You should not modify this file. -
A JWS file that contains a partial (stubbed-out) implementation of the generated JWS interface. You need to modify this file to include your business code.
-
Optional Javadocs for the generated JWS interface.
After running the wsdlc Ant task, (which typically you only do once) you update the generated JWS implementation file, for example, to add Java code to the methods so that they function as defined by your business requirements. The generated JWS implementation file does not initially contain any business logic because the wsdlc Ant task does not know how you want your web service to function, although it does know the shape of the web service, based on the WSDL file.
When you code the JWS implementation file, you can also add additional JWS annotations, although you must abide by the following rules:
-
The only standard JSR-181 JWS annotations you can include in the JWS implementation file are
@WebServiceand@HandlerChain,@SOAPMessageHandler, and@SOAPMessageHandlers. If you specify any other JWS-181 JWS annotations, thejwscAnt task will return an error when you try to compile the JWS file into a web service. -
You cannot attach policies to the web service within the JWS implementation file using the
weblogic.jws.Policyorweblogic.jws.Policiesannotations. -
Additionally, you can specify only the
serviceNameandendpointInterfaceattributes of the@WebServiceannotation. Use theserviceNameattribute to specify a different<service>WSDL element from the one that thewsdlcAnt task used, in the rare case that the WSDL file contains more than one<service>element. Use theendpointInterfaceattribute to specify the JWS interface generated by thewsdlcAnt task. -
You cannot use any WebLogic-specific JWS annotations in a JAX-WS web service.
-
For JAX-WS, you can specify JAX-WS (JSR 224 at
https://jcp.org/en/jsr/detail?id=224), JAXB (JSR 222 athttp://jcp.org/en/jsr/detail?id=222), or Common (JSR 250 athttp://jcp.org/en/jsr/detail?id=250) annotations, as required.
After you have coded the JWS file with your business logic, run the jwsc Ant task to generate a complete Java implementation of the web service. Use the compiledWsdl attribute of jwsc to specify the JAR file generated by the wsdlc Ant task which contains the JWS interface file and data binding artifacts. By specifying this attribute, the jwsc Ant task does not generate a new WSDL file but instead uses the one in the JAR file. Consequently, when you deploy the web service and view its WSDL, the deployed WSDL will look just like the one from which you initially started.
Note:
The only potential difference between the original and deployed WSDL is the value of the location attribute of the <address> element of the port(s) of the web service. The deployed WSDL will specify the actual hostname and URI of the deployed web service, which is most likely different from that of the original WSDL. This difference is to be expected when deploying a real web service based on a static WSDL.
Depending on the type of partial implementation you generate (JAX-WS), the Java package name of the generated complex data types differs, as described in the following guidelines:
-
For JAX-WS, if you specify the
packageNameattribute, then all artifacts (Java complex data types, JWS interface, and the JWS interface implementation) are generated into this package. If you want to change the package name of the generated Java complex data types in this case, use the<binding>child element of thewsdlcAnt task to specify a custom binding declarations file. For information about creating a custom binding declarations file, see Using JAXB Data Binding in Developing JAX-WS Web Services for Oracle WebLogic Server. -
The package name of the generated Java complex data types, however, always corresponds to the XSD Schema type namespace, whether you specify the
packageNameattribute or not.
See Creating a web service from a WSDL File in Developing JAX-WS Web Services for Oracle WebLogic Server for a complete example of using the wsdlc Ant task in conjunction with jwsc.
The following sections discuss additional important information about wsdlc:
Parent topic: Ant Task Reference
Taskdef Classname
<taskdef name="wsdlc"
classname="weblogic.wsee.tools.anttasks.WsdlcTask"/>Parent topic: wsdlc
Child Elements
The wsdlc Ant task has the following WebLogic-specific child elements.
For a list of elements associated with the standard Ant javac task that you can also set for the wsdlc Ant task, see Standard Ant javac Attributes That Apply To wsdlc.
Parent topic: wsdlc
binding
Use the <binding> child element to specify the JAX-WS web service.
For JAX-WS, one or more customization files that specify JAX-WS and JAXB custom binding declarations. See Customizing XML Schema-to-Java Mapping Using Binding Declarations in Developing JAX-WS Web Services for Oracle WebLogic Server.
The <binding> element is similar to the standard Ant <Fileset> element and has all the same attributes. See the Apache Ant documentation on the Fileset element at http://ant.apache.org/manual/Types/fileset.html for the full list of attributes you can specify.
Parent topic: Child Elements
xmlcatalog
The <xmlcatalog> child element specifies the ID of an embedded XML catalog. The following shows the element syntax:
<xmlcatalog refid="id"/>
The ID referenced by <xmlcatalog> must match the ID of an embedded XML catalog. You embed an XML catalog in the build.xml file using the following syntax:
<xmlcatalog id="id">
<entity publicid="public_id" location="uri"/>
</xmlcatalog>
In the above syntax, public_id specifies the public identifier of the original XML resource (WSDL or XSD) and uri specifies the replacement XML resource.
The following example shows how to embed an XML catalog and reference it using wsdlc. Relevant code lines are shown in bold.
<target name="wsdlc">
<wsdlc
srcWsdl="wsdl_files/TemperatureService.wsdl"
destJwsDir="output/compiledWsdl"
destImplDir="output/impl"
packageName="examples.webservices.wsdlc"
<xmlcatalog refid="wsimportcatalog"/>
</wsdlc>
</target>
<xmlcatalog id="wsimportcatalog">
<entity publicid="http://helloservice.org/types/HelloTypes.xsd"
location="${basedir}/HelloTypes.xsd"/>
</xmlcatalog>
See Using XML Catalogs in Developing JAX-WS Web Services for Oracle WebLogic Server.
Parent topic: Child Elements
Attributes
The table in the following sections describes the attributes of the wsdlc Ant task.
Parent topic: wsdlc
WebLogic-Specific wsdlc Attributes
The following table describes the WebLogic-specific wsdlc attributes.
Table 2-3 WebLogic-specific Attributes of the wsdlc Ant Task
| Attribute | Description | Data Type | Required? |
|---|---|---|---|
|
|
Specifies an external XML catalog file. See Using XML Catalogs in Developing JAX-WS Web Services for Oracle WebLogic Server. |
String |
No |
|
|
Directory into which the stubbed-out JWS implementation file is generated. The generated JWS file implements the generated JWS interface file (contained within the JAR file). You update this JWS implementation file, adding Java code to the methods so that they behave as you want, then later specify this updated JWS file to the |
String |
No |
|
|
Directory into which Javadoc that describes the JWS interface is generated. Because you should never unjar or update the generated JAR file that contains the JWS interface file that implements the specified web service, you can get detailed information about the interface file from this generated Javadoc. You can then use this documentation, together with the generated stubbed-out JWS implementation file, to add business logic to the partially generated web service. |
String |
No |
|
|
Directory into which the JAR file that contains the JWS interface and data binding artifacts should be generated. The name of the generated JAR file is |
String |
Yes |
|
|
Specifies whether the generated JAR file that contains the generated JWS interface file and data binding artifacts is in exploded directory format or not. Valid values for this attribute are |
Boolean |
No |
|
|
Package into which the generated JWS interface and implementation files should be generated. If you do not specify this attribute, the |
String |
No |
|
|
Name of the WSDL port from which the JWS interface file should be generated. Set the value of this attribute to the value of the If you do not specify this attribute, |
String |
No |
|
|
Name of the web service from which the JWS interface file should be generated. Set the value of this attribute to the value of the The
If you do not specify either this or the |
String |
No |
|
|
Name of the WSDL from which to generate the JAR file that contains the JWS interface and data binding artifacts. The name must include its pathname, either absolute or relative to the directory which contains the Ant |
String |
Yes |
|
|
Specifies the type of web service for which you are generating a partial implementation: Valid value is |
String |
No |
Parent topic: Attributes
Standard Ant javac Attributes That Apply To wsdlc
In addition to the WebLogic-specific wsdlc attributes, you can also define the following standard javac attributes; see the Ant documentation at http://ant.apache.org/manual/ for additional information about each attribute:
-
bootclasspath -
bootClasspathRef -
classpath -
classpathRef -
compiler -
debug -
debugLevel -
depend -
deprecation -
destdir -
encoding -
extdirs -
failonerror -
fork -
includeantruntime -
includejavaruntime -
listfiles -
memoryInitialSize -
memoryMaximumSize -
nowarn -
optimize -
proceed -
source -
sourcepath -
sourcepathRef -
tempdir -
verbose
You can also use the following standard Ant child elements with the wsdlc Ant task:
-
<FileSet> -
<SourcePath> -
<Classpath> -
<Extdirs>
Parent topic: Attributes
Example
The following excerpt from an Ant build.xml file shows how to use the wsdlc and jwsc Ant tasks together to build a WebLogic web service. The build file includes two different targets: generate-from-wsdl that runs the wsdlc Ant task against an existing WSDL file, and build-service that runs the jwsc Ant task to build a deployable web service from the artifacts generated by the wsdlc Ant task:
<taskdef name="wsdlc" classname="weblogic.wsee.tools.anttasks.WsdlcTask"/> <taskdef name="jwsc" classname="weblogic.wsee.tools.anttasks.JwscTask" /> <target name="generate-from-wsdl"> <wsdlc srcWsdl="wsdl_files/TemperatureService.wsdl" destJwsDir="output/compiledWsdl" destImplDir="output/impl" packageName="examples.webservices.wsdlc" type="JAXWS" /> </target> <target name="build-service"> <jwsc srcdir="src" destdir="output/wsdlcEar"> <jws file= "examples/webservices/wsdlc/TemperatureService_TemperaturePortTypeImpl.java" compiledWsdl="output/compiledWsdl/TemperatureService_wsdl.jar" type="JAXWS"/> </jwsc> </target>
In the example, the wsdlc Ant task takes as input the TemperatureService.wsdl file and generates the JAR file that contains the JWS interface and data binding artifacts into the directory output/compiledWsdl. The name of the JAR file is TemperatureService_wsdl.jar. The Ant task also generates a JWS file that contains a stubbed-out implementation of the JWS interface into the output/impl/examples/webservices/wsdlc directory (a combination of the value of the destImplDir attribute and the directory hierarchy corresponding to the specified packageName).
For JAX-WS, the name of the stubbed-out JWS implementation file is based on the name of the <service> element and its inner <port> element in the WSDL file. For example, if the service name is TemperatureService and the port name is TemperaturePortType, then the generated JWS implementation file is called TemperatureService_TemperaturePortTypeImpl.java.
After running wsdlc, you code the stubbed-out JWS implementation file, adding your business logic. Typically, you move this JWS file from the wsdlc-output directory to a more permanent directory that contains your application source code; in the example, the fully coded TemperatureService_TemperaturePortTypeImpl.java JWS file has been moved to the directory src/examples/webservices/wsdlc/. You then run the jwsc Ant task, specifying this JWS file as usual. The only additional attribute you must specify is compiledWsdl to point to the JAR file generated by the wsdlc Ant task, as shown in the preceding example. This indicates that you do not want the jwsc Ant task to generate a new WSDL file, because you want to use the original one that has been compiled into the JAR file.
Parent topic: wsdlc
wsdlget
The wsdlget Ant task downloads to the local directory a WSDL and its imported XML resources.
You may wish to use the download files when defining and referencing an XML catalog to redirect remote XML resources in your application to a local version of the resources.
See Using XML Catalogs in Developing JAX-WS Web Services for Oracle WebLogic Server.
The following sections discuss additional important information about wsdlget:
Parent topic: Ant Task Reference
Taskdef Classname
<taskdef name="wsdlget"
classname="weblogic.wsee.tools.anttasks.WsdlGetTask"/>Parent topic: wsdlget
Child Elements
The wsdlget Ant task has one WebLogic-specific child element: <xmlcatalog>. The <xmlcatalog> child element specifies the ID of an embedded XML catalog. The following shows the element syntax:
<xmlcatalog refid="id"/>
The ID referenced by <xmlcatalog> must match the ID of an embedded XML catalog. You embed an XML catalog in the build.xml file using the following syntax:
<xmlcatalog id="id">
<entity publicid="public_id" location="uri"/>
</xmlcatalog>
In the above syntax, public_id specifies the public identifier of the original XML resource (WSDL or XSD) and uri specifies the replacement XML resource.
The following example shows how to embed an XML catalog and reference it using wsdlget. Relevant code lines are shown in bold.
<target name="wsdlget">
<wsdlget
wsdl="${wsdl}"
destDir="${wsdl.dir}"
catalog="wsdlcatalog.xml"/>
<xmlcatalog refid="wsimportcatalog"/>
</wsdlget>
</target>
<xmlcatalog id="wsimportcatalog">
<entity publicid="http://helloservice.org/types/HelloTypes.xsd"
location="${basedir}/HelloTypes.xsd"/>
</xmlcatalog>
See Using XML Catalogs in Developing JAX-WS Web Services for Oracle WebLogic Server.
Parent topic: wsdlget
Attributes
The following table describes the attributes of the wsdlget Ant task.
Table 2-4 WebLogic-specific Attributes of the wsdlget Ant Task
| Attribute | Description | Data Type | Required? |
|---|---|---|---|
|
|
Specifies an external XML catalog file. See Using XML Catalogs in Developing JAX-WS Web Services for Oracle WebLogic Server. |
String |
No |
|
|
Directory into which the XML resources are copied. The generated JWS file implements the generated JWS interface file (contained within the JAR file). You update this JWS implementation file, adding Java code to the methods so that they behave as you want, then later specify this updated JWS file to the |
String |
Yes |
|
|
Name of the WSDL to copy to the local directory. |
String |
No |
Parent topic: wsdlget
Example
The following excerpt from an Ant build.xml file shows how to use the wsdlget Ant task to download a WSDL and its imported XML resources. The XML resources will be saved to the wsdl folder in the directory from which the Ant task is run.
<target name="wsdlget"
<wsdlget
wsdl="http://host/service?wsdl"
destDir="./wsdl/"
/>
</target>Parent topic: wsdlget