Main BLOGGER
Google
WWW THIS BLOG
Friday, April 21, 2006
 
Java web service portal

1.  Patterns and Strategies for Building Document-Based Web Services

 

http://java.sun.com/developer/technicalArticles/xml/jaxrpcpatterns/index.html

 

 

2.  Writing A JAX-RPC Client from WSDL (quite old though, but the build.xml is useful)

 

http://www.descriptor.com/articles/web-services/wsdlclient.html

 

 

Here is my tutorial

 

1. get the wsdl file in place  ../wsdl/mcws.wsdl

 

2. use the following bat to generate stubs.

C:\tomcat50-jwsdp\jaxrpc\bin\wscompile -gen:client -d stub config.xml –keep

 

3. generate the config.xml

<?xml version="1.0" encoding="UTF-8"?>

<configuration

    xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/config">

   <wsdl location="../wsdl/mcws.wsdl" packageName="mcwsClient"/>

</configuration>

 

4. create the ant build.xml

 

<?xml version="1.0"?>

 

<project default="run-client">

 

   <!-- define the destination directories -->

   <property name="jwsdp-home"

      value="C:/tomcat50-jwsdp"/>

     

   <property name="jaxrpc-home"

      value="${jwsdp-home}/jaxrpc"/>

 

   <property name="saaj-home"

      value="${jwsdp-home}/saaj"/>

          

   <!-- setup the CLASSPATH -->

   <path id="classpath">

      <fileset dir="${jwsdp-home}/common/lib">

        <include name="*.jar" />

      </fileset>

 

      <fileset dir="${jaxrpc-home}/lib">

        <include name="*.jar" />

      </fileset>

 

      <fileset dir="${saaj-home}/lib">

        <include name="*.jar" />

      </fileset>

 

      <fileset dir="${jwsdp-home}/jwsdp-shared/lib">

        <include name="*.jar" />

      </fileset>

     

      <fileset file="${jwsdp.home}/fastinfoset/lib/FastInfoset.jar"/>

      <fileset file="${jwsdp.home}/sjsxp/lib/jsr173_api.jar"/>     

    </path>

     

   <!-- define the "build" target -->

   <target name="build">

     <javac srcdir="."

            destdir="./classes" >

        <classpath refid="classpath"/>

        <classpath>

            <pathelement location="."/>

        </classpath>

     </javac>

   </target>

  

   <!-- define the "run-client" target -->

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

      <java classname="Client" fork="true">

        <classpath refid="classpath"/>

        <classpath>

            <pathelement location="./classes"/>

        </classpath>

      </java>

   </target>

 

   <!-- define the "run" target -->

   <target name="run" >

      <java classname="Client" fork="true">

        <classpath refid="classpath"/>

        <classpath>

            <pathelement location="./classes"/>

        </classpath>

      </java>

   </target>

  

</project>

 

5. build client

C:\> ant build

 

6. run client

C:\> ant run

 




<< Home

Powered by Blogger

Google
WWW THIS BLOG