You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ds...@apache.org on 2006/11/12 12:24:55 UTC

svn commit: r473931 - in /webservices/axis2/branches/java/1_1/modules/samples/quickstartjibx: ./ resources/ resources/META-INF/ src/ src/samples/ src/samples/quickstart/ src/samples/quickstart/clients/ src/samples/quickstart/service/ src/samples/quicks...

Author: dsosnoski
Date: Sun Nov 12 03:24:54 2006
New Revision: 473931

URL: http://svn.apache.org/viewvc?view=rev&rev=473931
Log:
Quickstart sample for JiBX data binding

Added:
    webservices/axis2/branches/java/1_1/modules/samples/quickstartjibx/
    webservices/axis2/branches/java/1_1/modules/samples/quickstartjibx/README.txt
    webservices/axis2/branches/java/1_1/modules/samples/quickstartjibx/build.xml
    webservices/axis2/branches/java/1_1/modules/samples/quickstartjibx/resources/
    webservices/axis2/branches/java/1_1/modules/samples/quickstartjibx/resources/META-INF/
    webservices/axis2/branches/java/1_1/modules/samples/quickstartjibx/resources/META-INF/StockQuoteService.wsdl
    webservices/axis2/branches/java/1_1/modules/samples/quickstartjibx/resources/META-INF/services.xml
    webservices/axis2/branches/java/1_1/modules/samples/quickstartjibx/src/
    webservices/axis2/branches/java/1_1/modules/samples/quickstartjibx/src/samples/
    webservices/axis2/branches/java/1_1/modules/samples/quickstartjibx/src/samples/quickstart/
    webservices/axis2/branches/java/1_1/modules/samples/quickstartjibx/src/samples/quickstart/clients/
    webservices/axis2/branches/java/1_1/modules/samples/quickstartjibx/src/samples/quickstart/clients/JiBXClient.java
    webservices/axis2/branches/java/1_1/modules/samples/quickstartjibx/src/samples/quickstart/service/
    webservices/axis2/branches/java/1_1/modules/samples/quickstartjibx/src/samples/quickstart/service/jibx/
    webservices/axis2/branches/java/1_1/modules/samples/quickstartjibx/src/samples/quickstart/service/jibx/StockQuoteServiceSkeleton.java

Added: webservices/axis2/branches/java/1_1/modules/samples/quickstartjibx/README.txt
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/samples/quickstartjibx/README.txt?view=auto&rev=473931
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/samples/quickstartjibx/README.txt (added)
+++ webservices/axis2/branches/java/1_1/modules/samples/quickstartjibx/README.txt Sun Nov 12 03:24:54 2006
@@ -0,0 +1,29 @@
+Axis2 Quick Start Guide- (JiBX)
+======================================
+
+Introduction
+============
+In this sample, we are deploying a JiBX generated service. The service
+is tested using generated client stubs.
+
+Pre-Requisites
+==============
+
+Apache Ant 1.6.2 or later
+
+Building the Service
+====================
+
+Type "ant generate.service" from Axis2_HOME/samples/quickstartjibx
+directory and then deploy the 
+Axis2_HOME/samples/quickstartjibx/build/service/build/lib/StockQuoteService.aar
+
+Running the Client
+==================
+
+type ant run.client in the Axis2_HOME/samples/quickstartadb directory
+
+Help
+====
+Please contact axis-user list (axis-user@ws.apache.org) if you
+have any trouble running the sample.
\ No newline at end of file

Added: webservices/axis2/branches/java/1_1/modules/samples/quickstartjibx/build.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/samples/quickstartjibx/build.xml?view=auto&rev=473931
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/samples/quickstartjibx/build.xml (added)
+++ webservices/axis2/branches/java/1_1/modules/samples/quickstartjibx/build.xml Sun Nov 12 03:24:54 2006
@@ -0,0 +1,83 @@
+<project basedir="." default="generate.all">
+
+    <property environment="env"/>
+    <property name="AXIS2_HOME" value="${env.AXIS2_HOME}"/>
+
+    <property name="build.dir" value="build"/>
+
+    <path id="axis2.classpath">
+        <fileset dir="${AXIS2_HOME}/lib">
+            <include name="*.jar"/>
+        </fileset>
+    </path>
+    <path id="client.class.path">
+        <fileset dir="${AXIS2_HOME}/lib">
+            <include name="*.jar" />
+        </fileset>
+        <fileset dir="${build.dir}/client/build/lib" >
+            <include name="*.jar" />
+        </fileset>
+    </path>
+
+    <target name="init">
+        <delete dir="${build.dir}"/>
+        <mkdir dir="${build.dir}"/>
+    </target>
+
+    <target name="generate.service" depends="init">
+        <taskdef name="wsdl2java"
+                 classname="org.apache.axis2.tool.ant.AntCodegenTask"
+                 classpathref="axis2.classpath"/>
+        <wsdl2java wsdlFilename="${basedir}/resources/META-INF/StockQuoteService.wsdl"
+                   output="${build.dir}/service"
+                   packageName="samples.quickstart.service.jibx"
+                   language="java"
+                   databindingName="jibx"
+                   unwrap="true"
+                   synconly="true"
+                   serverside="true"
+                   serverSideInterface="true"
+                   namespaceToPackages="http://StockQuoteService/xsd=samples.quickstart.service.jibx.xsd"
+                   generateservicexml="true"/>
+        <copy file="${basedir}/src/samples/quickstart/service/jibx/StockQuoteServiceSkeleton.java"
+              toDir="${build.dir}/service/src/samples/quickstart/service/jibx/"
+              overwrite="yes">    
+        </copy>
+        <copy file="${basedir}/resources/META-INF/services.xml"
+              toDir="${build.dir}/service/resources/"
+              overwrite="yes">
+        </copy>
+        <ant dir="${build.dir}/service"/>
+    </target>
+
+    <target name="generate.client" depends="init">
+        <taskdef name="wsdl2java"
+                 classname="org.apache.axis2.tool.ant.AntCodegenTask"
+                 classpathref="axis2.classpath"/>
+        <wsdl2java wsdlFilename="${basedir}/resources/META-INF/StockQuoteService.wsdl"
+                   output="${build.dir}/client"
+                   packageName="samples.quickstart.service.jibx"
+                   databindingName="jibx"
+                   namespaceToPackages="http://StockQuoteService/xsd=samples.quickstart.service.jibx.xsd"
+                   language="java"
+                   unwrap="true"
+                   synconly="true"/>
+        <copy file="${basedir}/src/samples/quickstart/clients/JiBXClient.java"
+              toDir="${build.dir}/client/src/samples/quickstart/clients/"
+              overwrite="yes">
+        </copy>
+        <ant dir="${build.dir}/client"/>
+    </target>
+
+    <target name="generate.all" depends="generate.service, generate.client"/>
+
+    <target name="run.client" depends="generate.client">
+        <java classname="samples.quickstart.clients.JiBXClient">
+            <classpath refid="client.class.path" />
+        </java>
+    </target>
+
+    <target name="clean">
+        <delete dir="${build.dir}"/>
+    </target>
+</project>

Added: webservices/axis2/branches/java/1_1/modules/samples/quickstartjibx/resources/META-INF/StockQuoteService.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/samples/quickstartjibx/resources/META-INF/StockQuoteService.wsdl?view=auto&rev=473931
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/samples/quickstartjibx/resources/META-INF/StockQuoteService.wsdl (added)
+++ webservices/axis2/branches/java/1_1/modules/samples/quickstartjibx/resources/META-INF/StockQuoteService.wsdl Sun Nov 12 03:24:54 2006
@@ -0,0 +1,90 @@
+<wsdl:definitions xmlns:axis2="http://StockQuoteService" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:ns="http://StockQuoteService/xsd" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://StockQuoteService">
+  <wsdl:types>
+    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://StockQuoteService/xsd">
+      <xs:element name="getPrice">
+        <xs:complexType>
+          <xs:sequence>
+            <xs:element name="symbol" nillable="true" type="xs:string"/>
+          </xs:sequence>
+        </xs:complexType>
+      </xs:element>
+      <xs:element name="getPriceResponse">
+        <xs:complexType>
+          <xs:sequence>
+            <xs:element name="return" nillable="true" type="xs:double"/>
+          </xs:sequence>
+        </xs:complexType>
+      </xs:element>
+      <xs:element name="update">
+        <xs:complexType>
+          <xs:sequence>
+            <xs:element name="symbol" nillable="true" type="xs:string"/>
+            <xs:element name="price" nillable="true" type="xs:double"/>
+          </xs:sequence>
+        </xs:complexType>
+      </xs:element>
+    </xs:schema>
+  </wsdl:types>
+  <wsdl:message name="getPriceMessage">
+    <wsdl:part name="part1" element="ns:getPrice"/>
+  </wsdl:message>
+  <wsdl:message name="getPriceResponseMessage">
+    <wsdl:part name="part1" element="ns:getPriceResponse"/>
+  </wsdl:message>
+  <wsdl:message name="updateMessage">
+    <wsdl:part name="part1" element="ns:update"/>
+  </wsdl:message>
+  <wsdl:portType name="StockQuoteServicePortType">
+    <wsdl:operation name="getPrice">
+      <wsdl:input message="axis2:getPriceMessage"/>
+      <wsdl:output message="axis2:getPriceResponseMessage"/>
+    </wsdl:operation>
+    <wsdl:operation name="update">
+      <wsdl:input message="axis2:updateMessage"/>
+    </wsdl:operation>
+  </wsdl:portType>
+  <wsdl:binding name="StockQuoteServiceSOAP11Binding" type="axis2:StockQuoteServicePortType">
+    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
+    <wsdl:operation name="getPrice">
+      <soap:operation soapAction="urn:getPrice" style="document"/>
+      <wsdl:input>
+        <soap:body use="literal" namespace="http://StockQuoteService"/>
+      </wsdl:input>
+      <wsdl:output>
+        <soap:body use="literal" namespace="http://StockQuoteService"/>
+      </wsdl:output>
+    </wsdl:operation>
+    <wsdl:operation name="update">
+      <soap:operation soapAction="urn:update" style="document"/>
+      <wsdl:input>
+        <soap:body use="literal" namespace="http://StockQuoteService"/>
+      </wsdl:input>
+    </wsdl:operation>
+  </wsdl:binding>
+  <wsdl:binding name="StockQuoteServiceSOAP12Binding" type="axis2:StockQuoteServicePortType">
+    <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
+    <wsdl:operation name="getPrice">
+      <soap12:operation soapAction="urn:getPrice" style="document"/>
+      <wsdl:input>
+        <soap12:body use="literal" namespace="http://StockQuoteService"/>
+      </wsdl:input>
+      <wsdl:output>
+        <soap12:body use="literal" namespace="http://StockQuoteService"/>
+      </wsdl:output>
+    </wsdl:operation>
+    <wsdl:operation name="update">
+      <soap12:operation soapAction="urn:update" style="document"/>
+      <wsdl:input>
+        <soap12:body use="literal" namespace="http://StockQuoteService"/>
+      </wsdl:input>
+    </wsdl:operation>
+  </wsdl:binding>
+  <wsdl:service name="StockQuoteService">
+    <wsdl:port name="StockQuoteServiceSOAP11port" binding="axis2:StockQuoteServiceSOAP11Binding">
+      <soap:address location="http://localhost:8080/axis2/services/StockQuoteService"/>
+    </wsdl:port>
+    <wsdl:port name="StockQuoteServiceSOAP12port" binding="axis2:StockQuoteServiceSOAP12Binding">
+      <soap12:address location="http://localhost:8080/axis2/services/StockQuoteService"/>
+    </wsdl:port>
+  </wsdl:service>
+</wsdl:definitions>
\ No newline at end of file

Added: webservices/axis2/branches/java/1_1/modules/samples/quickstartjibx/resources/META-INF/services.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/samples/quickstartjibx/resources/META-INF/services.xml?view=auto&rev=473931
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/samples/quickstartjibx/resources/META-INF/services.xml (added)
+++ webservices/axis2/branches/java/1_1/modules/samples/quickstartjibx/resources/META-INF/services.xml Sun Nov 12 03:24:54 2006
@@ -0,0 +1,17 @@
+<service name="StockQuoteService" scope="application">
+    <messageReceivers>
+        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
+                         class="samples.quickstart.service.jibx.StockQuoteServiceMessageReceiverInOut"/>
+        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
+                         class="samples.quickstart.service.jibx.StockQuoteServiceMessageReceiverInOnly"/>
+    </messageReceivers>
+    <parameter locked="false" name="ServiceClass">samples.quickstart.service.jibx.StockQuoteServiceSkeleton
+    </parameter>
+    <operation name="update" mep="http://www.w3.org/2004/08/wsdl/in-only">
+        <actionMapping>urn:update</actionMapping>
+    </operation>
+    <operation name="getPrice" mep="http://www.w3.org/2004/08/wsdl/in-out">
+        <actionMapping>urn:getPrice</actionMapping>
+        <outputActionMapping>http://quickstart.samples/StockQuoteServicePortType/getPriceResponse</outputActionMapping>
+    </operation>
+</service>

Added: webservices/axis2/branches/java/1_1/modules/samples/quickstartjibx/src/samples/quickstart/clients/JiBXClient.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/samples/quickstartjibx/src/samples/quickstart/clients/JiBXClient.java?view=auto&rev=473931
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/samples/quickstartjibx/src/samples/quickstart/clients/JiBXClient.java (added)
+++ webservices/axis2/branches/java/1_1/modules/samples/quickstartjibx/src/samples/quickstart/clients/JiBXClient.java Sun Nov 12 03:24:54 2006
@@ -0,0 +1,42 @@
+package samples.quickstart.clients;
+
+import samples.quickstart.service.jibx.StockQuoteServiceStub;
+public class JiBXClient{
+    public static void main(java.lang.String args[]){
+        try{
+            StockQuoteServiceStub stub =
+                new StockQuoteServiceStub
+                ("http://localhost:8800/axis2/services/StockQuoteService");
+
+            getPrice(stub);
+            update(stub);
+            getPrice(stub);
+
+        } catch(Exception e){
+            e.printStackTrace();
+            System.err.println("\n\n\n");
+        }
+    }
+
+    /* fire and forget */
+    public static void update(StockQuoteServiceStub stub){
+        try{
+            stub.update("ABC", new Double(42.35));
+            System.err.println("done");
+        } catch(Exception e){
+            e.printStackTrace();
+            System.err.println("\n\n\n");
+        }
+    }
+
+    /* two way call/receive */
+    public static void getPrice(StockQuoteServiceStub stub){
+        try{
+            System.err.println(stub.getPrice("ABC"));
+        } catch(Exception e){
+            e.printStackTrace();
+            System.err.println("\n\n\n");
+        }
+    }
+
+}

Added: webservices/axis2/branches/java/1_1/modules/samples/quickstartjibx/src/samples/quickstart/service/jibx/StockQuoteServiceSkeleton.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/samples/quickstartjibx/src/samples/quickstart/service/jibx/StockQuoteServiceSkeleton.java?view=auto&rev=473931
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/samples/quickstartjibx/src/samples/quickstart/service/jibx/StockQuoteServiceSkeleton.java (added)
+++ webservices/axis2/branches/java/1_1/modules/samples/quickstartjibx/src/samples/quickstart/service/jibx/StockQuoteServiceSkeleton.java Sun Nov 12 03:24:54 2006
@@ -0,0 +1,18 @@
+package samples.quickstart.service.jibx;
+
+import java.util.HashMap;
+public class StockQuoteServiceSkeleton implements StockQuoteServiceSkeletonInterface {
+    private HashMap map = new HashMap();
+
+    public void update(String symbol, Double price) {
+        map.put(symbol, price);
+    }
+
+    public Double getPrice(String symbol) {
+        if (symbol == null) {
+            return null;
+        } else {
+            return (Double) map.get(symbol);
+        }
+    }
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org