This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Web Services and the fly likes WSDP2.0 pack example Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "WSDP2.0 pack example " Watch "WSDP2.0 pack example " New topic
Author

WSDP2.0 pack example

ragi singh
Ranch Hand

Joined: Mar 10, 2010
Posts: 198

Hi ,

I was reading the wsdp tutorial from oracle and while going through the examples for jax-rpc i confronted a problem for running the client . I have the example from the wsdp and i am uploading the ant script for the example as an attachment . When i run the ant build for building the client and service classes the service classes are generated along with the ties and the service is up running on a tomcat server . However the build script is unable to create the client classes . Can anyone help me running the client code for JAX-RPC from Java WSDP2.0 .


The build script for the file is as follows:-


<?xml version="1.0"?>

<!--
Copyright 2004 Sun Microsystems, Inc. All rights reserved.
SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
-->

<project name="HelloWorld" default="build" basedir=".">

<property file="build.properties"/>

<property name="endpoint" value="http://localhost:8080/jaxrpc-HelloWorld/hello"/>
<property name="server.port.url" value="http://localhost:8080/jaxrpc-HelloWorld/hello"/>
<property name="appname" value="${ant.project.name}"/>
<property name="source.home" value="${samplesbuild}/${appname}/src"/>
<property name="compile.debug" value="true"/>
<property name="compile.optimize" value="false"/>

<property name="config.rpcenc.file" value="${basedir}/etc/config.xml"/>
<property name="model.rpcenc.file" value="model-wsdl-rpcenc.xml.gz"/>
<property name="webapp.webxml" value="${basedir}/etc/web.xml"/>

<path id="compile.classpath">
<pathelement location="${javamail.jar}"/>
<pathelement location="${jaf.jar}"/>
<pathelement location="${jaxp-api.jar}"/>
<pathelement location="${dom.jar}"/>
<pathelement location="${sax.jar}"/>
<pathelement location="${xalan.jar}"/>
<pathelement location="${xercesImpl.jar}"/>
<pathelement location="${jaxrpc-api.jar}"/>
<pathelement location="${jaxrpc-spi.jar}"/>
<pathelement location="${jaxrpc-impl.jar}"/>
<pathelement location="${saaj-api.jar}"/>
<pathelement location="${saaj-impl.jar}"/>
<pathelement location="${relaxngDatatype.jar}"/>
<pathelement location="${xsdlib.jar}"/>
<pathelement location="${jax-qname.jar}"/>
<pathelement location="${ant.jar}"/>
</path>

<taskdef name="wscompile" classname="com.sun.xml.rpc.tools.ant.Wscompile">
<classpath refid="compile.classpath"/>
</taskdef>
<taskdef name="wsdeploy" classname="com.sun.xml.rpc.tools.ant.Wsdeploy">
<classpath refid="compile.classpath"/>
</taskdef>

<target name="init">
<echo message="-------- ${appname} Sample --------"/>
</target>

<target name="build" depends="build-war ">
<echo message=" Building...."/>
</target>

<target name="prepare" depends="init">
<mkdir dir="${buildhome}"/>
<mkdir dir="${samplesbuild}/${appname}/classes"/>
<mkdir dir="${samplesbuild}/${appname}/classes/server"/>
<mkdir dir="${samplesbuild}/${appname}/classes/client"/>

</target>

<target name="generate-client" depends="prepare">
<antcall target="edit-config">
<param name="config.rpcenc.file" value="${config.rpcenc.file}"/>
</antcall>
<wscompile
keep="true"
client="true"
base="${samplesbuild}/${appname}/classes/client"
xPrintStackTrace="true"
verbose="false"
classpath="${compile.classpath}"
config="${config.rpcenc.file}">
<classpath>
<path refid="compile.classpath"/>
</classpath>
</wscompile>
<antcall target="unedit-config">
<param name="config.rpcenc.file" value="${config.rpcenc.file}"/>
</antcall>
</target>

<target name="generate-server" depends="prepare">
<antcall target="edit-config">
<param name="config.rpcenc.file" value="${config.rpcenc.file}"/>
</antcall>
<wscompile
keep="true"
import="true"
base="${samplesbuild}/${appname}/classes/server"
xPrintStackTrace="true"
verbose="false"
model="${samplesbuild}/${appname}/${model.rpcenc.file}"
classpath="${compile.classpath}"
config="${config.rpcenc.file}">
<classpath>
<path refid="compile.classpath"/>
</classpath>
</wscompile>
<antcall target="unedit-config">
<param name="config.rpcenc.file" value="${config.rpcenc.file}"/>
</antcall>
</target>

<target name="compile-server" depends="generate-server">
<javac srcdir="${samples.home}/${appname}/src/server"
destdir="${samplesbuild}/${appname}/classes/server"
debug="${compile.debug}">
<classpath refid="compile.classpath"/>
</javac>
</target>

<target name="create-war" depends="compile-server">
<war warfile="${samplesbuild}/${appname}/jaxrpc-${appname}-raw.war"
webxml="${webapp.webxml}">
<webinf dir="${basedir}/etc/" includes="*.wsdl,jaxrpc-ri.xml"/>
<webinf dir="${basedir}/etc/" includes="${webapp.jaxrpc.file}" defaultexcludes="no"/>
<webinf dir="${samplesbuild}/${appname}" includes="${model.rpcenc.file}" defaultexcludes="no"/>
<classes dir="${samplesbuild}/${appname}/classes/server" includes="**/*.class" defaultexcludes="no"/>
</war>

<delete dir="${samplesbuild}/${appname}/classes/server"/>
</target>

<target name="build-war" depends="create-war">
<echo message="-------- ${appname} --------"/>

<wsdeploy
keep="true"
inWarFile="${samplesbuild}/${appname}/jaxrpc-${appname}-raw.war"
outWarFile="${samplesbuild}/${appname}/jaxrpc-${appname}.war"
verbose="true">
<classpath refid="compile.classpath"/>
</wsdeploy>

<echo message="Copying jaxrpc-${appname}.war to ${samples.home}/${appname}" />
<copy file="${samplesbuild}/${appname}/jaxrpc-${appname}.war" todir="${samples.home}/${appname}"/>

</target>

<target name="deploy-war" depends="build-war">
<ant antfile="${container}.xml" target="deploy"/>
</target>



<target name="compile-client" depends="generate-client">
<javac srcdir="${samples.home}/${appname}/src/client"
destdir="${samplesbuild}/${appname}/classes/client"
debug="${compile.debug}"
optimize="${compile.optimize}">
<classpath refid="compile.classpath"/>
</javac>
</target>



<path id="run.classpath">
<path refid="compile.classpath"/>
<pathelement location="${samplesbuild}/${appname}/classes/client"/>
</path>

<target name="run-client" depends="compile-client">

<waitfor>
<http url="http://localhost:8080/jaxrpc-HelloWorld"/>
</waitfor>


<java classname="hello.HelloClient"
classpathref="run.classpath"
fork="true">
<sysproperty key="endpoint" value="${endpoint}"/>
<arg value="${server.port.url}"/>
</java>


</target>

<target name="clean">
<delete dir="${buildhome}"/>
<delete dir="${samplesbuild}/${appname}"/>
</target>

<!--
@param: config.file - file to be edited
-->
<target name="edit-config">
<replace
file="${config.rpcenc.file}"
token='location="'
value='location="${basedir}/'/>
</target>

<!--
@param: config.file - file to be edited
-->
<target name="unedit-config">
<replace
file="${config.rpcenc.file}"
token='location="${basedir}/'
value='location="'/>
</target>

</project>


Regards,
Ragini
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: WSDP2.0 pack example
 
Similar Threads
Eclipse 3.3, Glassfish, WebServices and wsimport
Please help Exception in thread "main"
Error in ant test command
Beginner needs help with web service endpoint name
Path not working