![]() |
where to find JAX-RPC examples with ant build script
I cannot find JAX-RPC examples with ant build script.(I can find the
JAX-RPC examples from sun's web site, but there is no ant build script). The JAX-RPC tutorial can be found out from the old JWSDP tutorial, but I need to download the code samples for this old tutorial. But I just cannot find it out. Can anyone help me find it out the code samples (maybe a zip file having code sample and ant build script) for JAX-RPC from sun? Thanks, David |
Re: where to find JAX-RPC examples with ant build script
Here's the HelloWorld build.xml . I've done a lot of jwsdp work but
these days I prefer axis. I still do have some of my build.xml's from my jwsdp days though: <?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> A typical build.xml from one of my projects: <!DOCTYPE project> <project name="jaxrpc-test" default="build-jboss" basedir="."> <property file="build.properties"/> <property file="deploy_env.properties"/> <property name="build" value="build"/> <property name="src" value="src"/> <property name="dist" value="dist"/> <path id="classpath-jboss"> <fileset dir="${jboss.home}/lib"> <include name="*.jar"/> </fileset> <fileset dir="lib"> <include name="*.jar"/> </fileset> <!-- load jars for the wscompile ant task These can be removed if not desired --> <fileset dir="${jwsdp.home}/jwsdp-shared/lib/"> <include name="**/*.jar"/> </fileset> <fileset dir="${jwsdp.home}/jaxrpc/lib"> <include name="**/*.jar"/> </fileset> <fileset dir="${jwsdp.home}/jaxp/lib/endorsed"> <include name="**/*.jar"/> </fileset> <fileset dir="${jwsdp.home}/jaxp/lib"> <include name="**/*.jar"/> </fileset> <fileset dir="${java.home}/lib"> <include name="**/*.jar"/> </fileset> <fileset dir="${java.tools}"> <include name="tools.jar"/> </fileset> </path> <target name="clean" > <delete dir="${build}" /> <delete dir="${dist}" /> </target> <target name="prepare" description="Creates the build directory" > <echo message="Creating the required directories...." /> <mkdir dir="${build}" /> <mkdir dir="${build}/META-INF" /> <mkdir dir="${build}/META-INF/wsdl" /> </target> <taskdef name="wscompile" classname="com.sun.xml.rpc.tools.ant.Wscompile"> <classpath refid="classpath-jboss"/> </taskdef> <!-- Note that this task is poorly documented/implemented by Sun and only works if you specifically tell it where tools.jar is. Its convienant for IDE's, however. Alternatively, run: wscompile.sh -import -mapping resources/CallCentreWeb_Mapping.xml resources/config-wsdl.xml Then its up to you to get those classes into the jsr, see the base command --> <target name="ws" description="Generate compiled complex interfaces and classes from wsdl as a jar for an IDE" depends="clean,prepare"> <echo message="Creating the custom complex objects...." /> <delete dir="resources/com" /> <wscompile fork="true" base="resources" import="true" mapping="resources/CallCentreWeb_Mapping.xml" verbose="true" debug="true" config="resources/config-wsdl.xml"> <classpath refid="classpath-jboss"/> </wscompile> <echo message="Creating the IDE custom complex objects JAR" /> <copy todir="${build}"> <fileset dir="resources"> <include name="**/*.class"/> </fileset> </copy> <jar jarfile="lib/soap-ide_only.jar" > <fileset dir="${build}" /> </jar> <delete dir="${build}" /> </target> <target name="compile-jboss" depends="prepare" description="Compile source code" > <javac srcdir="src" destdir="${build}" debug="true"> <include name="**/*.java" /> <classpath refid="classpath-jboss"/> </javac> </target> <target name="build-jboss" depends="clean" description="when you don't have sun for class generation from wsdl/interface and for packaging"> <copy todir="${build}/META-INF/wsdl"> <fileset dir="resources"> <include name="**/*.wsdl"/> </fileset> </copy> <copy todir="${build}/META-INF"> <fileset dir="resources"> <include name="**/*Mapping.xml"/> <include name="**/jboss*.xml"/> <include name="**/webservices.xml"/> <include name="**/ejb-jar.xml"/> </fileset> </copy> <copy todir="${build}"> <!-- get complex object classes --> <fileset dir="resources"> <include name="**/*.class"/> </fileset> <fileset dir="src"> <include name="**/*.prop*"/> </fileset> </copy> <antcall target="compile-jboss" /> </target> <target name="dist-jboss" depends="build-jboss" description="Preparing the distribution..."> <delete dir="${dist}" /> <mkdir dir="${dist}" /> <copy todir="${dist}"> <fileset dir="resources"> <include name="mysql-connector-java-*.jar"/> </fileset> </copy> <filter token="MySQL.host" value="${MySQL.host}" /> <filter token="MySQL.port" value="${MySQL.port}" /> <filter token="MySQL.user_name" value="${MySQL.user_name}" /> <filter token="MySQL.user_password" value="${MySQL.user_password}" /> <copy todir="${dist}" filtering="true"> <fileset dir="resources"> <include name="mysql-connector-java-*.jar"/> <include name="*-service.xml"/> <include name="*-ds.xml"/> <include name="*-instructions.txt"/> </fileset> </copy> <jar jarfile="${dist}/CallCentreWebServiceJAR.jar" > <fileset dir="${build}" /> </jar> <delete dir="${build}" /> </target> <target name="deploy" description="Put jar into JBoss" depends="ws,build-jboss,dist-jboss"> <echo message="Building JAR and putting it into ${deploy.home} ...."/> <copy todir="${deploy.home}"> <fileset dir="${dist}"> <include name="**/*.jar"/> <include name="**/*.xml"/> </fileset> </copy> </target> </project> HTH, Robert http://www.braziloutsource.com/ |
Re: where to find JAX-RPC examples with ant build script
Can you tell me where did you get this file? I wish to be able to
download it with other related sample code from Sun's site or other . |
Quote:
|
| All times are GMT. The time now is 01:30 PM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.