- generates the supporting artifacts,
- compiles the user-created and generated Java code,
- and archives all the artifacts into an Enterprise Application EAR file that you later deploy to WebLogic Server.
- clean,
- undeploy,
- client,
- and run.
You specify the type of Web service (JAX-WS) that you want to create using type=“JAXWS”.
<project name="webservices-hello_world" default="all">
<!-- set global properties for this build -->
<property name="wls.username" value="weblogic" />
<property name="wls.password" value="weblogic12" />
<property name="wls.hostname" value="localhost" />
<property name="wls.port" value="7001" />
<property name="wls.server.name" value="myManagedServer" />
<property name="wls.server.port" value="7003" />
<property name="ear.deployed.name" value="helloWorldEar" />
<property name="example-output" value="output" />
<property name="ear-dir" value="${example-output}/helloWorldEar" />
<property name="clientclass-dir" value="${example-output}/clientclasses" />
<path id="client.class.path">
<pathelement path="${clientclass-dir}"/>
<pathelement path="${java.class.path}"/>
</path>
<taskdef name="jwsc" classname="weblogic.wsee.tools.anttasks.JwscTask" />
<taskdef name="clientgen" classname="weblogic.wsee.tools.anttasks.ClientGenTask" />
<taskdef name="wldeploy" classname="weblogic.ant.taskdefs.management.WLDeploy"/>
<target name="all" depends="clean,build-service,deploy,client" />
<target name="clean" depends="undeploy">
<delete dir="${example-output}"/>
</target>
<target name="build-service">
<jwsc srcdir="src" destdir="${ear-dir}">
<jws file="examples/webservices/hello_world/HelloWorldImpl.java" type="JAXWS"/>
</jwsc>
</target>
<target name="deploy">
<wldeploy action="deploy" name="${ear.deployed.name}" source="${ear-dir}" user="${wls.username}" password="${wls.password}" verbose="true" adminurl="t3://${wls.hostname}:${wls.port}" targets="${wls.server.name}" />
</target>
<target name="undeploy">
<wldeploy action="undeploy" name="${ear.deployed.name}" failonerror="false" user="${wls.username}" password="${wls.password}" verbose="true" adminurl="t3://${wls.hostname}:${wls.port}" targets="${wls.server.name}" />
</target>
<target name="client">
<clientgen wsdl="http://${wls.hostname}:${wls.server.port}/HelloWorldImpl/HelloWorldService?WSDL" destDir="${clientclass-dir}" packageName="examples.webservices.hello_world.client" type="JAXWS"/>
<javac srcdir="${clientclass-dir}" destdir="${clientclass-dir}" includes="**/*.java"/>
<javac srcdir="src" destdir="${clientclass-dir}" includes="examples/webservices/hello_world/client/**/*.java"/>
</target>
<target name="run">
<java classname="examples.webservices.hello_world.client.Main" fork="true" failonerror="true">
<classpath refid="client.class.path"/>
<arg line="http://${wls.hostname}:${wls.port}/HelloWorldImpl/HelloWorldService" />
</java>
</target>
</project>
Ant
ClassPath
setDomainEnv
Open a command window and execute the setDomainEnv.cmd (Windows) or setDomainEnv.sh (UNIX) script, located in the bin subdirectory of your domain directory. The default location of WebLogic Server domains is MW_HOME/user_projects/domains/domainName
set DOMAIN_NAME=gerardnico_domain
set USERDOMAIN_HOME=C:\Oracle\Middleware\user_projects\domains\gerardnico_domain
cd %USERDOMAIN_HOME%
call %USERDOMAIN_HOME%\bin\setDomainEnv.cmd
Eclipse OEPE
Add the weblogic.jar in the Antclass path by using the external configuration tools (Run > External Tools > External Tool Configuration)Execution
One Target
Execute the jwsc Ant task:- at the command line by specifying the build-service target:
C:\workspace\hello_world>ant build-service
- with Eclipse OEPE. In the outline view, select the build-service target and Run > External Tool > Run as > Ant Build
Buildfile: C:\workspace\hello_world\build.xml
build-service:
[jwsc] warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[jwsc] JWS: processing module /examples/webservices/hello_world/HelloWorldImpl
[jwsc] Parsing source files
[jwsc] Parsing source files
[jwsc] 1 JWS files being processed for module /examples/webservices/hello_world/HelloWorldImpl
[jwsc] JWS: C:\workspace\hello_world\src\examples\webservices\hello_world\HelloWorldImpl.java Validated.
[jwsc] Processing 1 JAX-WS web services...
[jwsc] warning: Annotation types without processors: [javax.xml.bind.annotation.XmlRootElement, javax.xml.bind.annotation.XmlAccessorType, javax.xml.bind.annotation.XmlType, javax.xml.bind.annotation.XmlElement]
[jwsc] 1 warning
[jwsc] Compiling 3 source files to C:\Users\RIXNI\AppData\Local\Temp\_gwf3vm
[jwsc] Deleting existing module outputFile C:\workspace\hello_world\output\helloWorldEar\examples\webservices\hello_world\HelloWorldImpl.war
[jwsc] Building jar: C:\workspace\hello_world\output\helloWorldEar\examples\webservices\hello_world\HelloWorldImpl.war
[jwsc] Created JWS deployment outputFile: C:\workspace\hello_world\output\helloWorldEar\examples\webservices\hello_world\HelloWorldImpl.war
[jwsc] [EarFile] Application File : C:\workspace\hello_world\output\helloWorldEar\META-INF\application.xml
[AntUtil.deleteDir] Deleting directory C:\Users\RIXNI\AppData\Local\Temp\_gwf3vm
BUILD SUCCESSFUL
Total time: 4 seconds
See the output/helloWorldEar directory to view the files and artifacts generated by the jwsc Ant task.All
Execute the jwsc Ant task:- at the command line by specifying the build-service target:
C:\workspace\hello_world>ant all
- with Eclipse OEPE: Run > External Tool > Run as > Ant Build. The default target (ie all) will run.
Testing

WSDL
http://localhost:7003/HelloWorldImpl/HelloWorldService?WSDL
<!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is Oracle JAX-WS 2.1.5. -->
<!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is Oracle JAX-WS 2.1.5. -->
<definitions targetNamespace="http://hello_world.webservices.examples/" name="HelloWorldService">
<types>
<xsd:schema>
<xsd:import namespace="http://hello_world.webservices.examples/" schemaLocation="http://localhost:7003/HelloWorldImpl/HelloWorldService?xsd=1"/>
</xsd:schema>
</types>
<message name="sayHelloWorld">
<part name="parameters" element="tns:sayHelloWorld"/>
</message>
<message name="sayHelloWorldResponse">
<part name="parameters" element="tns:sayHelloWorldResponse"/>
</message>
<portType name="HelloWorldPortType">
<operation name="sayHelloWorld">
<input message="tns:sayHelloWorld"/>
<output message="tns:sayHelloWorldResponse"/>
</operation>
</portType>
<binding name="HelloWorldPortTypePortBinding" type="tns:HelloWorldPortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="sayHelloWorld">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="HelloWorldService">
<port name="HelloWorldPortTypePort" binding="tns:HelloWorldPortTypePortBinding">
<soap:address location="http://localhost:7003/HelloWorldImpl/HelloWorldService"/>
</port>
</service>
</definitions>
Client

Support
taskdef class cannot be found
BUILD FAILED
C:\workspace\hello_world\build.xml:5: taskdef class weblogic.wsee.tools.anttasks.JwscTask cannot be found
using the classloader AntClassLoader[]
The jar Middleware_home/wlserver_10.3/server/lib/weblogic.jar“ is not in the AntBuildPath. Two solutions:- run the setDomainEnv
- in Eclipse OEPE, add the weblogic.jar in the AntPath by using the external configuration tools (Run > External Tools > External Tool Configuration)

Target “all” does not exist in the project
BUILD FAILED
Target "all" does not exist in the project "webservices-hello_world".
When using the example of the documentation, the default action is all but the all target doesn't exit then:- Replace
<project name="webservices-hello_world" default="all">
with
<project name="webservices-hello_world" default="build-service">
- or add a all target
<target name="all" depends="clean,build-service,deploy,client" />
Unable to contact 'myManagedServer'
[wldeploy] java.rmi.RemoteException: [Deployer:149145]Unable to contact 'myManagedServer'. Deployment is deferred until 'myManagedServer' becomes available.
Documentation / Reference