diff options
Diffstat (limited to 'sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2')
12 files changed, 1170 insertions, 0 deletions
diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/build.xml b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/build.xml new file mode 100644 index 0000000000..2d9badbf87 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/build.xml @@ -0,0 +1,127 @@ +<project xmlns:xalan="http://xml.apache.org/xslt" default="jar.all" basedir="."> + <!--Auto generated ant build file--> + <property environment="env" /> + <!-- property name="axis2.home" value="${env.AXIS2_HOME}"/ --> + <property name="axis2.home" value="C:\Apache\axis2-std-0.94-bin" /> + <property name="axis2.class.path" value="" /> + <property name="name" value="HelloWorldServiceImplService" /> + <property name="src" value="${basedir}\src\main\java" /> + <property name="test" value="${basedir}\src\test\java" /> + <property name="build" value="${basedir}\target" /> + <property name="classes" value="${build}\classes" /> + <property name="lib" value="${build}\lib" /> + <property name="resources" value="${basedir}\src\main\resources" /> + <property value="" name="jars.ok" /> + <path id="axis2.class.path"> + <pathelement path="${java.class.path}" /> + <pathelement path="${axis2.class.path}" /> + <fileset dir="${axis2.home}"> + <include name="lib/*.jar" /> + </fileset> + </path> + <target name="init"> + <mkdir dir="${build}" /> + <mkdir dir="${classes}" /> + <mkdir dir="${lib}" /> + </target> + <target depends="init" name="pre.compile.test"> + <!--Test the classpath for the availability of necesary classes--> + <available classpathref="axis2.class.path" property="stax.available" classname="javax.xml.stream.XMLStreamReader" /> + <available classpathref="axis2.class.path" property="axis2.available" classname="org.apache.axis2.engine.AxisEngine" /> + <condition property="jars.ok"> + <and> + <isset property="stax.available" /> + <isset property="axis2.available" /> + </and> + </condition> + <!--Print out the availabilities--> + <echo message="Stax Availability= ${stax.available}" /> + <echo message="Axis2 Availability= ${axis2.available}" /> + </target> + <target depends="pre.compile.test" name="compile.all" if="jars.ok"> + <javac debug="on" destdir="${classes}" srcdir="${src}"> + <classpath refid="axis2.class.path" /> + </javac> + </target> + <target depends="pre.compile.test" name="compile.test" if="jars.ok"> + <javac debug="on" destdir="${classes}"> + <src path="${src}" /> + <src path="${test}" /> + <classpath refid="axis2.class.path" /> + </javac> + </target> + <target depends="pre.compile.test" name="echo.classpath.problem" unless="jars.ok"> + <echo message="The class path is not set right! Please make sure the following classes are in the classpath 1. XmlBeans 2. Stax 3. Axis2 " /> + </target> + <target depends="jar.server, jar.client" name="jar.all" /> + <target depends="compile.all,echo.classpath.problem" name="jar.server" if="jars.ok"> + <copy toDir="${classes}/META-INF"> + <fileset dir="${resources}"> + <include name="*.xml" /> + <include name="*.wsdl" /> + </fileset> + </copy> + <jar destfile="${lib}/${name}.aar"> + <fileset excludes="**/Test.class" dir="${classes}" /> + </jar> + </target> + <target if="jars.ok" depends="compile.test" name="jar.client"> + <jar destfile="${lib}/${name}-test-client.jar"> + <fileset dir="${classes}"> + <exclude name="**/META-INF/*.*" /> + <exclude name="**/lib/*.*" /> + <exclude name="**/*MessageReceiver.class" /> + <exclude name="**/*Skeleton.class" /> + </fileset> + <fileset dir="${resources}"> + <exclude name="**/*.wsdl" /> + <exclude name="**/*.xml" /> + </fileset> + </jar> + </target> + <target if="jars.ok" name="make.repo" depends="jar.server"> + <mkdir dir="${build}/repo/" /> + <mkdir dir="${build}/repo/services" /> + <copy file="${build}/lib/${name}.aar" toDir="${build}/repo/services/" /> + </target> + + <target if="jars.ok" name="check.server" depends="jar.server"> + <echo message="Checking if the HTTP server has beem started"/> + <waitfor maxwait="30" maxwaitunit="second" checkevery="10" timeoutproperty="server.notstarted"> + <http url="http://localhost:8080" /> + </waitfor> + <condition property="server.alreadystarted"> + <not> + <istrue value="${server.notstarted}" /> + </not> + </condition> + <echo message="HTTP server status: ${server.alreadystarted}"/> + </target> + + <target if="jars.ok" name="start.server" depends="check.server, make.repo" unless="server.alreadystarted"> + <java fork="true" spawn="true" classname="org.apache.axis2.transport.http.SimpleHTTPServer"> + <arg value="${build}/repo" /> + <classpath refid="axis2.class.path" /> + </java> + </target> + <target depends="compile.test" name="run.test" if="jars.ok"> + <property refid="axis2.class.path" name="axis2.class.path" /> + <path id="test.class.path"> + <pathelement location="${lib}/${name}-test-client.jar" /> + <pathelement path="${axis2.class.path}" /> + </path> + <mkdir dir="${build}/test-reports/" /> + <junit haltonfailure="yes" printsummary="yes"> + <classpath refid="test.class.path" /> + <formatter type="plain" /> + <batchtest fork="yes" toDir="${build}/test-reports/"> + <fileset dir="${test}"> + <include name="**/*Test*.java" /> + </fileset> + </batchtest> + </junit> + </target> + <target name="clean"> + <delete dir="${build}" /> + </target> +</project> diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/pom.xml b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/pom.xml new file mode 100644 index 0000000000..cdb6171241 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/pom.xml @@ -0,0 +1,205 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, as applicable. + * + * 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. +--> +<project> + <parent> + <groupId>org.apache.tuscany.samples.helloworld</groupId> + <artifactId>helloworld-samples</artifactId> + <version>SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>helloworldaxis2</artifactId> + <packaging>jar</packaging> + <name>Tuscany sample HelloWorld Axis2</name> + <description> + Sample classic helloworld Axis2 to test with Tuscany SCA + </description> + <version>SNAPSHOT</version> + + <!-- start new Axis2 stuff --> + <dependencies> + <dependency> + <groupId>axis2</groupId> + <artifactId>axis2-core</artifactId> + <version>0.94</version> + </dependency> + <dependency> + <groupId>axis2</groupId> + <artifactId>axis2-adb</artifactId> + <version>0.94</version> + </dependency> + <dependency> + <groupId>axis2</groupId> + <artifactId>axis2-doom</artifactId> + <version>0.94</version> + </dependency> + <dependency> + <groupId>geronimo-spec</groupId> + <artifactId>geronimo-spec-activation</artifactId> + <version>1.0.2-rc4</version> + </dependency> + <dependency> + <groupId>geronimo-spec</groupId> + <artifactId>geronimo-spec-javamail</artifactId> + <version>1.3.1-rc5</version> + </dependency> + <dependency> + <groupId>geronimo-spec</groupId> + <artifactId>geronimo-spec-jms</artifactId> + <version>1.1-rc4</version> + </dependency> + + <dependency> + <groupId>axis2</groupId> + <artifactId>addressing</artifactId> + <version>0.94</version> + <type>mar</type> + </dependency> + <!-- external JARs --> + <dependency> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + <version>1.0.4</version> + </dependency> + <dependency> + <groupId>commons-httpclient</groupId> + <artifactId>commons-httpclient</artifactId> + <version>3.0</version> + </dependency> + <dependency> + <groupId>commons-codec</groupId> + <artifactId>commons-codec</artifactId> + <version>1.3</version> + </dependency> + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <version>1.2.12</version> + </dependency> + <dependency> + <groupId>woodstox</groupId> + <artifactId>wstx-asl</artifactId> + <version>2.8.2</version> + </dependency> + <dependency> + <groupId>stax</groupId> + <artifactId>stax-api</artifactId> + <version>1.0</version> + </dependency> + <dependency> + <groupId>axis</groupId> + <artifactId>axis-wsdl4j</artifactId> + <version>1.2</version> + </dependency> + <dependency> + <groupId>ws-commons</groupId> + <artifactId>ws-policy</artifactId> + <version>SNAPSHOT</version> + </dependency> + + <!-- + <dependency> + <groupId>wss4j</groupId> + <artifactId>wss4j</artifactId> + <version>SNAPSHOT</version> + </dependency> + <dependency> + <groupId>xml-security</groupId> + <artifactId>xmlsec</artifactId> + <version>1.2.1}</version> + </dependency> + <dependency> + <groupId>bouncycastle</groupId> + <artifactId>bcprov</artifactId> + <version>jdk13-128</version> + </dependency> + <dependency> + <groupId>opensaml</groupId> + <artifactId>opensaml</artifactId> + <version>1.0.1</version> + </dependency> + --> + <dependency> + <groupId>xml-apis</groupId> + <artifactId>xml-apis</artifactId> + <version>1.3.02</version> + </dependency> + <dependency> + <groupId>jaxen</groupId> + <artifactId>jaxen</artifactId> + <version>1.1-beta-7</version> + </dependency> + <dependency> + <groupId>backport-util-concurrent</groupId> + <artifactId>backport-util-concurrent</artifactId> + <version>2.0_01_pd</version> + </dependency> + <!--for java2wsdl generation we use JAM , so there should be a dependency on the annogen jar or--> + <!--XML Beans--> + <dependency> + <groupId>annogen</groupId> + <artifactId>annogen</artifactId> + <version>0.1.0</version> + </dependency> + <dependency> + <groupId>xmlbeans</groupId> + <artifactId>xbean</artifactId> + <version>2.1.0</version> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <scope>test</scope> + </dependency> + </dependencies> + + <!-- + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-antrun-plugin</artifactId> + <executions> + <execution> + <id>compile</id> + <phase>compile</phase> + <configuration> + <tasks> + <ant antfile="${basedir}/build.xml" + inheritRefs="true"> + <target name="start.server" /> + </ant> + <waitfor maxwait="60" + maxwaitunit="second" checkevery="30"> + <http + url="http://localhost:8080" /> + </waitfor> + + </tasks> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + --> + +</project> diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/java/org/apache/tuscany/samples/helloworldaxis/GetGreetings.java b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/java/org/apache/tuscany/samples/helloworldaxis/GetGreetings.java new file mode 100644 index 0000000000..a7c332f9e7 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/java/org/apache/tuscany/samples/helloworldaxis/GetGreetings.java @@ -0,0 +1,94 @@ +/** + * GetGreetings.java This file was auto-generated from WSDL by the Apache Axis2 + * version: #axisVersion# #today# + */ +package org.apache.tuscany.samples.helloworldaxis; + +/** + * GetGreetings bean class + */ +public class GetGreetings implements org.apache.axis2.databinding.ADBBean { + public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName("http://helloworldaxis.samples.tuscany.apache.org", + "getGreetings", "ns1"); + + /** field for In0 */ + private java.lang.String localIn0; + + /** + * Auto generated getter method + * + * @return java.lang.String + */ + public java.lang.String getIn0() { + return localIn0; + } + + /** + * Auto generated setter method + * + * @param param In0 + */ + public void setIn0(java.lang.String param) { + this.localIn0 = param; + } + + /** + * databinding method to get an XML representation of this object + */ + public javax.xml.stream.XMLStreamReader getPullParser( + javax.xml.namespace.QName qName) { + java.util.ArrayList elementList = new java.util.ArrayList(); + java.util.ArrayList attribList = new java.util.ArrayList(); + + elementList.add(new javax.xml.namespace.QName( + "http://helloworldaxis.samples.tuscany.apache.org", "in0")); + elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + localIn0)); + + return org.apache.axis2.databinding.utils.ADBPullParser.createPullParser(qName, + elementList.toArray(), attribList.toArray()); + } + + /** + * static method to create the object Note - This is not complete + */ + public static GetGreetings parse(javax.xml.stream.XMLStreamReader reader) + throws java.lang.Exception { + GetGreetings object = new GetGreetings(); + + try { + int event = reader.getEventType(); + int count = 0; + int argumentCount = 1; + boolean done = false; + + //event better be a START_ELEMENT. if not we should go up to the start element here + while (!reader.isStartElement()) { + event = reader.next(); + } + + while (!done) { + if (javax.xml.stream.XMLStreamConstants.START_ELEMENT == event) { + if ("in0".equals(reader.getLocalName())) { + String content = reader.getElementText(); + object.setIn0(org.apache.axis2.databinding.utils.ConverterUtil.convertTostring( + content)); + count++; + } + } + + if (argumentCount == count) { + done = true; + } + + if (!done) { + event = reader.next(); + } + } + } catch (javax.xml.stream.XMLStreamException e) { + throw new java.lang.Exception(e); + } + + return object; + } +} diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/java/org/apache/tuscany/samples/helloworldaxis/GetGreetingsResponse.java b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/java/org/apache/tuscany/samples/helloworldaxis/GetGreetingsResponse.java new file mode 100644 index 0000000000..8cee6c1e93 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/java/org/apache/tuscany/samples/helloworldaxis/GetGreetingsResponse.java @@ -0,0 +1,96 @@ +/** + * GetGreetingsResponse.java This file was auto-generated from WSDL by the + * Apache Axis2 version: #axisVersion# #today# + */ +package org.apache.tuscany.samples.helloworldaxis; + +/** + * GetGreetingsResponse bean class + */ +public class GetGreetingsResponse + implements org.apache.axis2.databinding.ADBBean { + public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName("http://helloworldaxis.samples.tuscany.apache.org", + "getGreetingsResponse", "ns1"); + + /** field for GetGreetingsReturn */ + private java.lang.String localGetGreetingsReturn; + + /** + * Auto generated getter method + * + * @return java.lang.String + */ + public java.lang.String getGetGreetingsReturn() { + return localGetGreetingsReturn; + } + + /** + * Auto generated setter method + * + * @param param GetGreetingsReturn + */ + public void setGetGreetingsReturn(java.lang.String param) { + this.localGetGreetingsReturn = param; + } + + /** + * databinding method to get an XML representation of this object + */ + public javax.xml.stream.XMLStreamReader getPullParser( + javax.xml.namespace.QName qName) { + java.util.ArrayList elementList = new java.util.ArrayList(); + java.util.ArrayList attribList = new java.util.ArrayList(); + + elementList.add(new javax.xml.namespace.QName( + "http://helloworldaxis.samples.tuscany.apache.org", + "getGreetingsReturn")); + elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString( + localGetGreetingsReturn)); + + return org.apache.axis2.databinding.utils.ADBPullParser.createPullParser(qName, + elementList.toArray(), attribList.toArray()); + } + + /** + * static method to create the object Note - This is not complete + */ + public static GetGreetingsResponse parse( + javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception { + GetGreetingsResponse object = new GetGreetingsResponse(); + + try { + int event = reader.getEventType(); + int count = 0; + int argumentCount = 1; + boolean done = false; + + //event better be a START_ELEMENT. if not we should go up to the start element here + while (!reader.isStartElement()) { + event = reader.next(); + } + + while (!done) { + if (javax.xml.stream.XMLStreamConstants.START_ELEMENT == event) { + if ("getGreetingsReturn".equals(reader.getLocalName())) { + String content = reader.getElementText(); + object.setGetGreetingsReturn(org.apache.axis2.databinding.utils.ConverterUtil.convertTostring( + content)); + count++; + } + } + + if (argumentCount == count) { + done = true; + } + + if (!done) { + event = reader.next(); + } + } + } catch (javax.xml.stream.XMLStreamException e) { + throw new java.lang.Exception(e); + } + + return object; + } +} diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/java/org/apache/tuscany/samples/helloworldaxis/HelloWorldServiceImplCallbackHandler.java b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/java/org/apache/tuscany/samples/helloworldaxis/HelloWorldServiceImplCallbackHandler.java new file mode 100644 index 0000000000..ee30587946 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/java/org/apache/tuscany/samples/helloworldaxis/HelloWorldServiceImplCallbackHandler.java @@ -0,0 +1,39 @@ +/** + * HelloWorldServiceImplCallbackHandler.java This file was auto-generated from + * WSDL by the Apache Axis2 version: 0.94-SNAPSHOT Jan 10, 2006 (10:21:58 LKT) + */ +package org.apache.tuscany.samples.helloworldaxis; + +/** + * HelloWorldServiceImplCallbackHandler Callback class + */ +public abstract class HelloWorldServiceImplCallbackHandler { + private Object clientData; + + /** + * User can pass in any object that needs to be accessed once the + * NonBlocking Web service call is finished and appropreate method of + * this CallBack is called. + * + * @param clientData Object mechanism by which the user can pass in user + * data that will be avilable at the time this callback is called. + */ + public HelloWorldServiceImplCallbackHandler(Object clientData) { + this.clientData = clientData; + } + + /** + * auto generated Axis2 call back method for getGreetings method + */ + public void receiveResultgetGreetings( + org.apache.tuscany.samples.helloworldaxis.GetGreetingsResponse param9) { + //Fill here with the code to handle the response + } + + /** + * auto generated Axis2 Error handler + */ + public void receiveErrorgetGreetings(java.lang.Exception e) { + //Fill here with the code to handle the exception + } +} diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/java/org/apache/tuscany/samples/helloworldaxis/HelloWorldServiceImplMessageReceiver.java b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/java/org/apache/tuscany/samples/helloworldaxis/HelloWorldServiceImplMessageReceiver.java new file mode 100644 index 0000000000..90e9af80b2 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/java/org/apache/tuscany/samples/helloworldaxis/HelloWorldServiceImplMessageReceiver.java @@ -0,0 +1,146 @@ +/** + * HelloWorldServiceImplMessageReceiver.java This file was auto-generated from + * WSDL by the Apache Axis2 version: 0.94-SNAPSHOT Jan 10, 2006 (10:21:58 LKT) + */ +package org.apache.tuscany.samples.helloworldaxis; + +/** + * HelloWorldServiceImplMessageReceiver message receiver + */ +public class HelloWorldServiceImplMessageReceiver + extends org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver { + public void invokeBusinessLogic( + org.apache.axis2.context.MessageContext msgContext, + org.apache.axis2.context.MessageContext newMsgContext) + throws org.apache.axis2.AxisFault { + try { + // get the implementation class for the Web Service + Object obj = getTheImplementationObject(msgContext); + + //Inject the Message Context if it is asked for + org.apache.axis2.engine.DependencyManager.configureBusinessLogicProvider(obj, + msgContext, newMsgContext); + + HelloWorldServiceImplSkeleton skel = (HelloWorldServiceImplSkeleton) obj; + + //Out Envelop + org.apache.axis2.soap.SOAPEnvelope envelope = null; + + //Find the axisOperation that has been set by the Dispatch phase. + org.apache.axis2.description.AxisOperation op = msgContext.getOperationContext() + .getAxisOperation(); + + if (op == null) { + throw new org.apache.axis2.AxisFault( + "Operation is not located, if this is doclit style the SOAP-ACTION should specified via the SOAP Action to use the RawXMLProvider"); + } + + String methodName; + + if ((op.getName() != null) & + ((methodName = op.getName().getLocalPart()) != null)) { + if ("getGreetings".equals(methodName)) { + org.apache.tuscany.samples.helloworldaxis.GetGreetingsResponse param5 = + null; + + //doc style + param5 = skel.getGreetings((org.apache.tuscany.samples.helloworldaxis.GetGreetings) fromOM( + msgContext.getEnvelope().getBody() + .getFirstElement(), + org.apache.tuscany.samples.helloworldaxis.GetGreetings.class)); + + envelope = toEnvelope(getSOAPFactory(msgContext), param5); + } + + newMsgContext.setEnvelope(envelope); + } + } catch (Exception e) { + throw org.apache.axis2.AxisFault.makeFault(e); + } + } + + // + private org.apache.axis2.om.OMElement toOM( + org.apache.tuscany.samples.helloworldaxis.GetGreetings param) { + if (param instanceof org.apache.axis2.databinding.ADBBean) { + org.apache.axis2.om.impl.llom.builder.StAXOMBuilder builder = new org.apache.axis2.om.impl.llom.builder.StAXOMBuilder(org.apache.axis2.om.OMAbstractFactory.getOMFactory(), + param.getPullParser( + org.apache.tuscany.samples.helloworldaxis.GetGreetings.MY_QNAME)); + org.apache.axis2.om.OMElement documentElement = builder.getDocumentElement(); + ((org.apache.axis2.om.impl.OMNodeEx) documentElement).setParent(null); // remove the parent link + + return documentElement; + } else { + //todo finish this onece the bean serializer has the necessary methods + return null; + } + } + + private org.apache.axis2.soap.SOAPEnvelope toEnvelope( + org.apache.axis2.soap.SOAPFactory factory, + org.apache.tuscany.samples.helloworldaxis.GetGreetings param) { + if (param instanceof org.apache.axis2.databinding.ADBBean) { + org.apache.axis2.databinding.ADBSOAPModelBuilder builder = new org.apache.axis2.databinding.ADBSOAPModelBuilder(param.getPullParser( + org.apache.tuscany.samples.helloworldaxis.GetGreetings.MY_QNAME), + factory); + + return builder.getEnvelope(); + } else { + //todo finish this onece the bean serializer has the necessary methods + return null; + } + } + + private org.apache.axis2.om.OMElement toOM( + org.apache.tuscany.samples.helloworldaxis.GetGreetingsResponse param) { + if (param instanceof org.apache.axis2.databinding.ADBBean) { + org.apache.axis2.om.impl.llom.builder.StAXOMBuilder builder = new org.apache.axis2.om.impl.llom.builder.StAXOMBuilder(org.apache.axis2.om.OMAbstractFactory.getOMFactory(), + param.getPullParser( + org.apache.tuscany.samples.helloworldaxis.GetGreetingsResponse.MY_QNAME)); + org.apache.axis2.om.OMElement documentElement = builder.getDocumentElement(); + ((org.apache.axis2.om.impl.OMNodeEx) documentElement).setParent(null); // remove the parent link + + return documentElement; + } else { + //todo finish this onece the bean serializer has the necessary methods + return null; + } + } + + private org.apache.axis2.soap.SOAPEnvelope toEnvelope( + org.apache.axis2.soap.SOAPFactory factory, + org.apache.tuscany.samples.helloworldaxis.GetGreetingsResponse param) { + if (param instanceof org.apache.axis2.databinding.ADBBean) { + org.apache.axis2.databinding.ADBSOAPModelBuilder builder = new org.apache.axis2.databinding.ADBSOAPModelBuilder(param.getPullParser( + org.apache.tuscany.samples.helloworldaxis.GetGreetingsResponse.MY_QNAME), + factory); + + return builder.getEnvelope(); + } else { + //todo finish this onece the bean serializer has the necessary methods + return null; + } + } + + private java.lang.Object fromOM(org.apache.axis2.om.OMElement param, + java.lang.Class type) { + Object obj; + + try { + java.lang.reflect.Method parseMethod = type.getMethod("parse", + new Class[] { javax.xml.stream.XMLStreamReader.class }); + obj = null; + + if (parseMethod != null) { + obj = parseMethod.invoke(null, + new Object[] { param.getXMLStreamReaderWithoutCaching() }); + } else { + //oops! we don't know how to deal with this. Perhaps the reflective one is a good choice here + } + } catch (Exception e) { + throw new RuntimeException(e); + } + + return obj; + } +} diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/java/org/apache/tuscany/samples/helloworldaxis/HelloWorldServiceImplSkeleton.java b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/java/org/apache/tuscany/samples/helloworldaxis/HelloWorldServiceImplSkeleton.java new file mode 100644 index 0000000000..7796e08873 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/java/org/apache/tuscany/samples/helloworldaxis/HelloWorldServiceImplSkeleton.java @@ -0,0 +1,24 @@ +/** + * HelloWorldServiceImplSkeleton.java This file was auto-generated from WSDL by + * the Apache Axis2 version: 0.94-SNAPSHOT Jan 10, 2006 (10:21:58 LKT) + */ +package org.apache.tuscany.samples.helloworldaxis; + +/** + * HelloWorldServiceImplSkeleton java skeleton for the axisService + */ +public class HelloWorldServiceImplSkeleton +{ + /** + * Auto generated method signature + * + * @param greetings + */ + public org.apache.tuscany.samples.helloworldaxis.GetGreetingsResponse getGreetings( + org.apache.tuscany.samples.helloworldaxis.GetGreetings greetings ) + { + GetGreetingsResponse response = new GetGreetingsResponse(); + response.setGetGreetingsReturn( "Greeting: " + greetings.getIn0() ); + return response; + } +} diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/java/org/apache/tuscany/samples/helloworldaxis/HelloWorldServiceImplStub.java b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/java/org/apache/tuscany/samples/helloworldaxis/HelloWorldServiceImplStub.java new file mode 100644 index 0000000000..440a5aa36f --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/java/org/apache/tuscany/samples/helloworldaxis/HelloWorldServiceImplStub.java @@ -0,0 +1,269 @@ +/** + * HelloWorldServiceImplStub.java This file was auto-generated from WSDL by the + * Apache Axis2 version: 0.94-SNAPSHOT Jan 10, 2006 (10:21:58 LKT) + */ +package org.apache.tuscany.samples.helloworldaxis; + +/* + * HelloWorldServiceImplStub java implementation + */ +public class HelloWorldServiceImplStub + extends org.apache.axis2.client.Stub +{ + //default axis home being null forces the system to pick up the mars from the axis2 library + public static final String AXIS2_HOME = null; + + protected static org.apache.axis2.description.AxisOperation[] _operations; + + static + { + //creating the Service + _service = new org.apache.axis2.description.AxisService( "HelloWorldServiceImpl" ); + + //creating the operations + org.apache.axis2.description.AxisOperation __operation; + _operations = new org.apache.axis2.description.OutInAxisOperation[1]; + + __operation = new org.apache.axis2.description.OutInAxisOperation(); + __operation.setName( new javax.xml.namespace.QName( "http://helloworldaxis.samples.tuscany.apache.org", + "getGreetings" ) ); + _operations[0] = __operation; + _service.addOperation( __operation ); + } + + public HelloWorldServiceImplStub( org.apache.axis2.context.ConfigurationContext configurationContext, + String targetEndpoint ) + throws java.lang.Exception + { + _serviceClient = new org.apache.axis2.client.ServiceClient( configurationContext, _service ); + _serviceClient.getOptions().setTo( new org.apache.axis2.addressing.EndpointReference( targetEndpoint ) ); + } + + /** + * Default Constructor + */ + public HelloWorldServiceImplStub() + throws java.lang.Exception + { + this( "http://localhost:8080/axis2/services/HelloWorldServiceImplService" ); + } + + /** + * Constructor taking the traget endpoint + */ + public HelloWorldServiceImplStub( String targetEndpoint ) + throws java.lang.Exception + { + this( new org.apache.axis2.context.ConfigurationContextFactory() + .createConfigurationContextFromFileSystem( AXIS2_HOME ), targetEndpoint ); + } + + /** + * Auto generated method signature + * + * @param param10 + * + * @see org.apache.tuscany.samples.helloworldaxis.HelloWorldServiceImpl#getGreetings + */ + public org.apache.tuscany.samples.helloworldaxis.GetGreetingsResponse getGreetings( + org.apache.tuscany.samples.helloworldaxis.GetGreetings param10 ) + throws java.rmi.RemoteException + { + org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient( _operations[0] + .getName() ); + _operationClient.getOptions().setSoapAction( "" ); + _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault( true ); + + // create SOAP envelope with that payload + org.apache.axis2.soap.SOAPEnvelope env = null; + + //Style is Doc. + env = toEnvelope( getFactory( _options.getSoapVersionURI() ), param10 ); + + // create message context with that soap envelope + org.apache.axis2.context.MessageContext _messageContext = new org.apache.axis2.context.MessageContext(); + _messageContext.setEnvelope( env ); + + // add the message contxt to the operation client + _operationClient.addMessageContext( _messageContext ); + + //set the options hierarchy + _options.setParent( _operationClient.getOptions() ); + _operationClient.setOptions( _options ); + + //execute the operation client + _operationClient.execute( true ); + + org.apache.axis2.context.MessageContext _returnMessageContext = _operationClient + .getMessageContext( org.apache.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE ); + org.apache.axis2.soap.SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope(); + + java.lang.Object object = fromOM( getElement( _returnEnv, "doc" ), + org.apache.tuscany.samples.helloworldaxis.GetGreetingsResponse.class ); + + return (org.apache.tuscany.samples.helloworldaxis.GetGreetingsResponse) object; + } + + /** + * Auto generated method signature for Asynchronous Invocations + * + * @param param10 + * + * @see org.apache.tuscany.samples.helloworldaxis.HelloWorldServiceImpl#startgetGreetings + */ + public void startgetGreetings( + org.apache.tuscany.samples.helloworldaxis.GetGreetings param10, + final org.apache.tuscany.samples.helloworldaxis.HelloWorldServiceImplCallbackHandler callback ) + throws java.rmi.RemoteException + { + org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient( _operations[0] + .getName() ); + _operationClient.getOptions().setSoapAction( "" ); + _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault( true ); + + // create SOAP envelope with that payload + org.apache.axis2.soap.SOAPEnvelope env; + + //Style is Doc. + env = toEnvelope( getFactory( _options.getSoapVersionURI() ), param10 ); + + // create message context with that soap envelope + org.apache.axis2.context.MessageContext _messageContext = new org.apache.axis2.context.MessageContext(); + _messageContext.setEnvelope( env ); + + // add the message contxt to the operation client + _operationClient.addMessageContext( _messageContext ); + + //set the options hierarchy + _options.setParent( _operationClient.getOptions() ); + _operationClient.setOptions( _options ); + + _operationClient.setCallback( new org.apache.axis2.client.async.Callback() + { + public void onComplete( org.apache.axis2.client.async.AsyncResult result ) + { + java.lang.Object object = fromOM( getElement( result.getResponseEnvelope(), "doc" ), + org.apache.tuscany.samples.helloworldaxis.GetGreetingsResponse.class ); + callback + .receiveResultgetGreetings( (org.apache.tuscany.samples.helloworldaxis.GetGreetingsResponse) object ); + } + + public void onError( java.lang.Exception e ) + { + callback.receiveErrorgetGreetings( e ); + } + } ); + + //execute the operation client + _operationClient.execute( true ); + } + + //http://localhost:8080/axis2/services/HelloWorldServiceImplService + private org.apache.axis2.om.OMElement toOM( org.apache.tuscany.samples.helloworldaxis.GetGreetings param ) + { + if ( param instanceof org.apache.axis2.databinding.ADBBean ) + { + org.apache.axis2.om.impl.llom.builder.StAXOMBuilder builder = new org.apache.axis2.om.impl.llom.builder.StAXOMBuilder( + org.apache.axis2.om.OMAbstractFactory + .getOMFactory(), + param + .getPullParser( org.apache.tuscany.samples.helloworldaxis.GetGreetings.MY_QNAME ) ); + org.apache.axis2.om.OMElement documentElement = builder.getDocumentElement(); + ( (org.apache.axis2.om.impl.OMNodeEx) documentElement ).setParent( null ); // remove the parent link + + return documentElement; + } + else + { + //todo finish this onece the bean serializer has the necessary methods + return null; + } + } + + private org.apache.axis2.soap.SOAPEnvelope toEnvelope( org.apache.axis2.soap.SOAPFactory factory, + org.apache.tuscany.samples.helloworldaxis.GetGreetings param ) + { + if ( param instanceof org.apache.axis2.databinding.ADBBean ) + { + org.apache.axis2.databinding.ADBSOAPModelBuilder builder = new org.apache.axis2.databinding.ADBSOAPModelBuilder( + param + .getPullParser( org.apache.tuscany.samples.helloworldaxis.GetGreetings.MY_QNAME ), + factory ); + + return builder.getEnvelope(); + } + else + { + //todo finish this onece the bean serializer has the necessary methods + return null; + } + } + + private org.apache.axis2.om.OMElement toOM( org.apache.tuscany.samples.helloworldaxis.GetGreetingsResponse param ) + { + if ( param instanceof org.apache.axis2.databinding.ADBBean ) + { + org.apache.axis2.om.impl.llom.builder.StAXOMBuilder builder = new org.apache.axis2.om.impl.llom.builder.StAXOMBuilder( + org.apache.axis2.om.OMAbstractFactory + .getOMFactory(), + param + .getPullParser( org.apache.tuscany.samples.helloworldaxis.GetGreetingsResponse.MY_QNAME ) ); + org.apache.axis2.om.OMElement documentElement = builder.getDocumentElement(); + ( (org.apache.axis2.om.impl.OMNodeEx) documentElement ).setParent( null ); // remove the parent link + + return documentElement; + } + else + { + //todo finish this onece the bean serializer has the necessary methods + return null; + } + } + + private org.apache.axis2.soap.SOAPEnvelope toEnvelope( + org.apache.axis2.soap.SOAPFactory factory, + org.apache.tuscany.samples.helloworldaxis.GetGreetingsResponse param ) + { + if ( param instanceof org.apache.axis2.databinding.ADBBean ) + { + org.apache.axis2.databinding.ADBSOAPModelBuilder builder = new org.apache.axis2.databinding.ADBSOAPModelBuilder( + param + .getPullParser( org.apache.tuscany.samples.helloworldaxis.GetGreetingsResponse.MY_QNAME ), + factory ); + + return builder.getEnvelope(); + } + else + { + //todo finish this onece the bean serializer has the necessary methods + return null; + } + } + + private java.lang.Object fromOM( org.apache.axis2.om.OMElement param, java.lang.Class type ) + { + Object obj; + + try + { + java.lang.reflect.Method parseMethod = type + .getMethod( "parse", new Class[] { javax.xml.stream.XMLStreamReader.class } ); + obj = null; + + if ( parseMethod != null ) + { + obj = parseMethod.invoke( null, new Object[] { param.getXMLStreamReaderWithoutCaching() } ); + } + else + { + //oops! we don't know how to deal with this. Perhaps the reflective one is a good choice here + } + } + catch ( Exception e ) + { + throw new RuntimeException( e ); + } + + return obj; + } +} diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/resources/helloworld.wsdl b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/resources/helloworld.wsdl new file mode 100644 index 0000000000..79bd6e45a0 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/resources/helloworld.wsdl @@ -0,0 +1,97 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ 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.
+ -->
+<wsdl:definitions targetNamespace="http://helloworldaxis.samples.tuscany.apache.org" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://helloworldaxis.samples.tuscany.apache.org" xmlns:intf="http://helloworldaxis.samples.tuscany.apache.org" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <!--WSDL created by Apache Axis version: 1.2.1
+Built on Jun 14, 2005 (09:15:57 EDT)-->
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworldaxis.samples.tuscany.apache.org" xmlns="http://www.w3.org/2001/XMLSchema">
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="in0" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+
+ <wsdl:part element="impl:getGreetings" name="parameters"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+
+ <wsdl:part element="impl:getGreetingsResponse" name="parameters"/>
+
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorldServiceImpl">
+
+ <wsdl:operation name="getGreetings">
+
+ <wsdl:input message="impl:getGreetingsRequest" name="getGreetingsRequest"/>
+
+ <wsdl:output message="impl:getGreetingsResponse" name="getGreetingsResponse"/>
+
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+ <wsdl:binding name="helloworldSoapBinding" type="impl:HelloWorldServiceImpl">
+
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+
+ <wsdl:operation name="getGreetings">
+
+ <wsdlsoap:operation soapAction=""/>
+
+ <wsdl:input name="getGreetingsRequest">
+
+ <wsdlsoap:body use="literal"/>
+
+ </wsdl:input>
+
+ <wsdl:output name="getGreetingsResponse">
+
+ <wsdlsoap:body use="literal"/>
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldServiceImplService">
+
+ <wsdl:port binding="impl:helloworldSoapBinding" name="helloworld">
+
+ <wsdlsoap:address location="http://localhost:8080/axis2/services/HelloWorldServiceImplService"/>
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/resources/services.xml b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/resources/services.xml new file mode 100644 index 0000000000..18d83e759e --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/main/resources/services.xml @@ -0,0 +1,7 @@ +<service xmlns:xalan="http://xml.apache.org/xslt" name="HelloWorldServiceImplService"> + <messageReceivers> + <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out" class="org.apache.tuscany.samples.helloworldaxis.HelloWorldServiceImplMessageReceiver"/> + </messageReceivers> + <parameter locked="false" name="ServiceClass">org.apache.tuscany.samples.helloworldaxis.HelloWorldServiceImplSkeleton</parameter> + <!--All public methods of the service class are exposed by default--> +</service> diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/test/java/META-INF/MANIFEST.MF b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/test/java/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..5e9495128c --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/test/java/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0
+Class-Path:
+
diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/test/java/org/apache/tuscany/samples/helloworldaxis/HelloWorldServiceImplTest.java b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/test/java/org/apache/tuscany/samples/helloworldaxis/HelloWorldServiceImplTest.java new file mode 100644 index 0000000000..149c3d2390 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/helloworld/helloworldaxis2/src/test/java/org/apache/tuscany/samples/helloworldaxis/HelloWorldServiceImplTest.java @@ -0,0 +1,63 @@ +/** + * HelloWorldServiceImplTest.java This file was auto-generated from WSDL by the + * Apache Axis2 version: 0.94-SNAPSHOT Jan 10, 2006 (10:21:58 LKT) + */ +package org.apache.tuscany.samples.helloworldaxis; + + +/* + * HelloWorldServiceImplTest Junit test case +*/ +public class HelloWorldServiceImplTest extends junit.framework.TestCase { + +//FIXME we don't want to run this test as part of the main build, AXIS2 is not necessarily set up to run it + /** + * Auto generated test method + */ + public void testgetGreetings() throws java.lang.Exception { +// org.apache.tuscany.samples.helloworldaxis.HelloWorldServiceImplStub stub = +// new org.apache.tuscany.samples.helloworldaxis.HelloWorldServiceImplStub("http://localhost:8080/axis2/services/HelloWorldServiceImplService"); //the default implementation should point to the right endpoint +// +// org.apache.tuscany.samples.helloworldaxis.GetGreetings param14 = (org.apache.tuscany.samples.helloworldaxis.GetGreetings) getTestObject(org.apache.tuscany.samples.helloworldaxis.GetGreetings.class); +// param14.setIn0("Hello, World!"); +// +// // todo Fill in the param14 here +// assertNotNull(stub.getGreetings(param14)); + } + + /** + * Auto generated test method + */ + public void testStartgetGreetings() throws java.lang.Exception { +// org.apache.tuscany.samples.helloworldaxis.HelloWorldServiceImplStub stub = +// new org.apache.tuscany.samples.helloworldaxis.HelloWorldServiceImplStub("http://localhost:8080/axis2/services/HelloWorldServiceImplService"); +// org.apache.tuscany.samples.helloworldaxis.GetGreetings param14 = (org.apache.tuscany.samples.helloworldaxis.GetGreetings) getTestObject(org.apache.tuscany.samples.helloworldaxis.GetGreetings.class); +// param14.setIn0("Hello, World!"); +// +// // todo Fill in the param14 here +// stub.startgetGreetings(param14, new tempCallbackN1000C()); + } + + //Create an ADBBean and provide it as the test object + public org.apache.axis2.databinding.ADBBean getTestObject( + java.lang.Class type) throws Exception { + return (org.apache.axis2.databinding.ADBBean) type.newInstance(); + } + + private class tempCallbackN1000C + extends org.apache.tuscany.samples.helloworldaxis.HelloWorldServiceImplCallbackHandler { + public tempCallbackN1000C() { + super(null); + } + + public void receiveResultgetGreetings( + org.apache.axis2.client.async.AsyncResult result) { + assertNotNull(result.getResponseEnvelope().getBody() + .getFirstElement()); + } + + public void receiveErrorgetGreetings(java.lang.Exception e) { + fail(); + } + } +} |