You are viewing a plain text version of this content. The canonical link for it is here.
Posted to sandesha-dev@ws.apache.org by ch...@apache.org on 2007/04/24 06:57:45 UTC
svn commit: r531722 [1/4] - in /webservices/sandesha/trunk/java: ./
modules/client/ modules/core/ modules/interop/ modules/interop/src/
modules/interop/src/main/ modules/interop/src/main/java/
modules/interop/src/main/java/org/ modules/interop/src/main...
Author: chamikara
Date: Mon Apr 23 21:57:43 2007
New Revision: 531722
URL: http://svn.apache.org/viewvc?view=rev&rev=531722
Log:
More changes for the maven2 build - Added the interop module
Added:
webservices/sandesha/trunk/java/modules/interop/src/
webservices/sandesha/trunk/java/modules/interop/src/main/
webservices/sandesha/trunk/java/modules/interop/src/main/java/
webservices/sandesha/trunk/java/modules/interop/src/main/java/org/
webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/
webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/
webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/
webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/PWCallback.java
webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/RMInteropServiceCallbackHandler.java
webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/RMInteropServiceCallbackHandlerImpl.java
webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/RMInteropServiceMessageReceiverInOnly.java
webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/RMInteropServiceMessageReceiverInOut.java
webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/RMInteropServiceSkeleton.java
webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/RMInteropServiceSkeletonImpl.java
webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/RMInteropServiceStub.java
webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/
webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_1_1.java
webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_1_2.java
webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_1_3.java
webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_1_4.java
webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_2_1.java
webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_2_2.java
webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_2_3.java
webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_3_1.java
webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_4_1.java
webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_4_2.java
webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/securerm/
webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/securerm/SecRMServiceImpl.java
webservices/sandesha/trunk/java/modules/interop/src/main/java/org/tempuri/
webservices/sandesha/trunk/java/modules/interop/src/main/java/org/tempuri/EchoString.java
webservices/sandesha/trunk/java/modules/interop/src/main/java/org/tempuri/EchoStringRequestBodyType.java
webservices/sandesha/trunk/java/modules/interop/src/main/java/org/tempuri/EchoStringResponse.java
webservices/sandesha/trunk/java/modules/interop/src/main/java/org/tempuri/EchoStringResponseBodyType.java
webservices/sandesha/trunk/java/modules/interop/src/main/java/org/tempuri/ExtensionMapper.java
webservices/sandesha/trunk/java/modules/interop/src/main/java/org/tempuri/Ping.java
webservices/sandesha/trunk/java/modules/interop/src/resources/
webservices/sandesha/trunk/java/modules/interop/src/resources/conf/
webservices/sandesha/trunk/java/modules/interop/src/resources/conf/RMInteropService.wsdl
webservices/sandesha/trunk/java/modules/interop/src/resources/conf/SecRMInteropService.wsdl
webservices/sandesha/trunk/java/modules/interop/src/resources/conf/sandesha2_interop.properties
webservices/sandesha/trunk/java/modules/interop/src/resources/conf/sec-client-axis2.xml
webservices/sandesha/trunk/java/modules/interop/src/resources/conf/sec-client-policy.xml
webservices/sandesha/trunk/java/modules/interop/src/resources/conf/sec-services.xml
webservices/sandesha/trunk/java/modules/interop/src/resources/conf/services.xml
webservices/sandesha/trunk/java/modules/interop/src/resources/conf/store.jks (with props)
Modified:
webservices/sandesha/trunk/java/maven.xml
webservices/sandesha/trunk/java/modules/client/pom.xml
webservices/sandesha/trunk/java/modules/core/pom.xml
webservices/sandesha/trunk/java/modules/interop/pom.xml
webservices/sandesha/trunk/java/modules/mar/pom.xml
webservices/sandesha/trunk/java/modules/policy/pom.xml
webservices/sandesha/trunk/java/pom.xml
Modified: webservices/sandesha/trunk/java/maven.xml
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/maven.xml?view=diff&rev=531722&r1=531721&r2=531722
==============================================================================
--- webservices/sandesha/trunk/java/maven.xml (original)
+++ webservices/sandesha/trunk/java/maven.xml Mon Apr 23 21:57:43 2007
@@ -70,11 +70,10 @@
<ant:property name="metainf.path" value="${build.temp.dir}/module/META-INF" />
<ant:mkdir dir="${metainf.path}" />
- <ant:copy file="${basedir}/modules/mar/module.xml" todir="${metainf.path}" />
-
- <!-- For the client side -->
+ <ant:copy file="${basedir}/modules/mar/module.xml" todir="${metainf.path}" />
+ <!-- For the client side -->
<copy todir="${build.temp.dir}/module">
- <fileset dir="${basedir}/modules/core/target/classes" >
+ <fileset dir="${basedir}/target/classes" >
<include name="**/*.class"/>
<include name="**/*.properties" />
</fileset>
@@ -93,10 +92,10 @@
<ant:mkdir dir="${jar.temp.path}" />
<copy todir="${jar.temp.path}">
- <fileset dir="${basedir}/modules/core/target/classes" >
+ <fileset dir="${basedir}/target/classes" >
<include name="**/*.class"/>
</fileset>
- <fileset dir="${basedir}/modules/core/target/classes" >
+ <fileset dir="${basedir}/target/classes" >
<include name="**/*.properties" />
</fileset>
</copy>
@@ -116,7 +115,7 @@
<ant:mkdir dir="${policy.jar.temp.path}" />
<copy todir="${policy.jar.temp.path}">
- <fileset dir="${basedir}/modules/core/target/classes" >
+ <fileset dir="${basedir}/target/classes" >
<include name="**/policy/**/*.class"/>
<include name="**/*Sandesha2Constants*.class"/>
<include name="**/*.properties" />
@@ -145,7 +144,7 @@
<!-- For the client side -->
<copy todir="${build.temp.dir}/client">
- <fileset dir="${basedir}/modules/core/target/classes" >
+ <fileset dir="${basedir}/target/classes" >
<include name="**/sandesha2/client/*SandeshaClientConstants*.*" />
<include name="**/sandesha2/client/*SandeshaListener*.*" />
<include name="**/sandesha2/client/*SequenceReport*.*" />
@@ -320,13 +319,13 @@
<ant:copy file="${repo.rampart.mar}" toDir="${server.dist.path}/modules/" />
</goal>
- <goal name="sample:compile">
+ <goal name="sample:compile" prereqs="client:jar">
<ant:mkdir dir="${basedir}/target/samples/classes" />
<ant:mkdir dir="${basedir}/target/samples/services" />
<ant:javac srcdir="${dir.samples}/src" destdir="${basedir}/target/samples/classes" debug="on">
<ant:classpath refid="maven.dependency.classpath" />
- <ant:classpath path="${basedir}/modules/core/target/classes" />
+ <ant:classpath path="${basedir}/target/classes" />
</ant:javac>
</goal>
@@ -381,7 +380,7 @@
<ant:mkdir dir="${basedir}/target/interop/classes" />
<ant:mkdir dir="${basedir}/target/interop/services" />
- <ant:javac srcdir="${dir.interop}/src" destdir="${basedir}/target/interop/classes" debug="on">
+ <ant:javac srcdir="${dir.interop}/src/main/java" destdir="${basedir}/target/interop/classes" debug="on">
<ant:classpath refid="maven.dependency.classpath" />
<ant:classpath path="${basedir}/target/classes" />
</ant:javac>
@@ -571,4 +570,4 @@
<attainGoal name="dist-src" />
</goal>
-</project>
+</project>
Modified: webservices/sandesha/trunk/java/modules/client/pom.xml
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/client/pom.xml?view=diff&rev=531722&r1=531721&r2=531722
==============================================================================
--- webservices/sandesha/trunk/java/modules/client/pom.xml (original)
+++ webservices/sandesha/trunk/java/modules/client/pom.xml Mon Apr 23 21:57:43 2007
@@ -4,7 +4,7 @@
<parent>
<groupId>org.apache.sandesha2</groupId>
- <artifactId>sandesha2</artifactId>
+ <artifactId>sandesha2-parent</artifactId>
<version>SNAPSHOT</version>
</parent>
@@ -77,7 +77,7 @@
<dependencies>
<dependency>
<groupId>org.apache.sandesha2</groupId>
- <artifactId>sandesha2-core</artifactId>
+ <artifactId>sandesha2</artifactId>
<version>SNAPSHOT</version>
</dependency>
</dependencies>
Modified: webservices/sandesha/trunk/java/modules/core/pom.xml
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/pom.xml?view=diff&rev=531722&r1=531721&r2=531722
==============================================================================
--- webservices/sandesha/trunk/java/modules/core/pom.xml (original)
+++ webservices/sandesha/trunk/java/modules/core/pom.xml Mon Apr 23 21:57:43 2007
@@ -4,13 +4,13 @@
<parent>
<groupId>org.apache.sandesha2</groupId>
- <artifactId>sandesha2</artifactId>
+ <artifactId>sandesha2-parent</artifactId>
<version>SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.sandesha2</groupId>
- <artifactId>sandesha2-core</artifactId>
+ <artifactId>sandesha2</artifactId>
<packaging>jar</packaging>
<version>SNAPSHOT</version>
<name>Sandesha - Core</name>
Modified: webservices/sandesha/trunk/java/modules/interop/pom.xml
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/interop/pom.xml?view=diff&rev=531722&r1=531721&r2=531722
==============================================================================
--- webservices/sandesha/trunk/java/modules/interop/pom.xml (original)
+++ webservices/sandesha/trunk/java/modules/interop/pom.xml Mon Apr 23 21:57:43 2007
@@ -4,7 +4,7 @@
<parent>
<groupId>org.apache.sandesha2</groupId>
- <artifactId>sandesha2</artifactId>
+ <artifactId>sandesha2-parent</artifactId>
<version>SNAPSHOT</version>
</parent>
@@ -37,7 +37,7 @@
<dependencies>
<dependency>
<groupId>org.apache.sandesha2</groupId>
- <artifactId>sandesha2-core</artifactId>
+ <artifactId>sandesha2</artifactId>
<version>SNAPSHOT</version>
</dependency>
Added: webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/PWCallback.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/PWCallback.java?view=auto&rev=531722
==============================================================================
--- webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/PWCallback.java (added)
+++ webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/PWCallback.java Mon Apr 23 21:57:43 2007
@@ -0,0 +1,189 @@
+/*
+ * 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 org.apache.sandesha2.interop;
+
+import org.apache.ws.security.WSPasswordCallback;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+
+import java.io.IOException;
+
+public class PWCallback implements CallbackHandler {
+
+
+
+ /** Field key */
+
+ private static final byte[] key = {
+
+ (byte) 0x31, (byte) 0xfd, (byte) 0xcb, (byte) 0xda, (byte) 0xfb,
+
+ (byte) 0xcd, (byte) 0x6b, (byte) 0xa8, (byte) 0xe6, (byte) 0x19,
+
+ (byte) 0xa7, (byte) 0xbf, (byte) 0x51, (byte) 0xf7, (byte) 0xc7,
+
+ (byte) 0x3e, (byte) 0x80, (byte) 0xae, (byte) 0x98, (byte) 0x51,
+
+ (byte) 0xc8, (byte) 0x51, (byte) 0x34, (byte) 0x04,
+
+ };
+
+
+
+ /*
+
+ * (non-Javadoc)
+
+ * @see javax.security.auth.callback.CallbackHandler#handle(javax.security.auth.callback.Callback[])
+
+ */
+
+
+
+ /**
+
+ * Method handle
+
+ *
+
+ * @param callbacks
+
+ * @throws java.io.IOException
+
+ * @throws javax.security.auth.callback.UnsupportedCallbackException
+
+ */
+
+ public void handle(Callback[] callbacks)
+
+ throws IOException, UnsupportedCallbackException {
+
+
+
+ for (int i = 0; i < callbacks.length; i++) {
+
+ if (callbacks[i] instanceof WSPasswordCallback) {
+
+ WSPasswordCallback pc = (WSPasswordCallback) callbacks[i];
+
+
+
+ /*
+
+ * This usage type is used only in case we received a
+
+ * username token with a password of type PasswordText or
+
+ * an unknown password type.
+
+ *
+
+ * This case the WSPasswordCallback object contains the
+
+ * identifier (aka username), the password we received, and
+
+ * the password type string to identify the type.
+
+ *
+
+ * Here we perform only a very simple check.
+
+ */
+
+ if (pc.getUsage() == WSPasswordCallback.USERNAME_TOKEN_UNKNOWN) {
+
+ if(pc.getIdentifer().equals("Ron") && pc.getPassword().equals("noR")) {
+
+ return;
+
+ }
+
+ if(pc.getIdentifer().equals("joe") && pc.getPassword().equals("eoj")) {
+
+ return;
+
+ }
+
+ if (pc.getPassword().equals("sirhC")) {
+
+ return;
+
+ }
+
+ throw new UnsupportedCallbackException(callbacks[i],
+
+ "check failed");
+
+ }
+
+ /*
+
+ * here call a function/method to lookup the password for
+
+ * the given identifier (e.g. a user name or keystore alias)
+
+ * e.g.: pc.setPassword(passStore.getPassword(pc.getIdentfifier))
+
+ * for Testing we supply a fixed name here.
+
+ */
+
+ if (pc.getUsage() == WSPasswordCallback.KEY_NAME) {
+
+ pc.setKey(key);
+
+ } else if(pc.getIdentifer().equals("alice")) {
+
+ pc.setPassword("password");
+
+ } else if(pc.getIdentifer().equals("bob")) {
+
+ pc.setPassword("password");
+
+ } else if(pc.getIdentifer().equals("Ron")) {
+
+ pc.setPassword("noR");
+
+ } else if(pc.getIdentifer().equals("joe")) {
+
+ pc.setPassword("eoj");
+
+ } else if(pc.getIdentifer().equals("ip")) {
+
+ pc.setPassword("password");
+
+ } else {
+
+ pc.setPassword("sirhC");
+
+ }
+
+ } else {
+
+ throw new UnsupportedCallbackException(callbacks[i],
+
+ "Unrecognized Callback");
+
+ }
+
+ }
+
+ }
+
+}
\ No newline at end of file
Added: webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/RMInteropServiceCallbackHandler.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/RMInteropServiceCallbackHandler.java?view=auto&rev=531722
==============================================================================
--- webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/RMInteropServiceCallbackHandler.java (added)
+++ webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/RMInteropServiceCallbackHandler.java Mon Apr 23 21:57:43 2007
@@ -0,0 +1,71 @@
+/*
+ * 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 org.apache.sandesha2.interop;
+
+/**
+ * RMInteropServiceCallbackHandler Callback class, Users can extend this class
+ * and implement their own receiveResult and receiveError methods.
+ */
+public abstract class RMInteropServiceCallbackHandler {
+
+ protected Object clientData;
+
+ /**
+ * User can pass in any object that needs to be accessed once the
+ * NonBlocking Web service call is finished and appropriate 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 RMInteropServiceCallbackHandler(Object clientData) {
+ this.clientData = clientData;
+ }
+
+ /**
+ * Please use this constructor if you don't want to set any clientData
+ */
+ public RMInteropServiceCallbackHandler() {
+ this.clientData = null;
+ }
+
+ /**
+ * Get the client data
+ */
+
+ public Object getClientData() {
+ return clientData;
+ }
+
+ /**
+ * auto generated Axis2 call back method for EchoString method
+ *
+ */
+ public void receiveResultEchoString(org.tempuri.EchoStringResponse param28) {
+ }
+
+ /**
+ * auto generated Axis2 Error handler
+ *
+ */
+ public void receiveErrorEchoString(java.lang.Exception e) {
+ }
+
+ // No methods generated for meps other than in-out
+
+}
Added: webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/RMInteropServiceCallbackHandlerImpl.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/RMInteropServiceCallbackHandlerImpl.java?view=auto&rev=531722
==============================================================================
--- webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/RMInteropServiceCallbackHandlerImpl.java (added)
+++ webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/RMInteropServiceCallbackHandlerImpl.java Mon Apr 23 21:57:43 2007
@@ -0,0 +1,56 @@
+/*
+ * 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 org.apache.sandesha2.interop;
+
+import org.tempuri.EchoStringResponse;
+
+public class RMInteropServiceCallbackHandlerImpl extends
+ RMInteropServiceCallbackHandler {
+
+ private boolean completed = false;
+
+ public RMInteropServiceCallbackHandlerImpl(Object clientData) {
+ super(clientData);
+ }
+
+ public Object getClientData() {
+ // TODO Auto-generated method stub
+ return super.getClientData();
+ }
+
+ public void receiveErrorEchoString(Exception e) {
+ System.out.println("EchoString callback got error:");
+ e.printStackTrace();
+ completed = true;
+ }
+
+ public void receiveResultEchoString(EchoStringResponse echoStringResponse) {
+ String text = echoStringResponse.getEchoStringResponse()
+ .getEchoStringReturn();
+ System.out.println("EchoSting callback got text:" + text);
+ completed = true;
+ }
+
+ public boolean isCompleted() {
+ return completed;
+ }
+
+ public void setCompleted(boolean completed) {
+ this.completed = completed;
+ }
+
+}
Added: webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/RMInteropServiceMessageReceiverInOnly.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/RMInteropServiceMessageReceiverInOnly.java?view=auto&rev=531722
==============================================================================
--- webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/RMInteropServiceMessageReceiverInOnly.java (added)
+++ webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/RMInteropServiceMessageReceiverInOnly.java Mon Apr 23 21:57:43 2007
@@ -0,0 +1,168 @@
+/*
+ * 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 org.apache.sandesha2.interop;
+
+/**
+ * RMInteropServiceMessageReceiverInOnly message receiver
+ */
+
+public class RMInteropServiceMessageReceiverInOnly extends
+ org.apache.axis2.receivers.AbstractInMessageReceiver {
+
+ public void invokeBusinessLogic(
+ org.apache.axis2.context.MessageContext inMessage)
+ throws org.apache.axis2.AxisFault {
+
+ try {
+
+ // get the implementation class for the Web Service
+ Object obj = getTheImplementationObject(inMessage);
+
+ // Inject the Message Context if it is asked for
+ /*
+ commented by sumedha
+ org.apache.axis2.engine.DependencyManager
+ .configureBusinessLogicProvider(obj, inMessage
+ .getOperationContext());
+ */
+
+ RMInteropServiceSkeleton skel = (RMInteropServiceSkeleton) obj;
+ // Out Envelop
+ org.apache.axiom.soap.SOAPEnvelope envelope = null;
+ // Find the axisOperation that has been set by the Dispatch phase.
+ org.apache.axis2.description.AxisOperation op = inMessage
+ .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");
+ }
+
+ java.lang.String methodName;
+ if (op.getName() != null
+ & (methodName = op.getName().getLocalPart()) != null) {
+
+ if ("Ping".equals(methodName)) {
+
+ // doc style
+ skel.Ping((org.tempuri.Ping) fromOM(inMessage.getEnvelope()
+ .getBody().getFirstElement(),
+ org.tempuri.Ping.class,
+ getEnvelopeNamespaces(inMessage.getEnvelope())));
+
+ }
+
+ }
+ } catch (Exception e) {
+ throw org.apache.axis2.AxisFault.makeFault(e);
+ }
+ }
+
+ //
+ private org.apache.axiom.om.OMElement toOM(org.tempuri.EchoString param,
+ boolean optimizeContent) {
+
+ return param.getOMElement(org.tempuri.EchoString.MY_QNAME,
+ org.apache.axiom.om.OMAbstractFactory.getOMFactory());
+
+ }
+
+ private org.apache.axiom.om.OMElement toOM(
+ org.tempuri.EchoStringResponse param, boolean optimizeContent) {
+
+ return param.getOMElement(org.tempuri.EchoStringResponse.MY_QNAME,
+ org.apache.axiom.om.OMAbstractFactory.getOMFactory());
+
+ }
+
+ private org.apache.axiom.om.OMElement toOM(org.tempuri.Ping param,
+ boolean optimizeContent) {
+
+ return param.getOMElement(org.tempuri.Ping.MY_QNAME,
+ org.apache.axiom.om.OMAbstractFactory.getOMFactory());
+
+ }
+
+ private org.apache.axiom.soap.SOAPEnvelope toEnvelope(
+ org.apache.axiom.soap.SOAPFactory factory,
+ org.tempuri.EchoStringResponse param, boolean optimizeContent) {
+ org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory
+ .getDefaultEnvelope();
+
+ emptyEnvelope.getBody().addChild(
+ param.getOMElement(org.tempuri.EchoStringResponse.MY_QNAME,
+ factory));
+
+ return emptyEnvelope;
+ }
+
+ /**
+ * get the default envelope
+ */
+ private org.apache.axiom.soap.SOAPEnvelope toEnvelope(
+ org.apache.axiom.soap.SOAPFactory factory) {
+ return factory.getDefaultEnvelope();
+ }
+
+ private java.lang.Object fromOM(org.apache.axiom.om.OMElement param,
+ java.lang.Class type, java.util.Map extraNamespaces) {
+
+ try {
+
+ if (org.tempuri.EchoString.class.equals(type)) {
+
+ return org.tempuri.EchoString.Factory.parse(param
+ .getXMLStreamReaderWithoutCaching());
+
+ }
+
+ if (org.tempuri.EchoStringResponse.class.equals(type)) {
+
+ return org.tempuri.EchoStringResponse.Factory.parse(param
+ .getXMLStreamReaderWithoutCaching());
+
+ }
+
+ if (org.tempuri.Ping.class.equals(type)) {
+
+ return org.tempuri.Ping.Factory.parse(param
+ .getXMLStreamReaderWithoutCaching());
+
+ }
+
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ return null;
+ }
+
+ /**
+ * A utility method that copies the namepaces from the SOAPEnvelope
+ */
+ private java.util.Map getEnvelopeNamespaces(
+ org.apache.axiom.soap.SOAPEnvelope env) {
+ java.util.Map returnMap = new java.util.HashMap();
+ java.util.Iterator namespaceIterator = env.getAllDeclaredNamespaces();
+ while (namespaceIterator.hasNext()) {
+ org.apache.axiom.om.OMNamespace ns = (org.apache.axiom.om.OMNamespace) namespaceIterator
+ .next();
+ returnMap.put(ns.getPrefix(), ns.getNamespaceURI());
+ }
+ return returnMap;
+ }
+
+}// end of class
+
Added: webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/RMInteropServiceMessageReceiverInOut.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/RMInteropServiceMessageReceiverInOut.java?view=auto&rev=531722
==============================================================================
--- webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/RMInteropServiceMessageReceiverInOut.java (added)
+++ webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/RMInteropServiceMessageReceiverInOut.java Mon Apr 23 21:57:43 2007
@@ -0,0 +1,190 @@
+
+/*
+ * 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 org.apache.sandesha2.interop;
+
+/**
+ * RMInteropServiceMessageReceiverInOut message receiver
+ */
+
+public class RMInteropServiceMessageReceiverInOut 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
+ /*
+ commented by sumedha
+ org.apache.axis2.engine.DependencyManager
+ .configureBusinessLogicProvider(obj, msgContext
+ .getOperationContext());
+ */
+
+ RMInteropServiceSkeleton skel = (RMInteropServiceSkeleton) obj;
+ // Out Envelop
+ org.apache.axiom.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");
+ }
+
+ java.lang.String methodName;
+ if (op.getName() != null
+ & (methodName = op.getName().getLocalPart()) != null) {
+
+ if ("EchoString".equals(methodName)) {
+
+ org.tempuri.EchoStringResponse param4 = null;
+
+ // doc style
+ org.tempuri.EchoString wrappedParam = (org.tempuri.EchoString) fromOM(
+ msgContext.getEnvelope().getBody()
+ .getFirstElement(),
+ org.tempuri.EchoString.class,
+ getEnvelopeNamespaces(msgContext.getEnvelope()));
+
+ param4 = skel.EchoString(wrappedParam);
+
+ envelope = toEnvelope(getSOAPFactory(msgContext), param4,
+ false);
+
+ }
+
+ newMsgContext.setEnvelope(envelope);
+ }
+ } catch (Exception e) {
+ throw org.apache.axis2.AxisFault.makeFault(e);
+ }
+ }
+
+ //
+ private org.apache.axiom.om.OMElement toOM(org.tempuri.EchoString param,
+ boolean optimizeContent) {
+
+ return param.getOMElement(org.tempuri.EchoString.MY_QNAME,
+ org.apache.axiom.om.OMAbstractFactory.getOMFactory());
+
+ }
+
+ private org.apache.axiom.om.OMElement toOM(
+ org.tempuri.EchoStringResponse param, boolean optimizeContent) {
+
+ return param.getOMElement(org.tempuri.EchoStringResponse.MY_QNAME,
+ org.apache.axiom.om.OMAbstractFactory.getOMFactory());
+
+ }
+
+ private org.apache.axiom.om.OMElement toOM(org.tempuri.Ping param,
+ boolean optimizeContent) {
+
+ return param.getOMElement(org.tempuri.Ping.MY_QNAME,
+ org.apache.axiom.om.OMAbstractFactory.getOMFactory());
+
+ }
+
+ private org.apache.axiom.soap.SOAPEnvelope toEnvelope(
+ org.apache.axiom.soap.SOAPFactory factory,
+ org.tempuri.EchoStringResponse param, boolean optimizeContent) {
+ org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory
+ .getDefaultEnvelope();
+
+ emptyEnvelope.getBody().addChild(
+ param.getOMElement(org.tempuri.EchoStringResponse.MY_QNAME,
+ factory));
+
+ return emptyEnvelope;
+ }
+
+ /**
+ * get the default envelope
+ */
+ private org.apache.axiom.soap.SOAPEnvelope toEnvelope(
+ org.apache.axiom.soap.SOAPFactory factory) {
+ return factory.getDefaultEnvelope();
+ }
+
+ private java.lang.Object fromOM(org.apache.axiom.om.OMElement param,
+ java.lang.Class type, java.util.Map extraNamespaces) {
+
+ try {
+
+ if (org.tempuri.EchoString.class.equals(type)) {
+
+ return org.tempuri.EchoString.Factory.parse(param
+ .getXMLStreamReaderWithoutCaching());
+
+ }
+
+ if (org.tempuri.EchoStringResponse.class.equals(type)) {
+
+ return org.tempuri.EchoStringResponse.Factory.parse(param
+ .getXMLStreamReaderWithoutCaching());
+
+ }
+
+ if (org.tempuri.Ping.class.equals(type)) {
+
+ return org.tempuri.Ping.Factory.parse(param
+ .getXMLStreamReaderWithoutCaching());
+
+ }
+
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ return null;
+ }
+
+ /**
+ * A utility method that copies the namepaces from the SOAPEnvelope
+ */
+ private java.util.Map getEnvelopeNamespaces(
+ org.apache.axiom.soap.SOAPEnvelope env) {
+ java.util.Map returnMap = new java.util.HashMap();
+ java.util.Iterator namespaceIterator = env.getAllDeclaredNamespaces();
+ while (namespaceIterator.hasNext()) {
+ org.apache.axiom.om.OMNamespace ns = (org.apache.axiom.om.OMNamespace) namespaceIterator
+ .next();
+ returnMap.put(ns.getPrefix(), ns.getNamespaceURI());
+ }
+ return returnMap;
+ }
+
+ private org.apache.axis2.AxisFault createAxisFault(java.lang.Exception e) {
+ org.apache.axis2.AxisFault f;
+ Throwable cause = e.getCause();
+ if (cause != null) {
+ f = new org.apache.axis2.AxisFault(e.getMessage(), cause);
+ } else {
+ f = new org.apache.axis2.AxisFault(e.getMessage());
+ }
+
+ return f;
+ }
+
+}// end of class
Added: webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/RMInteropServiceSkeleton.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/RMInteropServiceSkeleton.java?view=auto&rev=531722
==============================================================================
--- webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/RMInteropServiceSkeleton.java (added)
+++ webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/RMInteropServiceSkeleton.java Mon Apr 23 21:57:43 2007
@@ -0,0 +1,52 @@
+/*
+ * 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 org.apache.sandesha2.interop;
+
+/**
+ * RMInteropServiceSkeleton java skeleton for the axisService
+ */
+public class RMInteropServiceSkeleton {
+
+ /**
+ * Auto generated method signature
+ *
+ * @param param0
+ *
+ */
+ public org.tempuri.EchoStringResponse EchoString(
+ org.tempuri.EchoString param0)
+
+ {
+ // Todo fill this with the necessary business logic
+ throw new java.lang.UnsupportedOperationException("Please implement "
+ + this.getClass().getName() + "#EchoString");
+ }
+
+ /**
+ * Auto generated method signature
+ *
+ * @param param2
+ *
+ */
+ public void Ping(org.tempuri.Ping param2)
+
+ {
+ // Todo fill this with the necessary business logic
+
+ }
+
+}
Added: webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/RMInteropServiceSkeletonImpl.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/RMInteropServiceSkeletonImpl.java?view=auto&rev=531722
==============================================================================
--- webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/RMInteropServiceSkeletonImpl.java (added)
+++ webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/RMInteropServiceSkeletonImpl.java Mon Apr 23 21:57:43 2007
@@ -0,0 +1,54 @@
+/*
+ * 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 org.apache.sandesha2.interop;
+
+import java.util.HashMap;
+
+import org.tempuri.EchoStringResponse;
+import org.tempuri.EchoStringResponseBodyType;
+
+public class RMInteropServiceSkeletonImpl extends RMInteropServiceSkeleton {
+
+ HashMap sequenceTextMap = new HashMap();
+
+ public EchoStringResponse EchoString(org.tempuri.EchoString echoString) {
+
+ String sequence = echoString.getEchoString().getSequence();
+ String text = echoString.getEchoString().getText();
+
+ System.out.println("EchoString got text '" + text
+ + "', for the sequence '" + sequence + "'.");
+
+ String oldText = (String) sequenceTextMap.get(sequence);
+ String newText = oldText == null ? text : oldText + text;
+
+ sequenceTextMap.put(sequence, newText);
+
+ EchoStringResponse echoStringResponse = new EchoStringResponse();
+ echoStringResponse
+ .setEchoStringResponse(new EchoStringResponseBodyType());
+ echoStringResponse.getEchoStringResponse().setEchoStringReturn(newText);
+
+ return echoStringResponse;
+ }
+
+ public void Ping(org.tempuri.Ping ping) {
+ String text = ping.getText();
+ System.out.println("Ping got text '" + text + "'");
+ }
+
+}
Added: webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/RMInteropServiceStub.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/RMInteropServiceStub.java?view=auto&rev=531722
==============================================================================
--- webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/RMInteropServiceStub.java (added)
+++ webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/RMInteropServiceStub.java Mon Apr 23 21:57:43 2007
@@ -0,0 +1,442 @@
+/*
+ * 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 org.apache.sandesha2.interop;
+
+/*
+ * RMInteropServiceStub java implementation
+ */
+
+public class RMInteropServiceStub extends org.apache.axis2.client.Stub {
+ protected org.apache.axis2.description.AxisOperation[] _operations;
+
+ // hashmaps to keep the fault mapping
+ private java.util.HashMap faultExeptionNameMap = new java.util.HashMap();
+
+ private java.util.HashMap faultExeptionClassNameMap = new java.util.HashMap();
+
+ private java.util.HashMap faultMessageMap = new java.util.HashMap();
+
+ private void populateAxisService() throws org.apache.axis2.AxisFault {
+
+ // creating the Service with a unique name
+ _service = new org.apache.axis2.description.AxisService(
+ "RMInteropService" + this.hashCode());
+
+ // creating the operations
+ org.apache.axis2.description.AxisOperation __operation;
+
+ _operations = new org.apache.axis2.description.AxisOperation[2];
+
+ __operation = new org.apache.axis2.description.OutInAxisOperation();
+
+ __operation.setName(new javax.xml.namespace.QName("", "EchoString"));
+ _service.addOperation(__operation);
+
+ _operations[0] = __operation;
+
+ __operation = new org.apache.axis2.description.OutOnlyAxisOperation();
+
+ __operation.setName(new javax.xml.namespace.QName("", "Ping"));
+ _service.addOperation(__operation);
+
+ _operations[1] = __operation;
+
+ }
+
+ // populates the faults
+ private void populateFaults() {
+
+ }
+
+ /**
+ * Constructor that takes in a configContext
+ */
+ public RMInteropServiceStub(
+ org.apache.axis2.context.ConfigurationContext configurationContext,
+ java.lang.String targetEndpoint) throws org.apache.axis2.AxisFault {
+ // To populate AxisService
+ populateAxisService();
+ populateFaults();
+
+ _serviceClient = new org.apache.axis2.client.ServiceClient(
+ configurationContext, _service);
+ _service.applyPolicy();
+
+ configurationContext = _serviceClient.getServiceContext()
+ .getConfigurationContext();
+
+ _serviceClient.getOptions().setTo(
+ new org.apache.axis2.addressing.EndpointReference(
+ targetEndpoint));
+
+ }
+
+ /**
+ * Default Constructor
+ */
+ public RMInteropServiceStub() throws org.apache.axis2.AxisFault {
+
+ this("http://www.example.org/");
+
+ }
+
+ /**
+ * Constructor taking the target endpoint
+ */
+ public RMInteropServiceStub(java.lang.String targetEndpoint)
+ throws org.apache.axis2.AxisFault {
+ this(null, targetEndpoint);
+ }
+
+ /**
+ * Auto generated method signature
+ *
+ * @see org.apache.sandesha2.interop.RMInteropService#EchoString
+ * @param param30
+ *
+ */
+ public org.tempuri.EchoStringResponse EchoString(
+
+ org.tempuri.EchoString param30) throws java.rmi.RemoteException
+
+ {
+ try {
+ org.apache.axis2.client.OperationClient _operationClient = _serviceClient
+ .createClient(_operations[0].getName());
+ _operationClient.getOptions().setAction("urn:wsrm:EchoString");
+ _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(
+ true);
+
+ // create SOAP envelope with that payload
+ org.apache.axiom.soap.SOAPEnvelope env = null;
+
+ // Style is Doc.
+
+ env = toEnvelope(getFactory(_operationClient.getOptions()
+ .getSoapVersionURI()), param30,
+ optimizeContent(new javax.xml.namespace.QName("",
+ "EchoString")));
+
+ // adding SOAP headers
+ _serviceClient.addHeadersToEnvelope(env);
+ // 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);
+
+ // execute the operation client
+ _operationClient.execute(true);
+
+ org.apache.axis2.context.MessageContext _returnMessageContext = _operationClient
+ .getMessageContext(org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+ org.apache.axiom.soap.SOAPEnvelope _returnEnv = _returnMessageContext
+ .getEnvelope();
+
+ java.lang.Object object = fromOM(_returnEnv.getBody()
+ .getFirstElement(), org.tempuri.EchoStringResponse.class,
+ getEnvelopeNamespaces(_returnEnv));
+ _messageContext.getTransportOut().getSender().cleanup(
+ _messageContext);
+ return (org.tempuri.EchoStringResponse) object;
+
+ } catch (org.apache.axis2.AxisFault f) {
+ org.apache.axiom.om.OMElement faultElt = f.getDetail();
+ if (faultElt != null) {
+ if (faultExeptionNameMap.containsKey(faultElt.getQName())) {
+ // make the fault by reflection
+ try {
+ java.lang.String exceptionClassName = (java.lang.String) faultExeptionClassNameMap
+ .get(faultElt.getQName());
+ java.lang.Class exceptionClass = java.lang.Class
+ .forName(exceptionClassName);
+ java.lang.Exception ex = (java.lang.Exception) exceptionClass
+ .newInstance();
+ // message class
+ java.lang.String messageClassName = (java.lang.String) faultMessageMap
+ .get(faultElt.getQName());
+ java.lang.Class messageClass = java.lang.Class
+ .forName(messageClassName);
+ java.lang.Object messageObject = fromOM(faultElt,
+ messageClass, null);
+ java.lang.reflect.Method m = exceptionClass.getMethod(
+ "setFaultMessage",
+ new java.lang.Class[] { messageClass });
+ m.invoke(ex, new java.lang.Object[] { messageObject });
+
+ throw new java.rmi.RemoteException(ex.getMessage(), ex);
+ } catch (java.lang.ClassCastException e) {
+ // we cannot intantiate the class - throw the original
+ // Axis fault
+ throw f;
+ } catch (java.lang.ClassNotFoundException e) {
+ // we cannot intantiate the class - throw the original
+ // Axis fault
+ throw f;
+ } catch (java.lang.NoSuchMethodException e) {
+ // we cannot intantiate the class - throw the original
+ // Axis fault
+ throw f;
+ } catch (java.lang.reflect.InvocationTargetException e) {
+ // we cannot intantiate the class - throw the original
+ // Axis fault
+ throw f;
+ } catch (java.lang.IllegalAccessException e) {
+ // we cannot intantiate the class - throw the original
+ // Axis fault
+ throw f;
+ } catch (java.lang.InstantiationException e) {
+ // we cannot intantiate the class - throw the original
+ // Axis fault
+ throw f;
+ }
+ } else {
+ throw f;
+ }
+ } else {
+ throw f;
+ }
+ }
+ }
+
+ /**
+ * Auto generated method signature for Asynchronous Invocations
+ *
+ * @see org.apache.sandesha2.interop.RMInteropService#startEchoString
+ * @param param30
+ *
+ */
+ public void startEchoString(
+
+ org.tempuri.EchoString param30,
+ final org.apache.sandesha2.interop.RMInteropServiceCallbackHandler callback)
+
+ throws java.rmi.RemoteException {
+
+ org.apache.axis2.client.OperationClient _operationClient = _serviceClient
+ .createClient(_operations[0].getName());
+ _operationClient.getOptions().setAction("urn:wsrm:EchoString");
+ _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
+
+ // create SOAP envelope with that payload
+ org.apache.axiom.soap.SOAPEnvelope env = null;
+
+ // Style is Doc.
+
+ env = toEnvelope(
+ getFactory(_operationClient.getOptions().getSoapVersionURI()),
+ param30,
+ optimizeContent(new javax.xml.namespace.QName("", "EchoString")));
+
+ // adding SOAP headers
+ _serviceClient.addHeadersToEnvelope(env);
+ // 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);
+
+ _operationClient
+ .setCallback(new org.apache.axis2.client.async.Callback() {
+ public void onComplete(
+ org.apache.axis2.client.async.AsyncResult result) {
+ java.lang.Object object = fromOM(result
+ .getResponseEnvelope().getBody()
+ .getFirstElement(),
+ org.tempuri.EchoStringResponse.class,
+ getEnvelopeNamespaces(result
+ .getResponseEnvelope()));
+ callback
+ .receiveResultEchoString((org.tempuri.EchoStringResponse) object);
+ }
+
+ public void onError(java.lang.Exception e) {
+ callback.receiveErrorEchoString(e);
+ }
+ });
+
+ org.apache.axis2.util.CallbackReceiver _callbackReceiver = null;
+ if (_operations[0].getMessageReceiver() == null
+ && _operationClient.getOptions().isUseSeparateListener()) {
+ _callbackReceiver = new org.apache.axis2.util.CallbackReceiver();
+ _operations[0].setMessageReceiver(_callbackReceiver);
+ }
+
+ // execute the operation client
+ _operationClient.execute(false);
+
+ }
+
+ public void Ping(org.tempuri.Ping param32
+
+ ) throws java.rmi.RemoteException
+
+ {
+
+ org.apache.axis2.client.OperationClient _operationClient = _serviceClient
+ .createClient(_operations[1].getName());
+ _operationClient.getOptions().setAction("urn:wsrm:Ping");
+ _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
+
+ org.apache.axiom.soap.SOAPEnvelope env = null;
+
+ // Style is Doc.
+
+ env = toEnvelope(getFactory(_operationClient.getOptions()
+ .getSoapVersionURI()), param32,
+ optimizeContent(new javax.xml.namespace.QName("", "Ping")));
+
+ // adding SOAP headers
+ _serviceClient.addHeadersToEnvelope(env);
+ // 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);
+
+ _operationClient.execute(true);
+
+ return;
+ }
+
+ /**
+ * A utility method that copies the namepaces from the SOAPEnvelope
+ */
+ private java.util.Map getEnvelopeNamespaces(
+ org.apache.axiom.soap.SOAPEnvelope env) {
+ java.util.Map returnMap = new java.util.HashMap();
+ java.util.Iterator namespaceIterator = env.getAllDeclaredNamespaces();
+ while (namespaceIterator.hasNext()) {
+ org.apache.axiom.om.OMNamespace ns = (org.apache.axiom.om.OMNamespace) namespaceIterator
+ .next();
+ returnMap.put(ns.getPrefix(), ns.getNamespaceURI());
+ }
+ return returnMap;
+ }
+
+ private javax.xml.namespace.QName[] opNameArray = null;
+
+ private boolean optimizeContent(javax.xml.namespace.QName opName) {
+
+ if (opNameArray == null) {
+ return false;
+ }
+ for (int i = 0; i < opNameArray.length; i++) {
+ if (opName.equals(opNameArray[i])) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ // http://www.example.org/
+ private org.apache.axiom.om.OMElement toOM(org.tempuri.EchoString param,
+ boolean optimizeContent) {
+
+ return param.getOMElement(org.tempuri.EchoString.MY_QNAME,
+ org.apache.axiom.om.OMAbstractFactory.getOMFactory());
+
+ }
+
+ private org.apache.axiom.om.OMElement toOM(
+ org.tempuri.EchoStringResponse param, boolean optimizeContent) {
+
+ return param.getOMElement(org.tempuri.EchoStringResponse.MY_QNAME,
+ org.apache.axiom.om.OMAbstractFactory.getOMFactory());
+
+ }
+
+ private org.apache.axiom.om.OMElement toOM(org.tempuri.Ping param,
+ boolean optimizeContent) {
+
+ return param.getOMElement(org.tempuri.Ping.MY_QNAME,
+ org.apache.axiom.om.OMAbstractFactory.getOMFactory());
+
+ }
+
+ private org.apache.axiom.soap.SOAPEnvelope toEnvelope(
+ org.apache.axiom.soap.SOAPFactory factory,
+ org.tempuri.EchoString param, boolean optimizeContent) {
+ org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory
+ .getDefaultEnvelope();
+
+ emptyEnvelope.getBody().addChild(
+ param.getOMElement(org.tempuri.EchoString.MY_QNAME, factory));
+
+ return emptyEnvelope;
+ }
+
+ private org.apache.axiom.soap.SOAPEnvelope toEnvelope(
+ org.apache.axiom.soap.SOAPFactory factory, org.tempuri.Ping param,
+ boolean optimizeContent) {
+ org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory
+ .getDefaultEnvelope();
+
+ emptyEnvelope.getBody().addChild(
+ param.getOMElement(org.tempuri.Ping.MY_QNAME, factory));
+
+ return emptyEnvelope;
+ }
+
+ /**
+ * get the default envelope
+ */
+ private org.apache.axiom.soap.SOAPEnvelope toEnvelope(
+ org.apache.axiom.soap.SOAPFactory factory) {
+ return factory.getDefaultEnvelope();
+ }
+
+ private java.lang.Object fromOM(org.apache.axiom.om.OMElement param,
+ java.lang.Class type, java.util.Map extraNamespaces) {
+
+ try {
+
+ if (org.tempuri.EchoString.class.equals(type)) {
+
+ return org.tempuri.EchoString.Factory.parse(param
+ .getXMLStreamReaderWithoutCaching());
+
+ }
+
+ if (org.tempuri.EchoStringResponse.class.equals(type)) {
+
+ return org.tempuri.EchoStringResponse.Factory.parse(param
+ .getXMLStreamReaderWithoutCaching());
+
+ }
+
+ if (org.tempuri.Ping.class.equals(type)) {
+
+ return org.tempuri.Ping.Factory.parse(param
+ .getXMLStreamReaderWithoutCaching());
+
+ }
+
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ return null;
+ }
+
+ private void setOpNameArray() {
+ opNameArray = null;
+ }
+
+}
Added: webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_1_1.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_1_1.java?view=auto&rev=531722
==============================================================================
--- webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_1_1.java (added)
+++ webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_1_1.java Mon Apr 23 21:57:43 2007
@@ -0,0 +1,224 @@
+/*
+ * 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 org.apache.sandesha2.interop.rm1_1_clients;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.rmi.RemoteException;
+import java.util.Properties;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.soap.SOAP11Constants;
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.context.MessageContextConstants;
+import org.apache.axis2.engine.AxisError;
+import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.client.SandeshaClient;
+import org.apache.sandesha2.client.SandeshaClientConstants;
+import org.apache.sandesha2.client.SequenceReport;
+import org.apache.sandesha2.interop.RMInteropServiceStub;
+import org.apache.sandesha2.util.SandeshaUtil;
+import org.tempuri.Ping;
+
+public class Scenario_1_1 {
+
+ private static final String applicationNamespaceName = "http://tempuri.org/";
+ private static final String PingRequest = "PingRequest";
+ private static final String Text = "Text";
+
+ private static String toIP = "127.0.0.1";
+ private static String toPort = "9762";
+ private static String transportToIP = "127.0.0.1";
+ private static String transportToPort = "8070";
+ private static String servicePart = "/axis2/services/RMInteropService";
+ private static String toEPR = "http://" + toIP + ":" + toPort + servicePart;
+ private static String transportToEPR = "http://" + transportToIP + ":" + transportToPort + servicePart;
+
+ private static String SANDESHA2_HOME = "<SANDESHA2_HOME>"; //Change this to ur path.
+
+ private static String AXIS2_CLIENT_PATH = SANDESHA2_HOME + File.separator + "target" + File.separator +"repos" + File.separator + "client" + File.separator; //this will be available after a maven build
+
+ public static void main(String[] args) throws Exception {
+
+ String axisClientRepo = null;
+ if (args!=null && args.length>0)
+ axisClientRepo = args[0];
+
+ if (axisClientRepo!=null && !"".equals(axisClientRepo)) {
+ AXIS2_CLIENT_PATH = axisClientRepo;
+ SANDESHA2_HOME = "";
+ }
+
+ InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream("sandesha2_interop.properties");
+
+ Properties properties = new Properties();
+ if (in != null) {
+ properties.load(in);
+
+ toEPR = properties.getProperty("to");
+ transportToEPR = properties.getProperty("transportTo");
+ }
+
+
+// new Scenario_1_1 ().run();
+
+ new Scenario_1_1 ().runStubBased ();
+ }
+
+ private void run () throws Exception {
+
+ ConfigurationContext configurationContext = generateConfigContext();
+
+ Options clientOptions = new Options ();
+ setUpOptions(clientOptions);
+
+ ServiceClient serviceClient = new ServiceClient (configurationContext,null);
+
+ serviceClient.setOptions(clientOptions);
+
+ serviceClient.fireAndForget(getPingOMBlock("ping1"));
+ serviceClient.fireAndForget(getPingOMBlock("ping2"));
+ serviceClient.fireAndForget(getPingOMBlock("ping3"));
+
+ SequenceReport sequenceReport = null;
+ boolean complete = false;
+ while (!complete) {
+ sequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
+ if (sequenceReport!=null && sequenceReport.getCompletedMessages().size()==1)
+ complete = true;
+ else {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e1) {
+ e1.printStackTrace();
+ }
+ }
+ }
+
+ SandeshaClient.terminateSequence(serviceClient);
+
+ serviceClient.cleanup();
+ }
+
+ private static OMElement getPingOMBlock(String text) {
+ OMFactory fac = OMAbstractFactory.getOMFactory();
+ OMNamespace namespace = fac.createOMNamespace(applicationNamespaceName,"ns1");
+ OMElement pingElem = fac.createOMElement(PingRequest, namespace);
+ OMElement textElem = fac.createOMElement(Text, null);
+
+ textElem.setText(text);
+ pingElem.addChild(textElem);
+
+ return pingElem;
+ }
+
+ private void runStubBased () throws Exception {
+ String targetEndpoint = toEPR;
+ ConfigurationContext configurationContext = generateConfigContext();
+
+ RMInteropServiceStub stub = new RMInteropServiceStub (configurationContext, targetEndpoint);
+ ServiceClient stubServiceClient = stub._getServiceClient();
+ setUpOptions(stubServiceClient.getOptions());
+
+ Ping ping = new Ping ();
+ ping.setText("ping1");
+ stub.Ping (ping);
+
+ ping = new Ping ();
+ ping.setText("ping2");
+ stub.Ping (ping);
+
+ ping = new Ping ();
+ ping.setText("ping3");
+ stub.Ping (ping);
+
+
+ SequenceReport sequenceReport = null;
+ boolean complete = false;
+ while (!complete) {
+ sequenceReport = SandeshaClient.getOutgoingSequenceReport(stubServiceClient);
+ if (sequenceReport!=null && sequenceReport.getCompletedMessages().size()==3)
+ complete = true;
+ else {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e1) {
+ e1.printStackTrace();
+ }
+ }
+ }
+
+// SandeshaClient.closeSequence (stubServiceClient);
+
+ Thread.sleep(1000);
+
+ SandeshaClient.terminateSequence (stubServiceClient);
+
+ Thread.sleep(3000);
+
+// ping = new Ping ();
+// ping.setText("ping4");
+// stub.Ping (ping);
+// Thread.sleep(3000000);
+
+ configurationContext.getListenerManager().stop();
+ stub._getServiceClient().cleanup();
+ }
+
+ private ConfigurationContext generateConfigContext () throws Exception {
+ if ("<SANDESHA2_HOME>".equals(SANDESHA2_HOME)){
+ System.out.println("ERROR: Please change <SANDESHA2_HOME> to your Sandesha2 installation directory.");
+ throw new Exception ("Client not set up correctly");
+ }
+
+ String axis2_xml = AXIS2_CLIENT_PATH + "client_axis2.xml";
+ ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(AXIS2_CLIENT_PATH,axis2_xml);
+
+ return configContext;
+ }
+
+ private void setUpOptions (Options clientOptions) {
+ clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportToEPR);
+// clientOptions.setProperty(Options.COPY_PROPERTIES, new Boolean (true));
+ clientOptions.setTo(new EndpointReference (toEPR));
+
+ String sequenceKey = "sequence1";
+ clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
+
+// clientOptions.setProperty(MessageContextConstants.CHUNKED,Constants.VALUE_FALSE); //uncomment this to send messages without chunking.
+
+ clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); //uncomment this to send messages in SOAP 1.2
+// clientOptions.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,AddressingConstants.Submission.WSA_NAMESPACE);
+ clientOptions.setProperty(SandeshaClientConstants.RM_SPEC_VERSION,Sandesha2Constants.SPEC_VERSIONS.v1_1); //uncomment this to send the messages according to the v1_1 spec.
+
+ clientOptions.setAction("urn:wsrm:Ping");
+
+ }
+
+
+}
Added: webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_1_2.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_1_2.java?view=auto&rev=531722
==============================================================================
--- webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_1_2.java (added)
+++ webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_1_2.java Mon Apr 23 21:57:43 2007
@@ -0,0 +1,227 @@
+/*
+ * 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 org.apache.sandesha2.interop.rm1_1_clients;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.soap.SOAP11Constants;
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.context.MessageContextConstants;
+import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.client.SandeshaClient;
+import org.apache.sandesha2.client.SandeshaClientConstants;
+import org.apache.sandesha2.client.SequenceReport;
+import org.apache.sandesha2.interop.RMInteropServiceStub;
+
+public class Scenario_1_2 {
+
+ private static final String applicationNamespaceName = "http://tempuri.org/";
+ private static final String ping = "ping";
+ private static final String Text = "Text";
+
+ private static String toIP = "127.0.0.1";
+ private static String toPort = "9762";
+ private static String transportToIP = "127.0.0.1";
+ private static String transportToPort = "8070";
+ private static String servicePart = "/axis2/services/RMInteropService";
+ private static String toEPR = "http://" + toIP + ":" + toPort + servicePart;
+ private static String transportToEPR = "http://" + transportToIP + ":" + transportToPort + servicePart;
+
+ private static String SANDESHA2_HOME = "<SANDESHA2_HOME>"; //Change this to ur path.
+
+ private static String AXIS2_CLIENT_PATH = SANDESHA2_HOME + File.separator + "target" + File.separator +"repos" + File.separator + "client" + File.separator; //this will be available after a maven build
+
+ public static void main(String[] args) throws Exception {
+
+ String axisClientRepo = null;
+ if (args!=null && args.length>0)
+ axisClientRepo = args[0];
+
+ if (axisClientRepo!=null && !"".equals(axisClientRepo)) {
+ AXIS2_CLIENT_PATH = axisClientRepo;
+ SANDESHA2_HOME = "";
+ }
+
+ InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream("sandesha2_interop.properties");
+
+ Properties properties = new Properties();
+ if (in != null) {
+ properties.load(in);
+
+ toEPR = properties.getProperty("to");
+ transportToEPR = properties.getProperty("transportTo");
+ }
+
+ new Scenario_1_2 ().run();
+// new Scenario_1_2 ().runStubBased ();
+ }
+
+ private void run () throws Exception {
+
+ ConfigurationContext configurationContext = generateConfigContext();
+ Options clientOptions = new Options ();
+ setUpOptions(clientOptions);
+
+ ServiceClient serviceClient = new ServiceClient (configurationContext,null);
+ serviceClient.setOptions(clientOptions);
+
+ SandeshaClient.createSequence(serviceClient, false);
+
+ SequenceReport sequenceReport = null;
+ boolean established = false;
+ while (!established) {
+ sequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
+ if (sequenceReport!=null && sequenceReport.getSequenceStatus()>=SequenceReport.SEQUENCE_STATUS_ESTABLISHED)
+ established = true;
+ else {
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e1) {
+ e1.printStackTrace();
+ }
+ }
+ }
+
+ SandeshaClient.sendAckRequest(serviceClient);
+
+ SandeshaClient.terminateSequence(serviceClient);
+
+ boolean terminated = false;
+ while (!terminated) {
+ sequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
+ if (sequenceReport!=null && sequenceReport.getSequenceStatus()==SequenceReport.SEQUENCE_STATUS_TERMINATED)
+ terminated = true;
+ else {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e1) {
+ e1.printStackTrace();
+ }
+ }
+ }
+
+ serviceClient.cleanup();
+ configurationContext.getListenerManager().stop();
+ }
+
+ private static OMElement getPingOMBlock(String text) {
+ OMFactory fac = OMAbstractFactory.getOMFactory();
+ OMNamespace namespace = fac.createOMNamespace(applicationNamespaceName,"ns1");
+ OMElement pingElem = fac.createOMElement(ping, namespace);
+ OMElement textElem = fac.createOMElement(Text, namespace);
+
+ textElem.setText(text);
+ pingElem.addChild(textElem);
+
+ return pingElem;
+ }
+
+
+ private void runStubBased () throws Exception {
+ String targetEndpoint = toEPR;
+ ConfigurationContext configurationContext = generateConfigContext();
+
+ RMInteropServiceStub stub = new RMInteropServiceStub (configurationContext, targetEndpoint);
+
+ setUpOptions(stub._getServiceClient().getOptions());
+ ServiceClient stubServiceClient = stub._getServiceClient();
+ Options clientOptions = stubServiceClient.getOptions();
+
+// stubServiceClient.setOptions(clientOptions);
+
+ setUpOptions(clientOptions);
+
+ SandeshaClient.createSequence(stubServiceClient, false);
+
+ SequenceReport sequenceReport = null;
+ boolean established = false;
+ while (!established) {
+ sequenceReport = SandeshaClient.getOutgoingSequenceReport(stubServiceClient);
+ if (sequenceReport!=null && sequenceReport.getSequenceStatus()>=SequenceReport.SEQUENCE_STATUS_ESTABLISHED)
+ established = true;
+ else {
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e1) {
+ e1.printStackTrace();
+ }
+ }
+ }
+
+ SandeshaClient.sendAckRequest(stubServiceClient);
+
+ SandeshaClient.terminateSequence(stubServiceClient);
+
+ boolean terminated = false;
+ while (!terminated) {
+ sequenceReport = SandeshaClient.getOutgoingSequenceReport(stubServiceClient);
+ if (sequenceReport!=null && sequenceReport.getSequenceStatus()==SequenceReport.SEQUENCE_STATUS_TERMINATED)
+ terminated = true;
+ else {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e1) {
+ e1.printStackTrace();
+ }
+ }
+ }
+
+ }
+
+ private ConfigurationContext generateConfigContext () throws Exception {
+ if ("<SANDESHA2_HOME>".equals(SANDESHA2_HOME)){
+ System.out.println("ERROR: Please change <SANDESHA2_HOME> to your Sandesha2 installation directory.");
+ throw new Exception ("Client not set up correctly");
+ }
+
+ String axis2_xml = AXIS2_CLIENT_PATH + "client_axis2.xml";
+ ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(AXIS2_CLIENT_PATH,axis2_xml);
+
+ return configContext;
+ }
+
+ private void setUpOptions (Options clientOptions) {
+ clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportToEPR);
+ clientOptions.setTo(new EndpointReference (toEPR));
+
+ String sequenceKey = "sequence1";
+ clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
+
+// clientOptions.setProperty(MessageContextConstants.CHUNKED,Constants.VALUE_FALSE); //uncomment this to send messages without chunking.
+ clientOptions.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI); //uncomment this to send messages in SOAP 1.2
+// clientOptions.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,AddressingConstants.Submission.WSA_NAMESPACE);
+ clientOptions.setProperty(SandeshaClientConstants.RM_SPEC_VERSION,Sandesha2Constants.SPEC_VERSIONS.v1_1); //uncomment this to send the messages according to the v1_1 spec.
+
+ clientOptions.setAction("urn:wsrm:Ping");
+ }
+
+
+}
Added: webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_1_3.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_1_3.java?view=auto&rev=531722
==============================================================================
--- webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_1_3.java (added)
+++ webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_1_3.java Mon Apr 23 21:57:43 2007
@@ -0,0 +1,234 @@
+/*
+ * 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 org.apache.sandesha2.interop.rm1_1_clients;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.context.MessageContextConstants;
+import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.client.SandeshaClient;
+import org.apache.sandesha2.client.SandeshaClientConstants;
+import org.apache.sandesha2.client.SequenceReport;
+import org.apache.sandesha2.interop.RMInteropServiceStub;
+import org.tempuri.Ping;
+
+public class Scenario_1_3 {
+
+ private static final String applicationNamespaceName = "http://tempuri.org/";
+ private static final String ping = "ping";
+ private static final String Text = "Text";
+
+ private static String toIP = "127.0.0.1";
+ private static String toPort = "9762";
+ private static String transportToIP = "127.0.0.1";
+ private static String transportToPort = "8070";
+ private static String servicePart = "/axis2/services/RMInteropService";
+ private static String toEPR = "http://" + toIP + ":" + toPort + servicePart;
+ private static String transportToEPR = "http://" + transportToIP + ":" + transportToPort + servicePart;
+
+ private static String SANDESHA2_HOME = "<SANDESHA2_HOME>"; //Change this to ur path.
+
+ private static String AXIS2_CLIENT_PATH = SANDESHA2_HOME + File.separator + "target" + File.separator +"repos" + File.separator + "client" + File.separator; //this will be available after a maven build
+
+ public static void main(String[] args) throws Exception {
+
+ String axisClientRepo = null;
+ if (args!=null && args.length>0)
+ axisClientRepo = args[0];
+
+ if (axisClientRepo!=null && !"".equals(axisClientRepo)) {
+ AXIS2_CLIENT_PATH = axisClientRepo;
+ SANDESHA2_HOME = "";
+ }
+
+ InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream("sandesha2_interop.properties");
+
+ Properties properties = new Properties();
+ if (in != null) {
+ properties.load(in);
+
+ toEPR = properties.getProperty("to");
+ transportToEPR = properties.getProperty("transportTo");
+ }
+
+// new Scenario_1_3 ().run();
+ new Scenario_1_3 ().runStubBased ();
+
+ Thread.sleep(60000);
+ }
+
+ private void run () throws Exception {
+
+
+ ConfigurationContext configurationContext = generateConfigContext();
+
+ Options clientOptions = new Options ();
+ setUpOptions(clientOptions);
+
+ ServiceClient serviceClient = new ServiceClient (configurationContext,null);
+ serviceClient.setOptions(clientOptions);
+
+ clientOptions.setProperty(SandeshaClientConstants.MESSAGE_NUMBER,new Long(1));
+ serviceClient.fireAndForget(getPingOMBlock("ping1"));
+
+ clientOptions.setProperty(SandeshaClientConstants.MESSAGE_NUMBER,new Long(3));
+ serviceClient.fireAndForget(getPingOMBlock("ping3"));
+
+ boolean complete = false;
+ while (!complete) {
+ SequenceReport sequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
+ if (sequenceReport!=null && sequenceReport.getCompletedMessages().size()==2)
+ complete = true;
+ else {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e1) {
+ e1.printStackTrace();
+ }
+ }
+ }
+
+ SandeshaClient.closeSequence(serviceClient);
+
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+
+ SandeshaClient.terminateSequence(serviceClient);
+
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+
+ configurationContext.getListenerManager().stop();
+ serviceClient.cleanup();
+ }
+
+ private static OMElement getPingOMBlock(String text) {
+ OMFactory fac = OMAbstractFactory.getOMFactory();
+ OMNamespace namespace = fac.createOMNamespace(applicationNamespaceName,"ns1");
+ OMElement pingElem = fac.createOMElement(ping, namespace);
+ OMElement textElem = fac.createOMElement(Text, namespace);
+
+ textElem.setText(text);
+ pingElem.addChild(textElem);
+
+ return pingElem;
+ }
+
+ private void runStubBased () throws Exception {
+
+ ConfigurationContext configurationContext = generateConfigContext();
+ RMInteropServiceStub stub = new RMInteropServiceStub (configurationContext,toEPR);
+ ServiceClient stubServiceClient = stub._getServiceClient();
+
+ Options options = stubServiceClient.getOptions();
+ setUpOptions(options);
+
+ options.setProperty(SandeshaClientConstants.MESSAGE_NUMBER,new Long(1));
+ Ping ping = new Ping ();
+ ping.setText("ping1");
+ stub.Ping(ping);
+
+ options.setProperty(SandeshaClientConstants.MESSAGE_NUMBER,new Long(3));
+ ping = new Ping ();
+ ping.setText("ping2");
+ stub.Ping(ping);
+
+ boolean complete = false;
+ while (!complete) {
+ SequenceReport sequenceReport = SandeshaClient.getOutgoingSequenceReport(stubServiceClient);
+ if (sequenceReport!=null && sequenceReport.getCompletedMessages().size()==2)
+ complete = true;
+ else {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e1) {
+ e1.printStackTrace();
+ }
+ }
+ }
+
+ SandeshaClient.closeSequence(stubServiceClient);
+
+ try {
+ Thread.sleep(6000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+
+ SandeshaClient.terminateSequence(stubServiceClient);
+
+ try {
+ Thread.sleep(3000000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+
+ stubServiceClient.cleanup();
+
+
+ }
+
+ private ConfigurationContext generateConfigContext () throws Exception {
+ if ("<SANDESHA2_HOME>".equals(SANDESHA2_HOME)){
+ System.out.println("ERROR: Please change <SANDESHA2_HOME> to your Sandesha2 installation directory.");
+ throw new Exception ("Client not set up correctly");
+ }
+
+ String axis2_xml = AXIS2_CLIENT_PATH + "client_axis2.xml";
+ ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(AXIS2_CLIENT_PATH,axis2_xml);
+
+ return configContext;
+ }
+
+ private void setUpOptions (Options clientOptions) {
+ clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportToEPR);
+// clientOptions.setProperty(Options.COPY_PROPERTIES, new Boolean (true));
+ clientOptions.setTo(new EndpointReference (toEPR));
+
+ String sequenceKey = "sequence1";
+ clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
+
+// clientOptions.setProperty(MessageContextConstants.CHUNKED,Constants.VALUE_FALSE); //uncomment this to send messages without chunking.
+ clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); //uncomment this to send messages in SOAP 1.2
+// clientOptions.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,AddressingConstants.Submission.WSA_NAMESPACE);
+ clientOptions.setProperty(SandeshaClientConstants.RM_SPEC_VERSION,Sandesha2Constants.SPEC_VERSIONS.v1_1); //uncomment this to send the messages according to the v1_1 spec.
+
+ clientOptions.setAction("urn:wsrm:Ping");
+
+ }
+
+}
Added: webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_1_4.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_1_4.java?view=auto&rev=531722
==============================================================================
--- webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_1_4.java (added)
+++ webservices/sandesha/trunk/java/modules/interop/src/main/java/org/apache/sandesha2/interop/rm1_1_clients/Scenario_1_4.java Mon Apr 23 21:57:43 2007
@@ -0,0 +1,231 @@
+/*
+ * 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 org.apache.sandesha2.interop.rm1_1_clients;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.context.MessageContextConstants;
+import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.client.SandeshaClient;
+import org.apache.sandesha2.client.SandeshaClientConstants;
+import org.apache.sandesha2.client.SequenceReport;
+import org.apache.sandesha2.interop.RMInteropServiceStub;
+import org.tempuri.Ping;
+
+public class Scenario_1_4 {
+
+ private static final String applicationNamespaceName = "http://tempuri.org/";
+
+ private static final String ping = "ping";
+
+ private static final String Text = "Text";
+
+ private static String toIP = "127.0.0.1";
+ private static String toPort = "9762";
+ private static String transportToIP = "127.0.0.1";
+ private static String transportToPort = "8070";
+ private static String servicePart = "/axis2/services/RMInteropService";
+ private static String toEPR = "http://" + toIP + ":" + toPort + servicePart;
+ private static String transportToEPR = "http://" + transportToIP + ":" + transportToPort + servicePart;
+
+ private static String SANDESHA2_HOME = "<SANDESHA2_HOME>"; // Change
+ // this
+ // to
+ // ur
+ // path.
+
+ private static String AXIS2_CLIENT_PATH = SANDESHA2_HOME + File.separator
+ + "target" + File.separator + "repos" + File.separator + "client"
+ + File.separator; // this will be available after a maven build
+
+ public static void main(String[] args) throws Exception {
+
+ String axisClientRepo = null;
+ if (args != null && args.length > 0)
+ axisClientRepo = args[0];
+
+ if (axisClientRepo != null && !"".equals(axisClientRepo)) {
+ AXIS2_CLIENT_PATH = axisClientRepo;
+ SANDESHA2_HOME = "";
+ }
+
+ InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream("sandesha2_interop.properties");
+
+ Properties properties = new Properties();
+ if (in != null) {
+ properties.load(in);
+
+ toEPR = properties.getProperty("to");
+ transportToEPR = properties.getProperty("transportTo");
+ }
+
+// new Scenario_1_4().run();
+ new Scenario_1_4().runStubBased ();
+ }
+
+ private void run() throws Exception {
+
+ ConfigurationContext configurationContext = generateConfigContext();
+
+ ServiceClient serviceClient = new ServiceClient(configurationContext, null);
+
+// String replyAddress = serviceClient.getMyEPR(Constants.TRANSPORT_HTTP).getAddress() + "/" + ServiceClient.ANON_OUT_ONLY_OP;
+ String acksToAddress = serviceClient.getMyEPR(Constants.TRANSPORT_HTTP).getAddress();
+
+ Options clientOptions = new Options();
+ setUpOptions(clientOptions,acksToAddress);
+
+ serviceClient.setOptions(clientOptions);
+
+ serviceClient.fireAndForget(getPingOMBlock("ping1"));
+ serviceClient.fireAndForget(getPingOMBlock("ping2"));
+ serviceClient.fireAndForget(getPingOMBlock("ping3"));
+
+ boolean complete = false;
+ while (!complete) {
+ SequenceReport sequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
+ if (sequenceReport!=null && sequenceReport.getCompletedMessages().size()==3)
+ complete = true;
+ else {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e1) {
+ e1.printStackTrace();
+ }
+ }
+ }
+
+ SandeshaClient.terminateSequence(serviceClient);
+
+ Thread.sleep(3000);
+
+ configurationContext.getListenerManager().stop();
+ serviceClient.cleanup();
+ }
+
+ private static OMElement getPingOMBlock(String text) {
+ OMFactory fac = OMAbstractFactory.getOMFactory();
+ OMNamespace namespace = fac.createOMNamespace(applicationNamespaceName,
+ "ns1");
+ OMElement pingElem = fac.createOMElement(ping, namespace);
+ OMElement textElem = fac.createOMElement(Text, namespace);
+
+ textElem.setText(text);
+ pingElem.addChild(textElem);
+
+ return pingElem;
+ }
+
+ private void runStubBased () throws Exception {
+ String targetEndpoint = toEPR;
+ ConfigurationContext configurationContext = generateConfigContext();
+
+ RMInteropServiceStub stub = new RMInteropServiceStub (configurationContext, targetEndpoint);
+ ServiceClient stubServiceClient = stub._getServiceClient();
+
+ String acksToAddress = stubServiceClient.getMyEPR(Constants.TRANSPORT_HTTP).getAddress();
+
+ setUpOptions(stubServiceClient.getOptions(),acksToAddress);
+
+ Ping ping = new Ping ();
+ ping.setText("ping1");
+ stub.Ping(ping);
+
+ ping = new Ping ();
+ ping.setText("ping2");
+ stub.Ping(ping);
+
+ ping = new Ping ();
+ ping.setText("ping3");
+ stub.Ping(ping);
+
+ SequenceReport sequenceReport = null;
+ boolean complete = false;
+ while (!complete) {
+ sequenceReport = SandeshaClient.getOutgoingSequenceReport(stubServiceClient);
+ if (sequenceReport!=null && sequenceReport.getCompletedMessages().size()==3)
+ complete = true;
+ else {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e1) {
+ e1.printStackTrace();
+ }
+ }
+ }
+
+ Thread.sleep(3000);
+
+ SandeshaClient.terminateSequence(stubServiceClient);
+
+ Thread.sleep(6000);
+
+ stub._getServiceClient().cleanup();
+
+ }
+
+ private ConfigurationContext generateConfigContext () throws Exception {
+ if ("<SANDESHA2_HOME>".equals(SANDESHA2_HOME)){
+ System.out.println("ERROR: Please change <SANDESHA2_HOME> to your Sandesha2 installation directory.");
+ throw new Exception ("Client not set up correctly");
+ }
+
+ String axis2_xml = AXIS2_CLIENT_PATH + "client_axis2.xml";
+ ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(AXIS2_CLIENT_PATH,axis2_xml);
+
+ return configContext;
+ }
+
+ private void setUpOptions (Options clientOptions, String acksTo) {
+ clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportToEPR);
+// clientOptions.setProperty(Options.COPY_PROPERTIES, new Boolean (true));
+ clientOptions.setTo(new EndpointReference (toEPR));
+
+ String sequenceKey = "sequence1";
+ clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
+
+// clientOptions.setProperty(MessageContextConstants.CHUNKED,Constants.VALUE_FALSE); //uncomment this to send messages without chunking.
+
+ clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); //uncomment this to send messages in SOAP 1.2
+// clientOptions.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,AddressingConstants.Submission.WSA_NAMESPACE);
+ clientOptions.setProperty(SandeshaClientConstants.RM_SPEC_VERSION,Sandesha2Constants.SPEC_VERSIONS.v1_1); //uncomment this to send the messages according to the v1_1 spec.
+
+ clientOptions.setAction("urn:wsrm:Ping");
+
+ clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
+
+ clientOptions.setProperty(SandeshaClientConstants.AcksTo, acksTo);
+ clientOptions.setReplyTo(new EndpointReference (acksTo)); //making replyTo value same as AcksTo.
+
+
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org