You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2006/11/04 16:55:27 UTC
svn commit: r471221 - in
/webservices/axis2/branches/java/1_1/modules/samples/databinding: ./
client/ client/src/ client/src/samples/ client/src/samples/databinding/
docs/ service/ service/src/ service/src/samples/
service/src/samples/databinding/
Author: dims
Date: Sat Nov 4 07:55:26 2006
New Revision: 471221
URL: http://svn.apache.org/viewvc?view=rev&rev=471221
Log:
Initial commit of a custom databinding sample illustrating how one can generate code using WSDL2Java with '-d none' and use castor to work with the data
Added:
webservices/axis2/branches/java/1_1/modules/samples/databinding/
webservices/axis2/branches/java/1_1/modules/samples/databinding/README.txt
webservices/axis2/branches/java/1_1/modules/samples/databinding/StockQuote.xsd
webservices/axis2/branches/java/1_1/modules/samples/databinding/StockQuoteService.wsdl
webservices/axis2/branches/java/1_1/modules/samples/databinding/build.xml
webservices/axis2/branches/java/1_1/modules/samples/databinding/castorbuilder.properties
webservices/axis2/branches/java/1_1/modules/samples/databinding/client/
webservices/axis2/branches/java/1_1/modules/samples/databinding/client/build.xml
webservices/axis2/branches/java/1_1/modules/samples/databinding/client/src/
webservices/axis2/branches/java/1_1/modules/samples/databinding/client/src/samples/
webservices/axis2/branches/java/1_1/modules/samples/databinding/client/src/samples/databinding/
webservices/axis2/branches/java/1_1/modules/samples/databinding/client/src/samples/databinding/StockClient.java
webservices/axis2/branches/java/1_1/modules/samples/databinding/docs/
webservices/axis2/branches/java/1_1/modules/samples/databinding/service/
webservices/axis2/branches/java/1_1/modules/samples/databinding/service/build.xml
webservices/axis2/branches/java/1_1/modules/samples/databinding/service/src/
webservices/axis2/branches/java/1_1/modules/samples/databinding/service/src/samples/
webservices/axis2/branches/java/1_1/modules/samples/databinding/service/src/samples/databinding/
webservices/axis2/branches/java/1_1/modules/samples/databinding/service/src/samples/databinding/StockQuoteServiceSkeleton.java
Added: webservices/axis2/branches/java/1_1/modules/samples/databinding/README.txt
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/samples/databinding/README.txt?view=auto&rev=471221
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/samples/databinding/README.txt (added)
+++ webservices/axis2/branches/java/1_1/modules/samples/databinding/README.txt Sat Nov 4 07:55:26 2006
@@ -0,0 +1,28 @@
+Introduction
+============
+
+This sample demonstrates how use WSDL2Java generated code with Castor
+
+Running of this sample assumes that you are running this within the extracted release folder.
+
+Pre-Requisites
+==============
+
+None
+
+Running The Sample
+==================
+
+Running the run.client runs the client/src/samples/databinding/StockClient.java class. You may use the command scripts to do so. You need to supply 2 parameters to the command- url and symbol.
+
+ * ant run.client -Durl=http://localhost:8080/axis2/services/StockQuoteService -Dsymbol=IBM
+ Succeeds with a Price of 234235.0. You will see "Price = 234235.0"
+
+When you call ant run.client with parameters, before running client/src/samples/databinding/StockClient.java class, it does the following as well:
+ * Generate the stubs (for the client) from the WSDL
+ * Compile the client classes
+ * Create a Jar of the client classes and copy it to build/client/StockService-test-client.jar
+
+Advanced Guide
+==============
+For more details kindly see doc/DataBindingSampleGuide.html
\ No newline at end of file
Added: webservices/axis2/branches/java/1_1/modules/samples/databinding/StockQuote.xsd
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/samples/databinding/StockQuote.xsd?view=auto&rev=471221
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/samples/databinding/StockQuote.xsd (added)
+++ webservices/axis2/branches/java/1_1/modules/samples/databinding/StockQuote.xsd Sat Nov 4 07:55:26 2006
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://w3.ibm.com/schemas/services/2002/11/15/stockquote"
+ xmlns="http://w3.ibm.com/schemas/services/2002/11/15/stockquote"
+>
+
+ <xsd:element name="quote">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="symbol" type="xsd:string"/>
+ <xsd:element name="volume" type="xsd:integer"/>
+ <xsd:element name="lastTrade" type="lastTradeType"/>
+ <xsd:element name="change" type="changeType"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="changeType">
+ <xsd:sequence>
+ <xsd:element name="dollar" type="xsd:float"/>
+ <xsd:element name="percent" type="xsd:float"/>
+ <xsd:element name="positive" type="xsd:boolean"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="lastTradeType">
+ <xsd:sequence>
+ <xsd:element name="price" type="xsd:float"/>
+ <xsd:element name="date" type="xsd:long"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <!-- Methods signatures -->
+ <xsd:element name="getStockQuote">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="symbol" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getStockQuoteResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="quote" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+</xsd:schema>
Added: webservices/axis2/branches/java/1_1/modules/samples/databinding/StockQuoteService.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/samples/databinding/StockQuoteService.wsdl?view=auto&rev=471221
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/samples/databinding/StockQuoteService.wsdl (added)
+++ webservices/axis2/branches/java/1_1/modules/samples/databinding/StockQuoteService.wsdl Sat Nov 4 07:55:26 2006
@@ -0,0 +1,45 @@
+<definitions targetNamespace="http://w3.ibm.com/schemas/services/2002/11/15/stockquote/wsdl"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://w3.ibm.com/schemas/services/2002/11/15/stockquote/wsdl"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:types="http://w3.ibm.com/schemas/services/2002/11/15/stockquote"
+ >
+
+ <import namespace="http://w3.ibm.com/schemas/services/2002/11/15/stockquote" location="StockQuote.xsd" />
+
+ <message name="getStockQuoteReq">
+ <part name="parameters" element="types:getStockQuote" />
+ </message>
+
+ <message name="getStockQuoteResp">
+ <part name="parameters" element="types:getStockQuoteResponse" />
+ </message>
+
+ <portType name="StockQuotePortType">
+ <operation name="getStockQuote">
+ <input message="tns:getStockQuoteReq" />
+ <output message="tns:getStockQuoteResp" />
+ </operation>
+ </portType>
+
+ <binding name="StockQuoteSOAPBinding" type="tns:StockQuotePortType">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+ <operation name="getStockQuote">
+ <soap:operation style="document" soapAction="getStockQuote" />
+ <input>
+ <soap:body use="literal" />
+ </input>
+ <output>
+ <soap:body use="literal" />
+ </output>
+ </operation>
+ </binding>
+
+ <service name="StockQuoteService">
+ <port name="StockQuoteSOAPPort" binding="tns:StockQuoteSOAPBinding">
+ <soap:address location="http://localhost:8080/axis2/services/StockQuoteService" />
+ </port>
+ </service>
+
+</definitions>
\ No newline at end of file
Added: webservices/axis2/branches/java/1_1/modules/samples/databinding/build.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/samples/databinding/build.xml?view=auto&rev=471221
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/samples/databinding/build.xml (added)
+++ webservices/axis2/branches/java/1_1/modules/samples/databinding/build.xml Sat Nov 4 07:55:26 2006
@@ -0,0 +1,167 @@
+<project basedir="." default="generate.service">
+
+ <property environment="env"/>
+
+ <property name="wsdl.uri" value="StockQuoteService.wsdl"/>
+ <property name="service.target" value="build/service"/>
+ <property name="client.target" value="build/client"/>
+
+ <path id="axis2.classpath">
+ <!--
+ <fileset dir="../../lib">
+ <include name="*.jar"/>
+ </fileset>
+ -->
+ <!-- FIXME -->
+ <fileset dir="lib">
+ <include name="*.jar"/>
+ </fileset>
+ <fileset dir="../../../target/temp/war/lib">
+ <include name="*.jar"/>
+ </fileset>
+ <fileset dir="../../../target/temp/cache/war">
+ <include name="*.jar"/>
+ </fileset>
+ </path>
+
+ <macrodef name="CastorSourceGenerator">
+ <attribute name="schema" default="NOT SET"/>
+ <attribute name="package" default="NOT SET"/>
+ <attribute name="output" default="NOT SET"/>
+ <sequential>
+ <echo/>
+ <java classname="org.exolab.castor.builder.SourceGeneratorMain" fork="true">
+ <classpath refid="axis2.classpath"/>
+ <arg line="-i @{schema} -package @{package} -dest @{output}" />
+ </java>
+ </sequential>
+ </macrodef>
+
+ <!-- Build the service, then the client. -->
+ <target name="jar">
+ <ant dir="service" target="jar.server"/>
+ <ant dir="client"/>
+ </target>
+
+ <target name="run.client" depends="generate.stub">
+
+ <condition property="params.ok">
+ <and>
+ <isset property="url"/>
+ <isset property="symbol"/>
+ </and>
+ </condition>
+
+ <fail message="One of the parameters are not set. Usage: StockClient -Durl=<url> -Dsymbol=<symbol>"
+ unless="params.ok"/>
+
+ <java classname="samples.databinding.StockClient" fork="true">
+ <arg line="${url} ${symbol}"/>
+ <classpath>
+ <pathelement location="${client.target}/StockService-test-client.jar"/>
+ <path refid="axis2.classpath"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="generate.all" depends="generate.service,generate.stub"/>
+
+ <target name="generate.service">
+
+ <delete dir="${service.target}"/>
+ <mkdir dir="${service.target}"/>
+ <mkdir dir="${service.target}/classes"/>
+
+ <CastorSourceGenerator output="${service.target}/src"
+ package="samples.databinding.data"
+ schema="StockQuote.xsd"/>
+ <java classname="org.apache.axis2.wsdl.WSDL2Java" fork="true" classpathref="axis2.classpath">
+ <arg line="-uri ${wsdl.uri}"/>
+ <arg line="-ss"/>
+ <arg line="-sd"/>
+ <arg line="-p samples.databinding"/>
+ <arg line="-d none"/>
+ <arg line="-o ${service.target}"/>
+ </java>
+
+ <!--copy the already written skeleton class-->
+ <copy todir="${service.target}/src/"
+ overwrite="yes">
+ <fileset dir="service/src">
+ <include name="**/*.java"/>
+ </fileset>
+ </copy>
+
+ <!--First let's compile the classes-->
+ <javac debug="on" memoryMaximumSize="256m" memoryInitialSize="256m" fork="true"
+ destdir="${service.target}/classes" srcdir="${service.target}/src"
+ classpathref="axis2.classpath">
+ </javac>
+
+ <!--aar them up -->
+ <copy toDir="${service.target}/classes/META-INF" failonerror="false">
+ <fileset dir="${service.target}/resources">
+ <include name="*.xml"/>
+ <include name="*.wsdl"/>
+ <include name="*.xsd"/>
+ </fileset>
+ </copy>
+ <jar destfile="${service.target}/StockService.aar">
+ <fileset excludes="**/Test.class" dir="${service.target}/classes"/>
+ <fileset dir="${basedir}">
+ <include name="lib/*.jar"/>
+ </fileset>
+ </jar>
+
+ <copy file="${service.target}/StockService.aar" tofile="../../repository/services/StockService.aar"
+ overwrite="true"/>
+
+ </target>
+
+ <target name="generate.stub" unless="skip.generate">
+ <delete dir="${client.target}"/>
+ <mkdir dir="${client.target}"/>
+ <mkdir dir="${client.target}/classes"/>
+
+
+ <CastorSourceGenerator output="${client.target}/src"
+ package="samples.databinding.data"
+ schema="StockQuote.xsd"/>
+ <java classname="org.apache.axis2.wsdl.WSDL2Java" fork="true" classpathref="axis2.classpath">
+ <arg line="-uri ${wsdl.uri}"/>
+ <arg line="-u"/>
+ <arg line="-p samples.databinding"/>
+ <arg line="-d none"/>
+ <arg line="-t"/>
+ <arg line="-o ${client.target}"/>
+ </java>
+
+ <copy todir="${client.target}/src/"
+ overwrite="yes">
+ <fileset dir="client/src">
+ <include name="**/*.java"/>
+ </fileset>
+ </copy>
+
+ <!--now compile the stub classes-->
+ <javac debug="on" memoryMaximumSize="256m" memoryInitialSize="256m" fork="true"
+ destdir="${client.target}/classes"
+ classpathref="axis2.classpath">
+ <src path="${client.target}/src"/>
+ </javac>
+
+ <!--jar the compiled stuff-->
+ <jar destfile="${client.target}/StockService-test-client.jar">
+ <fileset dir="${client.target}/classes">
+ <exclude name="**/META-INF/*.*"/>
+ <exclude name="**/*MessageReceiver.class"/>
+ <exclude name="**/*Skeleton.class"/>
+ </fileset>
+ </jar>
+ </target>
+
+ <target name="clean">
+ <delete dir="build"/>
+ </target>
+
+</project>
Added: webservices/axis2/branches/java/1_1/modules/samples/databinding/castorbuilder.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/samples/databinding/castorbuilder.properties?view=auto&rev=471221
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/samples/databinding/castorbuilder.properties (added)
+++ webservices/axis2/branches/java/1_1/modules/samples/databinding/castorbuilder.properties Sat Nov 4 07:55:26 2006
@@ -0,0 +1,58 @@
+#
+# Property file for SourceCodeGenerator
+#
+# $Id: castorbuilder.properties,v 1.9 2003/01/11 00:49:44 kvisco Exp $
+
+# To enable bound properties uncomment the following line. Please
+# note that currently *all* fields will be treated as bound properties
+# when enabled. This will change in the future when we introduce
+# fine grained control over each class and it's properties.
+#
+#org.exolab.castor.builder.boundproperties=true
+
+# Java class mapping of <xsd:element>'s and <xsd:complexType>'s
+#
+org.exolab.castor.builder.javaclassmapping=element
+
+# This property allows one to specify the super class of *all*
+# generated classes
+#
+#org.exolab.castor.builder.superclass=com.xyz.BaseObject
+
+# XML namespace mapping to Java packages
+#
+#org.exolab.castor.builder.nspackages=\
+ http://www.xyz.com/schemas/project=com.xyz.schemas.project,\
+ http://www.xyz.com/schemas/person=com.xyz.schemas.person
+
+# Set to true if you want to generate the equals method
+# for each generated class
+# false by default
+#
+#org.exolab.castor.builder.equalsmethod=true
+
+# Set to true if you want to use Object Wrappers instead
+# of primitives (e.g Float instead of float).
+# false by default.
+#
+#org.exolab.castor.builder.primitivetowrapper=false
+
+# Set to true if you want the generated class descriptors to
+# expose the element and attribute names they contain.
+# false by default.
+#
+#org.exolab.castor.builder.classdescfieldnames=false
+
+# Set to true if you want the generated source code to contain
+# Extra methods for the collection fields, such as get/set using
+# the collection type in addition to the type-safe array.
+# Set this to true if you want your code to be more compatible
+# with Castor JDO. This is false by default.
+#
+#org.exolab.castor.builder.extraCollectionMethods=true
+
+# Use old-style (Castor 0.9.3.9) of naming that uppercases
+# names after an underscore
+#
+#org.exolab.castor.xml.JavaNaming.upperCaseAfterUnderscore=true
+
Added: webservices/axis2/branches/java/1_1/modules/samples/databinding/client/build.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/samples/databinding/client/build.xml?view=auto&rev=471221
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/samples/databinding/client/build.xml (added)
+++ webservices/axis2/branches/java/1_1/modules/samples/databinding/client/build.xml Sat Nov 4 07:55:26 2006
@@ -0,0 +1,43 @@
+<project basedir="." default="jar.client">
+
+ <property environment="env"/>
+
+ <property name="project.base.dir" value="."/>
+ <property name="parent.dir" value=".."/>
+
+ <property name="wsdl.uri" value="${parent.dir}/bank.wsdl"/>
+
+ <property name="src" value="${project.base.dir}/src"/>
+ <property name="target" value="${project.base.dir}/target"/>
+ <property name="target.java" value="${target}/src"/>
+ <property name="target.classes" value="${target}/classes"/>
+
+ <target name="check.dependency" unless="env.AXIS2_HOME">
+ <echo message="AXIS2_HOME must be set"/>
+ </target>
+
+ <target name="gen.stub" if="env.AXIS2_HOME" depends="check.dependency">
+ <delete dir="${target}"/>
+ <mkdir dir="${target}"/>
+ <java classname="org.apache.axis2.wsdl.WSDL2Java" fork="true">
+ <arg line="-uri ${wsdl.uri}"/>
+ <arg line="-u"/>
+ <arg line="-o ${target}"/>
+ <classpath>
+ <fileset dir="${env.AXIS2_HOME}\lib">
+ <include name="*.jar"/>
+ </fileset>
+ </classpath>
+ </java>
+ </target>
+
+ <!-- Create the service archive by executing target\build.xml (jar.server) -->
+ <target name="jar.client" if="env.AXIS2_HOME" depends="gen.stub">
+ <copy todir="${target.java}">
+ <fileset dir="${src}"/>
+ </copy>
+ <ant dir="${target}"/>
+ <copy file="${target}\build\lib\BankService-test-client.jar" todir=".."/>
+ </target>
+
+</project>
\ No newline at end of file
Added: webservices/axis2/branches/java/1_1/modules/samples/databinding/client/src/samples/databinding/StockClient.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/samples/databinding/client/src/samples/databinding/StockClient.java?view=auto&rev=471221
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/samples/databinding/client/src/samples/databinding/StockClient.java (added)
+++ webservices/axis2/branches/java/1_1/modules/samples/databinding/client/src/samples/databinding/StockClient.java Sat Nov 4 07:55:26 2006
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package samples.databinding;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.SAXOMBuilder;
+import org.exolab.castor.xml.Marshaller;
+import org.exolab.castor.xml.Unmarshaller;
+import org.exolab.castor.xml.UnmarshalHandler;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+import samples.databinding.data.GetStockQuote;
+import samples.databinding.data.GetStockQuoteResponse;
+
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.sax.SAXResult;
+public final class StockClient {
+ public static void main(String[] args) throws Exception {
+ if (args.length != 2) {
+ System.err.println("Usage: StockClient <url> <symbol>");
+ return;
+ }
+ final String url = args[0];
+ final String symbol = args[1];
+
+ System.out.println();
+ System.out.println("Getting Stock Quote for " + symbol);
+
+ StockQuoteServiceStub stub =
+ new StockQuoteServiceStub(url);
+ stub._getServiceClient().getOptions().setAction("getStockQuote");
+ GetStockQuote stockQuote = new GetStockQuote();
+ stockQuote.setSymbol(symbol);
+ SAXOMBuilder builder = new SAXOMBuilder();
+ Marshaller.marshal(stockQuote, builder);
+ OMElement response = stub.getStockQuote(
+ builder.getRootElement());
+
+
+ javanet.staxutils.StAXSource staxSource =
+ new javanet.staxutils.StAXSource(response.getXMLStreamReader());
+ Unmarshaller unmarshaller = new Unmarshaller(GetStockQuoteResponse.class);
+ UnmarshalHandler unmarshalHandler = unmarshaller.createHandler();
+ GetStockQuoteResponse stockQuoteResponse;
+ try {
+ ContentHandler contentHandler = Unmarshaller.getContentHandler(unmarshalHandler);
+ TransformerFactory.newInstance().newTransformer().transform(staxSource, new SAXResult(contentHandler));
+ stockQuoteResponse = (GetStockQuoteResponse) unmarshalHandler.getObject();
+ } catch (SAXException e) {
+ throw new RuntimeException(e);
+ } catch (TransformerException e) {
+ throw new RuntimeException(e);
+ }
+ System.out.println("Price = " + stockQuoteResponse.getQuote().getLastTrade().getPrice());
+ }
+}
Added: webservices/axis2/branches/java/1_1/modules/samples/databinding/service/build.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/samples/databinding/service/build.xml?view=auto&rev=471221
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/samples/databinding/service/build.xml (added)
+++ webservices/axis2/branches/java/1_1/modules/samples/databinding/service/build.xml Sat Nov 4 07:55:26 2006
@@ -0,0 +1,40 @@
+<project basedir="." default="gen.skeleton">
+
+ <property environment="env"/>
+
+ <property name="project.base.dir" value="."/>
+ <property name="parent.dir" value=".."/>
+
+ <property name="wsdl.uri" value="${parent.dir}/bank.wsdl"/>
+
+ <property name="src" value="${project.base.dir}/src"/>
+ <property name="target" value="${project.base.dir}/target"/>
+
+ <target name="check.dependency" unless="env.AXIS2_HOME">
+ <echo message="AXIS2_HOME must be set"/>
+ </target>
+
+ <target name="gen.skeleton" if="env.AXIS2_HOME" depends="check.dependency">
+
+
+ <delete dir="${target}"/>
+ <mkdir dir="${target}"/>
+ <java classname="org.apache.axis2.wsdl.WSDL2Java" fork="true">
+ <arg line="-uri ${wsdl.uri}"/>
+ <arg line="-ss"/>
+ <arg line="-sd"/>
+ <arg line="-o ${target}"/> <!-- Output directory in which to generate files --> <!-- NB it generates to the src folder under this directory!! -->
+ <classpath>
+ <fileset dir="${env.AXIS2_HOME}\lib">
+ <include name="*.jar"/>
+ </fileset>
+ </classpath>
+ </java>
+ </target>
+
+ <!-- Create the service archive by executing target\build.xml (jar.server) -->
+ <target name="jar.server" if="env.AXIS2_HOME">
+ <ant dir="${target}"/>
+ <copy file="${target}\build\lib\BankService.aar" todir=".."/>
+ </target>
+</project>
\ No newline at end of file
Added: webservices/axis2/branches/java/1_1/modules/samples/databinding/service/src/samples/databinding/StockQuoteServiceSkeleton.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/samples/databinding/service/src/samples/databinding/StockQuoteServiceSkeleton.java?view=auto&rev=471221
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/samples/databinding/service/src/samples/databinding/StockQuoteServiceSkeleton.java (added)
+++ webservices/axis2/branches/java/1_1/modules/samples/databinding/service/src/samples/databinding/StockQuoteServiceSkeleton.java Sat Nov 4 07:55:26 2006
@@ -0,0 +1,82 @@
+/**
+ * StockQuoteServiceSkeleton.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis2 version: 1.1-SNAPSHOT Nov 03, 2006 (06:54:07 EST)
+ */
+package samples.databinding;
+import org.apache.axiom.om.impl.builder.SAXOMBuilder;
+import org.exolab.castor.xml.MarshalException;
+import org.exolab.castor.xml.Marshaller;
+import org.exolab.castor.xml.Unmarshaller;
+import org.exolab.castor.xml.ValidationException;
+import org.exolab.castor.xml.UnmarshalHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.ContentHandler;
+import samples.databinding.data.GetStockQuote;
+import samples.databinding.data.GetStockQuoteResponse;
+import samples.databinding.data.LastTrade;
+import samples.databinding.data.Quote;
+import samples.databinding.data.Change;
+
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.sax.SAXResult;
+import java.io.IOException;
+import java.util.Calendar;
+/**
+ * StockQuoteServiceSkeleton java skeleton for the axisService
+ */
+public class StockQuoteServiceSkeleton {
+ /**
+ * Auto generated method signature
+ *
+ * @param param0
+ */
+ public org.apache.axiom.om.OMElement getStockQuote(org.apache.axiom.om.OMElement param0) {
+ javanet.staxutils.StAXSource staxSource =
+ new javanet.staxutils.StAXSource(param0.getXMLStreamReader());
+ Unmarshaller unmarshaller = new Unmarshaller(GetStockQuote.class);
+ UnmarshalHandler unmarshalHandler = unmarshaller.createHandler();
+ GetStockQuote stockQuote;
+ try {
+ ContentHandler contentHandler = Unmarshaller.getContentHandler(unmarshalHandler);
+ TransformerFactory.newInstance().newTransformer().transform(staxSource, new SAXResult(contentHandler));
+ stockQuote = (GetStockQuote) unmarshalHandler.getObject();
+ } catch (SAXException e) {
+ throw new RuntimeException(e);
+ } catch (TransformerException e) {
+ throw new RuntimeException(e);
+ }
+ GetStockQuoteResponse stockQuoteResponse = new GetStockQuoteResponse();
+ Quote quote = new Quote();
+ quote.setSymbol(stockQuote.getSymbol());
+ quote.setVolume(5000);
+
+ LastTrade lastTrade = new LastTrade();
+ lastTrade.setPrice(234235);
+ lastTrade.setDate(Calendar.getInstance().getTimeInMillis());
+ quote.setLastTrade(lastTrade);
+
+ Change change = new Change();
+ change.setDollar(1);
+ change.setPercent(10);
+ change.setPositive(true);
+ quote.setChange(change);
+
+ stockQuoteResponse.setQuote(quote);
+ SAXOMBuilder builder = new SAXOMBuilder();
+ try {
+ Marshaller.marshal(stockQuoteResponse, builder);
+ } catch (MarshalException e) {
+ throw new RuntimeException(e);
+ } catch (ValidationException e) {
+ throw new RuntimeException(e);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ return builder.getRootElement();
+ }
+}
+
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org