axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r330452 - in /webservices/axis/trunk/java/samples/xbeans: ./ StarWarsBindingImpl.java StarWarsTestCase.java build.xml starwars.wsdl starwars.xsd
Date Thu, 03 Nov 2005 05:01:00 GMT
Author: dims
Date: Wed Nov  2 21:00:57 2005
New Revision: 330452

URL: http://svn.apache.org/viewcvs?rev=330452&view=rev
Log:
Sample using Xmlbeans serializer/deserializer


Added:
    webservices/axis/trunk/java/samples/xbeans/
    webservices/axis/trunk/java/samples/xbeans/StarWarsBindingImpl.java
    webservices/axis/trunk/java/samples/xbeans/StarWarsTestCase.java
    webservices/axis/trunk/java/samples/xbeans/build.xml
    webservices/axis/trunk/java/samples/xbeans/starwars.wsdl
    webservices/axis/trunk/java/samples/xbeans/starwars.xsd

Added: webservices/axis/trunk/java/samples/xbeans/StarWarsBindingImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/samples/xbeans/StarWarsBindingImpl.java?rev=330452&view=auto
==============================================================================
--- webservices/axis/trunk/java/samples/xbeans/StarWarsBindingImpl.java (added)
+++ webservices/axis/trunk/java/samples/xbeans/StarWarsBindingImpl.java Wed Nov  2 21:00:57
2005
@@ -0,0 +1,41 @@
+/**
+ * StarWarsBindingImpl.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis 1.3 Oct 16, 2005 (11:41:21 EDT) WSDL2Java emitter.
+ */
+
+package samples.xbeans;
+
+public class StarWarsBindingImpl implements samples.xbeans.StarWarsPortType{
+    com.superflaco.xbeans.Character stashed;
+    
+    public com.superflaco.xbeans.Character getChewbecca() throws java.rmi.RemoteException
{
+        com.superflaco.xbeans.Character chewie =
+            com.superflaco.xbeans.Character.Factory.newInstance();
+        chewie.setName("Chewbacca");
+
+        com.superflaco.xbeans.System sys = com.superflaco.xbeans.System.Factory.newInstance();
+        sys.setName("WookieSector");
+        
+        chewie.setHome(sys);
+        chewie.setFaction("smuggler");
+        chewie.setEvil(false);
+        chewie.setJedi(false);
+        return chewie;
+    }
+
+    public com.superflaco.xbeans.Character stashChar(com.superflaco.xbeans.Character newChew)
throws java.rmi.RemoteException {
+        if (stashed == null) {
+            stashed = getChewbecca();
+        }
+
+        if (newChew != null) {
+            System.out.println("old: " + stashed.toString());
+            System.out.println("new: " + newChew.toString());
+            stashed = newChew;
+        }
+        return stashed;
+    }
+
+}

Added: webservices/axis/trunk/java/samples/xbeans/StarWarsTestCase.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/samples/xbeans/StarWarsTestCase.java?rev=330452&view=auto
==============================================================================
--- webservices/axis/trunk/java/samples/xbeans/StarWarsTestCase.java (added)
+++ webservices/axis/trunk/java/samples/xbeans/StarWarsTestCase.java Wed Nov  2 21:00:57 2005
@@ -0,0 +1,50 @@
+/**
+ * StarWarsTestCase.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis 1.3 Oct 16, 2005 (11:41:21 EDT) WSDL2Java emitter.
+ */
+
+package samples.xbeans;
+
+public class StarWarsTestCase extends junit.framework.TestCase {
+    public StarWarsTestCase(java.lang.String name) {
+        super(name);
+    }
+
+    /** TODO: Fix me
+    public void testStarWarsPortWSDL() throws Exception {
+        javax.xml.rpc.ServiceFactory serviceFactory = javax.xml.rpc.ServiceFactory.newInstance();
+        java.net.URL url = new java.net.URL(new samples.xbeans.StarWarsLocator().getStarWarsPortAddress()
+ "?WSDL");
+        javax.xml.rpc.Service service = serviceFactory.createService(url, new samples.xbeans.StarWarsLocator().getServiceName());
+        assertTrue(service != null);
+    }
+
+    **/
+    
+    public void test1StarWarsPortGetChewbecca() throws Exception {
+        samples.xbeans.StarWarsBindingStub binding;
+        try {
+            binding = (samples.xbeans.StarWarsBindingStub)
+                          new samples.xbeans.StarWarsLocator().getStarWarsPort();
+        }
+        catch (javax.xml.rpc.ServiceException jre) {
+            if(jre.getLinkedCause()!=null)
+                jre.getLinkedCause().printStackTrace();
+            throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught:
" + jre);
+        }
+        assertNotNull("binding is null", binding);
+
+        // Time out after a minute
+        binding.setTimeout(60000);
+
+        // Test operation
+        com.superflaco.xbeans.Character value = null;
+        value = binding.getChewbecca();
+        // TBD - validate results
+        
+        assertNotNull(value);
+        
+        System.out.println(value.toString());
+    }
+}

Added: webservices/axis/trunk/java/samples/xbeans/build.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/samples/xbeans/build.xml?rev=330452&view=auto
==============================================================================
--- webservices/axis/trunk/java/samples/xbeans/build.xml (added)
+++ webservices/axis/trunk/java/samples/xbeans/build.xml Wed Nov  2 21:00:57 2005
@@ -0,0 +1,109 @@
+<?xml version="1.0" ?>
+<!DOCTYPE project [
+        <!ENTITY properties SYSTEM "file:../../xmls/properties.xml">
+        <!ENTITY paths  SYSTEM "file:../../xmls/path_refs.xml">
+        <!ENTITY taskdefs SYSTEM "file:../../xmls/taskdefs.xml">
+        <!ENTITY taskdefs_post_compile SYSTEM "file:../../xmls/taskdefs_post_compile.xml">
+        <!ENTITY targets SYSTEM "file:../../xmls/targets.xml">
+]>
+
+<!-- ===================================================================
+<description>
+   Test/Sample Component file for Axis
+
+Notes:
+   This is a build file for use with the Jakarta Ant build tool.
+
+Prerequisites:
+
+   jakarta-ant from http://jakarta.apache.org
+
+Build Instructions:
+   To compile
+        ant compile
+   To execute
+        ant run
+
+Author:
+  Matt Seibert mseibert@us.ibm.com
+
+Copyright:
+  Copyright (c) 2002-2003 Apache Software Foundation.
+</description>
+==================================================================== -->
+
+<project default="compile">
+
+    <property name="axis.home" location="../.."/>
+    <property name="componentName" value="samples/xbeans"/>
+    &properties;
+    &paths;
+    &taskdefs;
+    &taskdefs_post_compile;
+    &targets;
+
+    <target name="clean">
+        <echo message="Removing ${build.dir}/classes/${componentName} and ${build.dir}/work/${componentName}"/>
+        <delete dir="${build.dir}/classes/${componentName}"/>
+        <delete dir="${build.dir}/work/${componentName}"/>
+    </target>
+
+    <target name="copy" depends="setenv"/>
+
+    <target name="compile" depends="copy" if="xmlbeans.present">
+        <echo message="Compiling samples.xbeans"/>
+
+        <taskdef name="xmlbean" 
+              classname="org.apache.xmlbeans.impl.tool.XMLBean" 
+              classpathref="classpath"/>
+
+        <xmlbean
+              schema="${axis.home}/samples/xbeans/starwars.xsd"
+              classgendir="${build.dest}"
+              failonerror="true"
+              classpathref="classpath"/>
+
+        <wsdl2java url="${axis.home}/samples/xbeans/starwars.wsdl"
+            output="${axis.home}/build/work"
+            serverSide="yes"
+            testcase="no">
+            <mapping namespace="http://superflaco.com/" package="samples.xbeans"/>
+            <nsexclude namespace="http://superflaco.com/xbeans"/>
+        </wsdl2java>
+
+        <replace file="${build.dir}/work/${componentName}/deploy.wsdd"
+            token="BeanSerializerFactory"
+            value="xbeans.XmlBeanSerializerFactory">
+        </replace>
+        <replace file="${build.dir}/work/${componentName}/deploy.wsdd"
+            token="BeanDeserializerFactory"
+            value="xbeans.XmlBeanDeserializerFactory">
+        </replace>
+        <replace file="${build.dir}/work/${componentName}/StarWarsBindingStub.java"
+            token="BeanSerializerFactory"
+            value="xbeans.XmlBeanSerializerFactory">
+        </replace>
+        <replace file="${build.dir}/work/${componentName}/StarWarsBindingStub.java"
+            token="BeanDeserializerFactory"
+            value="xbeans.XmlBeanDeserializerFactory">
+        </replace>
+        
+        <copy todir="${build.dir}/work/samples/xbeans" overwrite="yes">
+            <fileset dir="${axis.home}/samples/xbeans">
+                <include name="*Test*.java"/>
+                <include name="*Impl.java"/>
+            </fileset>
+        </copy>
+
+        <javac srcdir="${build.dir}/work" destdir="${build.dest}" debug="${debug}" nowarn="${nowarn}"
source="${source}" fork="${javac.fork}">
+            <classpath refid="classpath"/>
+            <include name="samples/xbeans/*.java"/>
+            <exclude name="samples/xbeans/*TestCase*" unless="junit.present"/>
+        </javac>
+    </target>
+
+    <target name="run">
+        <antcall target="execute-Component"/>
+    </target>
+
+</project>

Added: webservices/axis/trunk/java/samples/xbeans/starwars.wsdl
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/samples/xbeans/starwars.wsdl?rev=330452&view=auto
==============================================================================
--- webservices/axis/trunk/java/samples/xbeans/starwars.wsdl (added)
+++ webservices/axis/trunk/java/samples/xbeans/starwars.wsdl Wed Nov  2 21:00:57 2005
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://superflaco.com/" xmlns:flaco="http://superflaco.com/xbeans"
targetNamespace="http://superflaco.com/">
+	<types>
+		<xs:schema>
+			<xs:import namespace="http://superflaco.com/xbeans" schemaLocation="starwars.xsd"/>
+		</xs:schema>
+	</types>
+	<message name="getChewbeccaRequest"/>
+	<message name="getChewbeccaResponse">
+		<part name="response" element="flaco:character"/>
+	</message>
+	<message name="stashCharRequest">
+		<part name="request" element="flaco:character"/>
+	</message>
+	<message name="stashCharResponse">
+		<part name="response" element="flaco:character"/>
+	</message>
+	<portType name="StarWarsPortType">
+		<operation name="getChewbecca">
+			<input message="tns:getChewbeccaRequest"/>
+			<output message="tns:getChewbeccaResponse"/>
+		</operation>
+		<operation name="stashChar">
+			<input message="tns:stashCharRequest"/>
+			<output message="tns:stashCharResponse"/>
+		</operation>
+	</portType>
+	<binding name="StarWarsBinding" type="tns:StarWarsPortType">
+		<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+		<operation name="getChewbecca">
+			<input>
+				<soap:body use="literal"/>
+			</input>
+			<output>
+				<soap:body use="literal"/>
+			</output>
+		</operation>
+		<operation name="stashChar">
+			<input>
+				<soap:body use="literal"/>
+			</input>
+			<output>
+				<soap:body use="literal"/>
+			</output>
+		</operation>
+	</binding>
+	<service name="StarWars">
+		<port name="StarWarsPort" binding="tns:StarWarsBinding">
+			<soap:address location="http://localhost:8080/axis/services/StarWarsPort"/>
+		</port>
+	</service>
+</definitions>

Added: webservices/axis/trunk/java/samples/xbeans/starwars.xsd
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/samples/xbeans/starwars.xsd?rev=330452&view=auto
==============================================================================
--- webservices/axis/trunk/java/samples/xbeans/starwars.xsd (added)
+++ webservices/axis/trunk/java/samples/xbeans/starwars.xsd Wed Nov  2 21:00:57 2005
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:flaco="http://superflaco.com/xbeans"
targetNamespace="http://superflaco.com/xbeans" elementFormDefault="qualified">
+	<element name="character" type="flaco:character"/>
+	<element name="system" type="flaco:system"/>
+	<complexType name="character">
+		<sequence>
+			<element name="name" type="string"/>
+			<element name="home" type="flaco:system"/>
+			<element name="faction" type="string"/>
+			<element name="evil" type="boolean"/>
+			<element name="jedi" type="boolean"/>
+		</sequence>
+	</complexType>
+	<complexType name="system">
+		<sequence>
+			<element name="name" type="string"/>
+			<element name="planet" type="string" maxOccurs="unbounded"/>
+			<element name="star" type="string" maxOccurs="unbounded"/>
+		</sequence>
+	</complexType>
+</schema>



Mime
View raw message