You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by ch...@apache.org on 2005/11/06 20:01:26 UTC

svn commit: r331139 - in /webservices/sandesha/trunk/interop/src/org/apache/sandesha2/interop/microsoft: MicrosoftAsyncEchoClient.java MicrosoftAsyncPingClient.java MicrosoftSyncPingClient.java

Author: chamikara
Date: Sun Nov  6 11:00:59 2005
New Revision: 331139

URL: http://svn.apache.org/viewcvs?rev=331139&view=rev
Log:
Test clients to interop test with microsoft.

Added:
    webservices/sandesha/trunk/interop/src/org/apache/sandesha2/interop/microsoft/MicrosoftAsyncEchoClient.java
    webservices/sandesha/trunk/interop/src/org/apache/sandesha2/interop/microsoft/MicrosoftAsyncPingClient.java
Modified:
    webservices/sandesha/trunk/interop/src/org/apache/sandesha2/interop/microsoft/MicrosoftSyncPingClient.java

Added: webservices/sandesha/trunk/interop/src/org/apache/sandesha2/interop/microsoft/MicrosoftAsyncEchoClient.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/interop/src/org/apache/sandesha2/interop/microsoft/MicrosoftAsyncEchoClient.java?rev=331139&view=auto
==============================================================================
--- webservices/sandesha/trunk/interop/src/org/apache/sandesha2/interop/microsoft/MicrosoftAsyncEchoClient.java (added)
+++ webservices/sandesha/trunk/interop/src/org/apache/sandesha2/interop/microsoft/MicrosoftAsyncEchoClient.java Sun Nov  6 11:00:59 2005
@@ -0,0 +1,116 @@
+/*
+ * 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.microsoft;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.clientapi.AsyncResult;
+import org.apache.axis2.clientapi.Call;
+import org.apache.axis2.clientapi.Callback;
+import org.apache.axis2.clientapi.MessageSender;
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMFactory;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.soap.SOAP12Constants;
+import org.apache.sandesha2.Constants;
+import org.apache.sandesha2.util.SandeshaUtil;
+
+public class MicrosoftAsyncEchoClient {
+	private static String to = "http://131.107.72.15/ReliableMessaging_Service_Indigo/ReliableRequestReplyDual.svc"; // IP: 131.107.153.195  port:80
+
+	private static String replyTo = "http://localhost:9070/axis/services/RMSampleService";
+	
+	private static String SANDESHA_HOME = "<SANDESHA2_HOME>"; //Change this to ur path.
+	
+	private static String AXIS2_CLIENT_PATH = SANDESHA_HOME + "target\\client\\";   //this will be available after a maven build
+	
+	public static void main(String[] args) throws AxisFault {
+		new MicrosoftAsyncEchoClient ().run();
+	}
+	
+	private void run () throws AxisFault {
+		Call call = new Call(AXIS2_CLIENT_PATH);
+		call.engageModule(new QName("sandesha"));
+		call.set(Constants.AcksTo,"http://203.94.94.136:9080/axis2/services/AnonymousService/echoString"); //Optional
+		
+		call.setTo(new EndpointReference(to));
+		
+		call.set(Constants.OFFERED_SEQUENCE_ID,SandeshaUtil.getUUID());  //Optional
+		call.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+		call.setTransportInfo(org.apache.axis2.Constants.TRANSPORT_HTTP,org.apache.axis2.Constants.TRANSPORT_HTTP,true);
+		//Callback callback1 = new TestCallback ("Callback 1");
+		//call.invokeNonBlocking("echoString", getEchoOMBlock("echo1"),callback1);
+		//Callback callback2 = new TestCallback ("Callback 2");
+		//call.invokeNonBlocking("echoString", getEchoOMBlock("echo2"),callback2);
+		call.set(Constants.LAST_MESSAGE, "true");
+		Callback callback3 = new TestCallback ("Callback 3");
+		call.invokeNonBlocking("EchoString", getEchoOMBlock("echo3"),callback3);
+	}
+
+
+	private static OMElement getEchoOMBlock(String text) {
+		OMFactory fac = OMAbstractFactory.getOMFactory();
+		OMNamespace defaultNS = fac.createOMNamespace("",null);
+		OMElement echoElement = fac.createOMElement("echoString", defaultNS);
+		OMElement paramElement = fac.createOMElement("text", defaultNS);
+		echoElement.addChild(paramElement);
+		paramElement.setText(text);
+
+		return echoElement;
+	}
+
+	class TestCallback extends Callback {
+
+		String name = null;
+		
+		public TestCallback (String name) {
+			this.name = name;
+		}
+		
+		public void onComplete(AsyncResult result) {
+			//System.out.println("On Complete Called for " + text);
+			OMElement responseElement = result.getResponseEnvelope().getBody().getFirstElement();
+			if (responseElement==null) {
+				System.out.println("Response element is null");
+				return;
+			}
+			
+			String tempText = responseElement.getText();
+			if (tempText==null || "".equals(tempText)){
+				OMElement child = responseElement.getFirstElement();
+				if (child!=null)
+					tempText = child.getText();
+			}
+			
+			
+			tempText = (tempText==null)?"":tempText;
+			
+			System.out.println("Callback '" + name +  "' got result:" + tempText);
+			
+		}
+
+		public void reportError(Exception e) {
+			// TODO Auto-generated method stub
+			System.out.println("Error reported for test call back");
+		}
+	}
+
+	
+}

Added: webservices/sandesha/trunk/interop/src/org/apache/sandesha2/interop/microsoft/MicrosoftAsyncPingClient.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/interop/src/org/apache/sandesha2/interop/microsoft/MicrosoftAsyncPingClient.java?rev=331139&view=auto
==============================================================================
--- webservices/sandesha/trunk/interop/src/org/apache/sandesha2/interop/microsoft/MicrosoftAsyncPingClient.java (added)
+++ webservices/sandesha/trunk/interop/src/org/apache/sandesha2/interop/microsoft/MicrosoftAsyncPingClient.java Sun Nov  6 11:00:59 2005
@@ -0,0 +1,88 @@
+/*
+ * 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.microsoft;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.clientapi.MessageSender;
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMFactory;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.soap.SOAP12Constants;
+import org.apache.sandesha2.Constants;
+
+/**
+ * @author chamikara
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+
+public class MicrosoftAsyncPingClient {
+
+	private static String to = "http://131.107.72.15/ReliableMessaging_Service_Indigo/ReliableOneWayDual.svc";   //IP : 131.107.153.195  Port:80
+
+	private static String SANDESHA2_HOME = "<SANDESHA2_HOME>"; //Change this to ur path.
+	
+	private static String AXIS2_CLIENT_PATH = SANDESHA2_HOME + "\\target\\client\\";   //this will be available after a maven build
+	
+	public static void main(String[] args) throws AxisFault {
+		new MicrosoftAsyncPingClient ().run();
+	}
+	
+	public void run () throws AxisFault {
+		
+		if ("<SANDESHA2_HOME>".equals(SANDESHA2_HOME)){
+			System.out.println("ERROR: Please change <SANDESHA2_HOME> to your Sandesha2 installation directory.");
+			return;
+		}
+		
+		MessageSender sender = new MessageSender (AXIS2_CLIENT_PATH);
+		sender.engageModule(new QName ("sandesha"));
+		
+		sender.set(Constants.SANDESHA_DEBUG_MODE,"on");   //Sets the debug on for sandesha.
+		sender.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+		sender.setTo(new EndpointReference(to));
+		sender.set(Constants.AcksTo,"http://203.94.94.136:9080/axis2/services/AnonymousService/echoString");
+		sender.setReplyTo(new EndpointReference ("http://203.94.94.136:9080/axis2/services/AnonymousService/echoString"));
+		sender.setFaultTo(new EndpointReference ("http://203.94.94.136:9080/axis2/services/AnonymousService/echoString"));
+		sender.set(Constants.SEQUENCE_KEY,"sequence1");
+		sender.setSoapAction("urn:wsrm:Ping");
+		sender.setWsaAction("urn:wsrm:Ping");
+  		//sender.send("ping",getPingOMBlock("ping1"));
+		//sender.send("ping",getPingOMBlock("ping2"));
+		sender.set(Constants.LAST_MESSAGE, "true");
+		sender.send("ping",getPingOMBlock("ping3"));
+	}
+	
+	private static OMElement getPingOMBlock(String text) {
+		OMFactory fac = OMAbstractFactory.getOMFactory();
+		OMNamespace ns = fac.createOMNamespace("http://tempuri.apache.org",
+				"ns1");
+		OMNamespace defautNS = fac.createOMNamespace("",null);
+		OMElement pingElement = fac.createOMElement("Ping", ns);
+		OMElement paramElement = fac.createOMElement("Text", defautNS);
+		pingElement.addChild(paramElement);
+		paramElement.setText(text);
+
+		return pingElement;
+	}
+
+}

Modified: webservices/sandesha/trunk/interop/src/org/apache/sandesha2/interop/microsoft/MicrosoftSyncPingClient.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/interop/src/org/apache/sandesha2/interop/microsoft/MicrosoftSyncPingClient.java?rev=331139&r1=331138&r2=331139&view=diff
==============================================================================
--- webservices/sandesha/trunk/interop/src/org/apache/sandesha2/interop/microsoft/MicrosoftSyncPingClient.java (original)
+++ webservices/sandesha/trunk/interop/src/org/apache/sandesha2/interop/microsoft/MicrosoftSyncPingClient.java Sun Nov  6 11:00:59 2005
@@ -21,16 +21,19 @@
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.clientapi.MessageSender;
+import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.om.OMAbstractFactory;
 import org.apache.axis2.om.OMElement;
 import org.apache.axis2.om.OMFactory;
 import org.apache.axis2.om.OMNamespace;
 import org.apache.axis2.om.impl.llom.OMNamespaceImpl;
+import org.apache.axis2.soap.SOAP12Constants;
+import org.apache.axis2.transport.http.HTTPConstants;
 import org.apache.sandesha2.Constants;
 
 public class MicrosoftSyncPingClient {
 
-	private static String to = "http://131.107.153.195/RM/svc/ReliableOneWay.svc";   //IP : 131.107.153.195  Port:80
+	private static String to = "http://131.107.72.15/ReliableMessaging_Service_Indigo/ReliableOneWay.svc";   //IP : 131.107.153.195  Port:80
 
 	private static String SANDESHA2_HOME = "<SANDESHA2_HOME>"; //Change this to ur path.
 	
@@ -52,12 +55,14 @@
 		
 		sender.set(Constants.SANDESHA_DEBUG_MODE,"on");   //Sets the debug on for sandesha.
 		
-		sender.setTo(new EndpointReference(to));
+		sender.setTo(new EndpointReference("http://131.107.72.15/ReliableMessaging_Service_Indigo/ReliableOneWay.svc"));
+		sender.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
 		sender.set(Constants.SEQUENCE_KEY,"sequence1");
+		sender.setSenderTransport(org.apache.axis2.Constants.TRANSPORT_HTTP);
 		sender.setSoapAction("urn:wsrm:Ping");
 		sender.setWsaAction("urn:wsrm:Ping");
-  		sender.send("ping",getPingOMBlock("ping1"));
-		sender.send("ping",getPingOMBlock("ping2"));
+  		//sender.send("ping",getPingOMBlock("ping1"));
+		//sender.send("ping",getPingOMBlock("ping2"));
 		sender.set(Constants.LAST_MESSAGE, "true");
 		sender.send("ping",getPingOMBlock("ping3"));
 	}



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