Sample Ant Build File for a Java Client

6-8 Getting Started With JAX-RPC Web Services for Oracle WebLogic Server You must also copy the following clientgen-generated files from clientgens destination directory to javacs destination directory, keeping the same subdirectory hierarchy in the destination: packageNameServiceName_internaldd.xml packageNameServiceName_java_wsdl_mapping.xml packageNameServiceName_saved_wsdl.wsdl where packageName refers to the subdirectory hierarchy that corresponds to the package of the generated JAX-RPC stubs and ServiceName refers to the name of the Web service. To run the client application, add a run target to the build.xml that includes a call to the java task, as shown below: path id=client.class.path pathelement path=clientclasses pathelement path={java.class.path} path target name=run java fork=true classname=examples.webServices.simple_client.Main failonerror=true classpath refid=client.class.path arg line=http:{wls.hostname}:{wls.port}complexComplexService target The path task adds the clientclasses directory to the CLASSPATH. The run target invokes the Main application, passing it the URL of the deployed Web service as its single argument. See Section 6.2.5, Sample Ant Build File for a Java Client for a full sample build.xml file that contains additional targets from those described in this procedure, such as clean. Rerun the build-client target to regenerate the artifacts and recompile into classes, then execute the run target to invoke the echoStruct operation: prompt ant build-client run You can use the build-client and run targets in the build.xml file to iteratively update, rebuild, and run the Java client application as part of your development process.

6.2.5 Sample Ant Build File for a Java Client

The following example shows a complete build.xml file for generating and compiling a Java client. See Section 6.2.1, Using the clientgen Ant Task To Generate Client Artifacts and Section 6.2.4, Compiling and Running the Client Application for explanations of the sections in bold. project name=webservices-simple_client default=all -- set global properties for this build -- property name=wls.hostname value=localhost property name=wls.port value=7001 property name=example-output value=output property name=clientclass-dir value={example-output}clientclass path id=client.class.path pathelement path={clientclass-dir} pathelement path={java.class.path} Invoking Web Services 6-9 path taskdef name=clientgen classname=weblogic.wsee.tools.anttasks.ClientGenTask target name=clean delete dir={clientclass-dir} target target name=all depends=clean,build-client,run target name=build-client clientgen wsdl=http:{wls.hostname}:{wls.port}complexComplexService?WSDL destDir={clientclass-dir} packageName=examples.webservices.simple_client type=JAXRPC javac srcdir={clientclass-dir} destdir={clientclass-dir} includes=.java javac srcdir=src destdir={clientclass-dir} includes=exampleswebservicessimple_client.java target target name=run java fork=true classname=examples.webservices.simple_client.Main failonerror=true classpath refid=client.class.path arg line=http:{wls.hostname}:{wls.port}complexComplexService java target project

6.3 Invoking a Web Service from Another Web Service