svn commit: r717994 - /webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/

[email protected]
Newsgroups gmane.comp.apache.webservices.fx.devel
Message-ID <[email protected]>
Author: davidillsley
Date: Sun Nov 16 01:34:43 2008
New Revision: 717994

URL: http://svn.apache.org/viewvc?rev=717994&view=rev
Log:
Remove use of deprecated stuff from the user samples

Added:
    webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/TestCallback.java
Modified:
    webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/AnonEchoClient.java
    webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/AsyncEchoBlockingClient.java
    webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/AsyncEchoClient.java
    webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/AsyncEchoWithPollingClient.java
    webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/MTOMPingClient.java
    webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/SyncEchoClient.java
    webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/SyncPingClient.java
    webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/UserguideEchoClient.java

Modified: webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/AnonEchoClient.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/AnonEchoClient.java?rev=717994&r1=717993&r2=717994&view=diff
==============================================================================
--- webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/AnonEchoClient.java (original)
+++ webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/AnonEchoClient.java Sun Nov 16 01:34:43 2008
@@ -15,36 +15,29 @@
 
 import java.io.File;
 
-import javax.xml.namespace.QName;
-
 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.axiom.soap.SOAPBody;
 import org.apache.axis2.Constants;
+import org.apache.axis2.Constants.Configuration;
 import org.apache.axis2.addressing.AddressingConstants;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.client.Options;
 import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.client.async.AsyncResult;
-import org.apache.axis2.client.async.Callback;
 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.SandeshaClientConstants;
 import org.apache.sandesha2.util.SandeshaUtil;
 
-public class AnonEchoClient {
+public class AnonEchoClient{
 	
 	private final static String applicationNamespaceName = "http://tempuri.org/"; 
 	private final static String echoString = "echoString";
 	private final static String Text = "Text";
 	private final static String Sequence = "Sequence";
-	private final static String echoStringResponse = "echoStringResponse";
-	private final static String EchoStringReturn = "EchoStringReturn";
 	
 	private String toIP = "127.0.0.1";
 	
@@ -97,7 +90,7 @@
 		
 		clientOptions.setReplyTo(new EndpointReference (AddressingConstants.Submission.WSA_ANONYMOUS_URL));
 		
-		clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportToEPR);
+		clientOptions.setProperty(Configuration.TRANSPORT_URL,transportToEPR);
 		
 		clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);   //uncomment this to send messages in SOAP 1.2
 		
@@ -110,7 +103,7 @@
 		clientOptions.setProperty(Constants.Configuration.USE_CUSTOM_LISTENER, Boolean.TRUE);
 		clientOptions.setProperty(SandeshaClientConstants.RM_SPEC_VERSION, Sandesha2Constants.SPEC_VERSIONS.v1_0);
 		
-		serviceClient.engageModule(new QName ("sandesha2"));
+		serviceClient.engageModule("sandesha2");
 		
 		//You must set the following two properties in the request-reply case.
 		clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
@@ -120,15 +113,15 @@
 		
 		serviceClient.setOptions(clientOptions);
 
-		Callback callback1 = new TestCallback ("Callback 1");
+		TestCallback callback1 = new TestCallback ("Callback 1");
 		serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo1",sequenceKey),callback1);
 		
-		Callback callback2 = new TestCallback ("Callback 2");
+		TestCallback callback2 = new TestCallback ("Callback 2");
 		serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo2",sequenceKey),callback2);
 		
 		clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
 		
-		Callback callback3 = new TestCallback ("Callback 3");
+		TestCallback callback3 = new TestCallback ("Callback 3");
 		serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo3",sequenceKey),callback3);
 		
         while (!callback3.isComplete()) {
@@ -152,45 +145,5 @@
 		echoStringElement.addChild(sequenceElem);
 		
 		return echoStringElement;
-	}
-
-	public class TestCallback extends Callback {
-
-		String name = null;
-		
-		public TestCallback () {
-			
-		}
-		
-		public TestCallback (String name) {
-			this.name = name;
-		}
-		
-		public void onComplete(AsyncResult result) {
-			//System.out.println("On Complete Called for " + text);
-			SOAPBody body = result.getResponseEnvelope().getBody();
-			
-			OMElement echoStringResponseElem = body.getFirstChildWithName(new QName (applicationNamespaceName,echoStringResponse));
-			if (echoStringResponseElem==null) { 
-				System.out.println("Error: SOAPBody does not have a 'echoStringResponse' child");
-				return;
-			}
-			
-			OMElement echoStringReturnElem = echoStringResponseElem.getFirstChildWithName(new QName (applicationNamespaceName,EchoStringReturn));
-			if (echoStringReturnElem==null) { 
-				System.out.println("Error: 'echoStringResponse' element does not have a 'EchoStringReturn' child");
-				return;
-			}
-			
-			String resultStr = echoStringReturnElem.getText();
-			System.out.println("Callback '" + name +  "' got result:" + resultStr);
-		}
-
-		public void onError (Exception e) {
-			System.out.println("Error reported for test call back");
-			e.printStackTrace();
-		}
-	}
-
-	
+	}	
 }

Modified: webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/AsyncEchoBlockingClient.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/AsyncEchoBlockingClient.java?rev=717994&r1=717993&r2=717994&view=diff
==============================================================================
--- webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/AsyncEchoBlockingClient.java (original)
+++ webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/AsyncEchoBlockingClient.java Sun Nov 16 01:34:43 2008
@@ -26,13 +26,13 @@
 import org.apache.axiom.soap.SOAP11Constants;
 import org.apache.axiom.soap.SOAP12Constants;
 import org.apache.axis2.Constants;
+import org.apache.axis2.Constants.Configuration;
 import org.apache.axis2.addressing.AddressingConstants;
 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.client.SandeshaClientConstants;
 import org.apache.sandesha2.util.SandeshaUtil;
 
@@ -96,7 +96,7 @@
 		String sequenceKey = "sequence4";
 		clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
 		
-		clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportToEPR);
+		clientOptions.setProperty(Configuration.TRANSPORT_URL,transportToEPR);
 		
 //		clientOptions.setProperty(MessageContextConstants.CHUNKED,Constants.VALUE_FALSE);   //uncomment this to send messages without chunking.
 		

Modified: webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/AsyncEchoClient.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/AsyncEchoClient.java?rev=717994&r1=717993&r2=717994&view=diff
==============================================================================
--- webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/AsyncEchoClient.java (original)
+++ webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/AsyncEchoClient.java Sun Nov 16 01:34:43 2008
@@ -18,24 +18,19 @@
 
 import java.io.File;
 
-import javax.xml.namespace.QName;
-
 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.axiom.soap.SOAPBody;
 import org.apache.axis2.Constants;
+import org.apache.axis2.Constants.Configuration;
 import org.apache.axis2.addressing.AddressingConstants;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.client.Options;
 import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.client.async.AsyncResult;
-import org.apache.axis2.client.async.Callback;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.axis2.context.MessageContextConstants;
 import org.apache.sandesha2.client.SandeshaClientConstants;
 import org.apache.sandesha2.util.SandeshaUtil;
 
@@ -45,8 +40,6 @@
 	private final static String echoString = "echoString";
 	private final static String Text = "Text";
 	private final static String Sequence = "Sequence";
-	private final static String echoStringResponse = "echoStringResponse";
-	private final static String EchoStringReturn = "EchoStringReturn";
 	
 	private String toIP = "127.0.0.1";
 	
@@ -106,7 +99,7 @@
 //		clientOptions.setProperty(SandeshaClientConstants.RM_SPEC_VERSION,Sandesha2Constants.SPEC_VERSIONS.v1_1);  //uncomment this to send the messages according to the v1_1 spec.
 //		serviceClient.engageModule(new QName ("sandesha2"));
 
-		clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportToEPR);
+		clientOptions.setProperty(Configuration.TRANSPORT_URL,transportToEPR);
 		
 		clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);   //uncomment this to send messages in SOAP 1.2
 
@@ -134,7 +127,7 @@
 //		serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo4",sequenceKey),callback4);
 
 		clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
-		Callback callback5 = new TestCallback ("Callback 5");
+		TestCallback callback5 = new TestCallback ("Callback 5");
 		serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo5",sequenceKey),callback5);
 		
         while (!callback5.isComplete()) {
@@ -162,45 +155,4 @@
 		
 		return echoStringElement;
 	}
-
-	public class TestCallback extends Callback {
-
-		String name = null;
-		
-		public TestCallback () {
-			
-		}
-		
-		public TestCallback (String name) {
-			this.name = name;
-		}
-		
-		public void onComplete(AsyncResult result) {
-			//System.out.println("On Complete Called for " + text);
-			SOAPBody body = result.getResponseEnvelope().getBody();
-			
-			OMElement echoStringResponseElem = body.getFirstChildWithName(new QName (applicationNamespaceName,echoStringResponse));
-			if (echoStringResponseElem==null) { 
-				System.out.println("Error: SOAPBody does not have a 'echoStringResponse' child");
-				return;
-			}
-			
-			OMElement echoStringReturnElem = echoStringResponseElem.getFirstChildWithName(new QName (applicationNamespaceName,EchoStringReturn));
-			if (echoStringReturnElem==null) { 
-				System.out.println("Error: 'echoStringResponse' element does not have a 'EchoStringReturn' child");
-				return;
-			}
-			
-			String resultStr = echoStringReturnElem.getText();
-			System.out.println("Callback '" + name +  "' got result:" + resultStr);
-		}
-
-		public void onError (Exception e) {
-			// TODO Auto-generated method stub
-			System.out.println("Error reported for test call back");
-			e.printStackTrace();
-		}
-	}
-
-	
 }

Modified: webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/AsyncEchoWithPollingClient.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/AsyncEchoWithPollingClient.java?rev=717994&r1=717993&r2=717994&view=diff
==============================================================================
--- webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/AsyncEchoWithPollingClient.java (original)
+++ webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/AsyncEchoWithPollingClient.java Sun Nov 16 01:34:43 2008
@@ -18,24 +18,19 @@
 
 import java.io.File;
 
-import javax.xml.namespace.QName;
-
 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.axiom.soap.SOAPBody;
 import org.apache.axis2.Constants;
+import org.apache.axis2.Constants.Configuration;
 import org.apache.axis2.addressing.AddressingConstants;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.client.Options;
 import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.client.async.AsyncResult;
-import org.apache.axis2.client.async.Callback;
 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;
@@ -47,8 +42,6 @@
 	private final static String echoString = "echoString";
 	private final static String Text = "Text";
 	private final static String Sequence = "Sequence";
-	private final static String echoStringResponse = "echoStringResponse";
-	private final static String EchoStringReturn = "EchoStringReturn";
 	
 	private String toIP = "127.0.0.1";
 	
@@ -105,7 +98,7 @@
 		
 		clientOptions.setReplyTo(new EndpointReference (AddressingConstants.Submission.WSA_ANONYMOUS_URL));
 		
-		clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportToEPR);
+		clientOptions.setProperty(Configuration.TRANSPORT_URL,transportToEPR);
 		
 		clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);   //uncomment this to send messages in SOAP 1.2
 		
@@ -123,13 +116,13 @@
 		
 		serviceClient.setOptions(clientOptions);
 
-		Callback callback1 = new TestCallback ("Callback 1");
+		TestCallback callback1 = new TestCallback ("Callback 1");
 		serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo1",sequenceKey),callback1);
 		
-		Callback callback2 = new TestCallback ("Callback 2");
+		TestCallback callback2 = new TestCallback ("Callback 2");
 		serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo1",sequenceKey),callback2);
 		
-		Callback callback3 = new TestCallback ("Callback 3");
+		TestCallback callback3 = new TestCallback ("Callback 3");
 		serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo1",sequenceKey),callback3);
 		
         while (!callback3.isComplete()) {
@@ -156,44 +149,4 @@
 		
 		return echoStringElement;
 	}
-
-	public class TestCallback extends Callback {
-
-		String name = null;
-		
-		public TestCallback () {
-			
-		}
-		
-		public TestCallback (String name) {
-			this.name = name;
-		}
-		
-		public void onComplete(AsyncResult result) {
-			//System.out.println("On Complete Called for " + text);
-			SOAPBody body = result.getResponseEnvelope().getBody();
-			
-			OMElement echoStringResponseElem = body.getFirstChildWithName(new QName (applicationNamespaceName,echoStringResponse));
-			if (echoStringResponseElem==null) { 
-				System.out.println("Error: SOAPBody does not have a 'echoStringResponse' child");
-				return;
-			}
-			
-			OMElement echoStringReturnElem = echoStringResponseElem.getFirstChildWithName(new QName (applicationNamespaceName,EchoStringReturn));
-			if (echoStringReturnElem==null) { 
-				System.out.println("Error: 'echoStringResponse' element does not have a 'EchoStringReturn' child");
-				return;
-			}
-			
-			String resultStr = echoStringReturnElem.getText();
-			System.out.println("Callback '" + name +  "' got result:" + resultStr);
-		}
-
-		public void onError (Exception e) {
-			System.out.println("Error reported for test call back");
-			e.printStackTrace();
-		}
-	}
-
-	
 }

Modified: webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/MTOMPingClient.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/MTOMPingClient.java?rev=717994&r1=717993&r2=717994&view=diff
==============================================================================
--- webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/MTOMPingClient.java (original)
+++ webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/MTOMPingClient.java Sun Nov 16 01:34:43 2008
@@ -20,7 +20,6 @@
 
 import javax.activation.DataHandler;
 import javax.activation.FileDataSource;
-import javax.xml.namespace.QName;
 
 import org.apache.axiom.om.OMAbstractFactory;
 import org.apache.axiom.om.OMElement;
@@ -29,12 +28,12 @@
 import org.apache.axiom.om.OMText;
 import org.apache.axiom.soap.SOAP12Constants;
 import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants.Configuration;
 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.client.SandeshaClient;
 import org.apache.sandesha2.client.SandeshaClientConstants;
 import org.apache.sandesha2.client.SandeshaListener;
@@ -83,7 +82,7 @@
 		ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(AXIS2_CLIENT_PATH,axis2_xml);
 		
 		Options clientOptions = new Options ();	
-		clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportToEPR);
+		clientOptions.setProperty(Configuration.TRANSPORT_URL,transportToEPR);
 		clientOptions.setTo(new EndpointReference (toEPR));
 		
 		String sequenceKey = SandeshaUtil.getUUID();// "sequence2";
@@ -96,7 +95,7 @@
 		
 		clientOptions.setProperty(SandeshaClientConstants.SANDESHA_LISTENER, new SandeshaListenerImpl ());
 		ServiceClient serviceClient = new ServiceClient (configContext,null);
-		serviceClient.engageModule(new QName ("sandesha2"));
+		serviceClient.engageModule("sandesha2");
 		
 		clientOptions.setAction("urn:wsrm:Ping");
 		serviceClient.setOptions(clientOptions);

Modified: webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/SyncEchoClient.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/SyncEchoClient.java?rev=717994&r1=717993&r2=717994&view=diff
==============================================================================
--- webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/SyncEchoClient.java (original)
+++ webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/SyncEchoClient.java Sun Nov 16 01:34:43 2008
@@ -18,19 +18,14 @@
 
 import java.io.File;
 
-import javax.xml.namespace.QName;
-
 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.SOAPBody;
 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.client.async.AsyncResult;
-import org.apache.axis2.client.async.Callback;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.ConfigurationContextFactory;
 import org.apache.sandesha2.client.SandeshaClientConstants;
@@ -42,8 +37,6 @@
 	private final static String echoString = "echoString";
 	private final static String Text = "Text";
 	private final static String Sequence = "Sequence";
-	private final static String echoStringResponse = "echoStringResponse";
-	private final static String EchoStringReturn = "EchoStringReturn";
 	
 	private String toIP = "127.0.0.1";
 	
@@ -101,17 +94,17 @@
 		
 		serviceClient.setOptions(clientOptions);
 		
-		Callback callback1 = new TestCallback ("Callback 1");
+		TestCallback callback1 = new TestCallback ("Callback 1");
 		serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo1",sequenceKey),callback1);
 		
 		clientOptions.setAction("urn:wsrm:EchoString");
-		Callback callback2 = new TestCallback ("Callback 2");
+		TestCallback callback2 = new TestCallback ("Callback 2");
 		serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo2",sequenceKey),callback2);
 		
 		clientOptions.setAction("urn:wsrm:EchoString");
 		
 		clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
-		Callback callback3 = new TestCallback ("Callback 3");
+		TestCallback callback3 = new TestCallback ("Callback 3");
 		serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo3",sequenceKey),callback3);
 		
         while (!callback3.isComplete()) {
@@ -133,44 +126,4 @@
 
 		return echoStringElement;
 	}
-
-	private class TestCallback extends Callback {
-
-		String name = null;
-		
-		public TestCallback (String name) {
-			this.name = name;
-		}
-		
-		public String toString () {
-			return name;
-		}
-		
-		public void onComplete(AsyncResult result) {
-			//System.out.println("On Complete Called for " + text);
-			SOAPBody body = result.getResponseEnvelope().getBody();
-			
-			OMElement echoStringResponseElem = body.getFirstChildWithName(new QName (applicationNamespaceName,echoStringResponse));
-			if (echoStringResponseElem==null) { 
-				System.out.println("Error: SOAPBody does not have a 'echoStringResponse' child");
-				return;
-			}
-			
-			OMElement echoStringReturnElem = echoStringResponseElem.getFirstChildWithName(new QName (applicationNamespaceName,EchoStringReturn));
-			if (echoStringReturnElem==null) { 
-				System.out.println("Error: 'echoStringResponse' element does not have a 'EchoStringReturn' child");
-				return;
-			}
-			
-			String resultStr = echoStringReturnElem.getText();
-			System.out.println("Callback '" + name +  "' got result:" + resultStr);
-			
-		}
-
-		public void onError(Exception e) {
-			// TODO Auto-generated method stub
-			System.out.println("Error reported for test call back");
-		}
-	}
-	
 }

Modified: webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/SyncPingClient.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/SyncPingClient.java?rev=717994&r1=717993&r2=717994&view=diff
==============================================================================
--- webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/SyncPingClient.java (original)
+++ webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/SyncPingClient.java Sun Nov 16 01:34:43 2008
@@ -22,14 +22,13 @@
 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.Configuration;
 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.client.SandeshaClient;
 import org.apache.sandesha2.client.SandeshaClientConstants;
 import org.apache.sandesha2.client.SandeshaListener;
@@ -81,7 +80,7 @@
 		ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(AXIS2_CLIENT_PATH,axis2_xml);
 		
 		Options clientOptions = new Options ();	
-		clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportToEPR);
+		clientOptions.setProperty(Configuration.TRANSPORT_URL,transportToEPR);
 		clientOptions.setTo(new EndpointReference (toEPR));
 		
 		String sequenceKey = SandeshaUtil.getUUID();// "sequence2";

Added: webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/TestCallback.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/TestCallback.java?rev=717994&view=auto
==============================================================================
--- webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/TestCallback.java (added)
+++ webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/TestCallback.java Sun Nov 16 01:34:43 2008
@@ -0,0 +1,78 @@
+/*
+ * 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 sandesha2.samples.userguide;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.soap.SOAPBody;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axis2.client.async.AxisCallback;
+import org.apache.axis2.context.MessageContext;
+
+public class TestCallback implements AxisCallback {
+
+	private final static String applicationNamespaceName = "http://tempuri.org/"; 
+	private final static String echoStringResponse = "echoStringResponse";
+	private final static String EchoStringReturn = "EchoStringReturn";
+	
+	String name = null;
+	boolean complete = false;
+	
+	public TestCallback () {
+		
+	}
+	
+	public TestCallback (String name) {
+		this.name = name;
+	}
+	
+	public void onError (Exception e) {
+		System.out.println("Error reported for test call back");
+		e.printStackTrace();
+	}
+
+	public void onComplete() {
+		complete = true;
+	}
+
+	public boolean isComplete(){
+		return complete;
+	}
+	
+	public void onFault(MessageContext arg0) {
+		SOAPBody body = arg0.getEnvelope().getBody();
+		SOAPFault sf = body.getFault();
+		System.out.println("Callback '" + name +  "' got fault:" + sf.toString());	
+	}
+	
+	public void onMessage(MessageContext arg0) {
+		SOAPBody body = arg0.getEnvelope().getBody();
+		
+		OMElement echoStringResponseElem = body.getFirstChildWithName(new QName (applicationNamespaceName,echoStringResponse));
+		if (echoStringResponseElem==null) { 
+			System.out.println("Error: SOAPBody does not have a 'echoStringResponse' child");
+			return;
+		}
+		
+		OMElement echoStringReturnElem = echoStringResponseElem.getFirstChildWithName(new QName (applicationNamespaceName,EchoStringReturn));
+		if (echoStringReturnElem==null) { 
+			System.out.println("Error: 'echoStringResponse' element does not have a 'EchoStringReturn' child");
+			return;
+		}
+		
+		String resultStr = echoStringReturnElem.getText();
+		System.out.println("Callback '" + name +  "' got result:" + resultStr);
+	}
+}

Modified: webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/UserguideEchoClient.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/UserguideEchoClient.java?rev=717994&r1=717993&r2=717994&view=diff
==============================================================================
--- webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/UserguideEchoClient.java (original)
+++ webservices/sandesha/trunk/java/modules/samples/src/main/java/sandesha2/samples/userguide/UserguideEchoClient.java Sun Nov 16 01:34:43 2008
@@ -17,18 +17,15 @@
 package sandesha2.samples.userguide;
 
 import java.io.File;
-import javax.xml.namespace.QName;
+
 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.SOAPBody;
 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.client.async.AsyncResult;
-import org.apache.axis2.client.async.Callback;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.ConfigurationContextFactory;
 import org.apache.sandesha2.client.SandeshaClientConstants;
@@ -39,8 +36,6 @@
 	private final static String echoString = "echoString";
 	private final static String Text = "Text";
 	private final static String Sequence = "Sequence";
-	private final static String echoStringResponse = "echoStringResponse";
-	private final static String EchoStringReturn = "EchoStringReturn";
 	private static String toEPR = "http://127.0.0.1:8070/axis2/services/RMSampleService";
 
 	private static String CLIENT_REPO_PATH = "Full path to the Client Repo folder";
@@ -57,13 +52,13 @@
 		clientOptions.setUseSeparateListener(true);
 		serviceClient.setOptions(clientOptions);
 
-		Callback callback1 = new TestCallback ("Callback 1");
+		TestCallback callback1 = new TestCallback ("Callback 1");
 		serviceClient.sendReceiveNonBlocking (getEchoOMBlock("echo1","sequence1"),callback1);
-		Callback callback2 = new TestCallback ("Callback 2");
+		TestCallback callback2 = new TestCallback ("Callback 2");
 		serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo2","sequence1"),callback2);
 
 		clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
-		Callback callback3 = new TestCallback ("Callback 3");
+		TestCallback callback3 = new TestCallback ("Callback 3");
 		serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo3","sequence1"),callback3);
 		
         while (!callback3.isComplete()) {
@@ -87,27 +82,4 @@
 		
 		return echoStringElement;
 	}
-
-	static class TestCallback extends Callback {
-
-		String name = null;
-		public TestCallback (String name) {
-			this.name = name;
-		}
-		
-		public void onComplete(AsyncResult result) {
-			SOAPBody body = result.getResponseEnvelope().getBody();
-			
-			OMElement echoStringResponseElem = body.getFirstChildWithName(new QName (applicationNamespaceName,echoStringResponse));			
-			OMElement echoStringReturnElem = echoStringResponseElem.getFirstChildWithName(new QName (applicationNamespaceName,EchoStringReturn));
-			
-			String resultStr = echoStringReturnElem.getText();
-			System.out.println("Callback '" + name +  "' got result:" + resultStr);
-		}
-
-		public void onError (Exception e) {
-			System.out.println("Error reported for test call back");
-			e.printStackTrace();
-		}
-	}
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.