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 2006/04/19 13:47:30 UTC
svn commit: r395224 - in
/webservices/sandesha/trunk/samples/src/sandesha2/samples:
interop/AsyncEchoClient.java interop/AsyncPingClient.java
interop/SyncEchoClient.java interop/SyncPingClient.java
simpleServer/SimpleSandesha2Server.java
Author: chamikara
Date: Wed Apr 19 04:47:29 2006
New Revision: 395224
URL: http://svn.apache.org/viewcvs?rev=395224&view=rev
Log:
Updates to the samples
Modified:
webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/AsyncEchoClient.java
webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/AsyncPingClient.java
webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/SyncEchoClient.java
webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/SyncPingClient.java
webservices/sandesha/trunk/samples/src/sandesha2/samples/simpleServer/SimpleSandesha2Server.java
Modified: webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/AsyncEchoClient.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/AsyncEchoClient.java?rev=395224&r1=395223&r2=395224&view=diff
==============================================================================
--- webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/AsyncEchoClient.java (original)
+++ webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/AsyncEchoClient.java Wed Apr 19 04:47:29 2006
@@ -31,8 +31,8 @@
import org.apache.axis2.context.ConfigurationContextFactory;
import org.apache.axis2.context.MessageContextConstants;
import org.apache.axis2.description.ClientUtils;
-import org.apache.sandesha2.client.RMClientAPI;
-import org.apache.sandesha2.client.RMClientConstants;
+import org.apache.sandesha2.client.SandeshaClient;
+import org.apache.sandesha2.client.SandeshaClientConstants;
import org.apache.sandesha2.util.SandeshaUtil;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
@@ -92,7 +92,7 @@
return;
}
- String axis2_xml = AXIS2_CLIENT_PATH + "axis2.xml";
+ String axis2_xml = AXIS2_CLIENT_PATH + "client_axis2.xml";
ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(AXIS2_CLIENT_PATH,axis2_xml);
@@ -103,10 +103,10 @@
clientOptions.setTo(new EndpointReference (toEPR));
String acksTo = serviceClient.getMyEPR(Constants.TRANSPORT_HTTP).getAddress() + "/" + ServiceClient.ANON_OUT_IN_OP;
- clientOptions.setProperty(RMClientConstants.AcksTo,acksTo);
+ clientOptions.setProperty(SandeshaClientConstants.AcksTo,acksTo);
String sequenceKey = "sequence4";
- clientOptions.setProperty(RMClientConstants.SEQUENCE_KEY,sequenceKey);
+ clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportToEPR);
@@ -114,10 +114,10 @@
clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); //uncomment this to send messages in SOAP 1.2
-// clientOptions.setProperty(RMClientAPI.RM_SPEC_VERSION,Sandesha2Constants.SPEC_VERSIONS.WSRX); //uncomment this to send the messages according to the WSRX spec.
+// clientOptions.setProperty(SandeshaClient.RM_SPEC_VERSION,Sandesha2Constants.SPEC_VERSIONS.WSRX); //uncomment this to send the messages according to the WSRX spec.
clientOptions.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,AddressingConstants.Submission.WSA_NAMESPACE);
- clientOptions.setProperty(RMClientConstants.OFFERED_SEQUENCE_ID,SandeshaUtil.getUUID()); //Uncomment this to offer a sequenceID for the incoming sequence.
+ clientOptions.setProperty(SandeshaClientConstants.OFFERED_SEQUENCE_ID,SandeshaUtil.getUUID()); //Uncomment this to offer a sequenceID for the incoming sequence.
clientOptions.setAction("urn:wsrm:EchoString");
//You must set the following two properties in the request-reply case.
@@ -125,8 +125,7 @@
clientOptions.setUseSeparateListener(true);
serviceClient.setOptions(clientOptions);
- serviceClient.engageModule(new QName ("sandesha2")); //engaging the sandesha2 module.
-
+
Callback callback1 = new TestCallback ("Callback 1");
serviceClient.sendReceiveNonBlocking (getEchoOMBlock("echo1",sequenceKey),callback1);
@@ -139,7 +138,7 @@
Callback callback4 = new TestCallback ("Callback 4");
serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo4",sequenceKey),callback4);
- clientOptions.setProperty(RMClientConstants.LAST_MESSAGE, "true");
+ clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
Callback callback5 = new TestCallback ("Callback 5");
serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo5",sequenceKey),callback5);
Modified: webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/AsyncPingClient.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/AsyncPingClient.java?rev=395224&r1=395223&r2=395224&view=diff
==============================================================================
--- webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/AsyncPingClient.java (original)
+++ webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/AsyncPingClient.java Wed Apr 19 04:47:29 2006
@@ -27,8 +27,8 @@
import org.apache.axis2.client.ServiceClient;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.sandesha2.client.RMClientAPI;
-import org.apache.sandesha2.client.RMClientConstants;
+import org.apache.sandesha2.client.SandeshaClient;
+import org.apache.sandesha2.client.SandeshaClientConstants;
import org.apache.sandesha2.client.SequenceReport;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
@@ -78,7 +78,7 @@
return;
}
- String axis2_xml = AXIS2_CLIENT_PATH + "axis2.xml";
+ String axis2_xml = AXIS2_CLIENT_PATH + "client_axis2.xml";
ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(AXIS2_CLIENT_PATH,axis2_xml);
ServiceClient serviceClient = new ServiceClient (configContext,null);
@@ -89,28 +89,27 @@
// clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); //uncomment this to send messages in SOAP 1.2
-// clientOptions.setProperty(RMClientAPI.RM_SPEC_VERSION,Sandesha2Constants.SPEC_VERSIONS.WSRX); //uncomment this to send the messages according to the WSRX spec.
+// clientOptions.setProperty(SandeshaClient.RM_SPEC_VERSION,Sandesha2Constants.SPEC_VERSIONS.WSRX); //uncomment this to send the messages according to the WSRX spec.
clientOptions.setTo(new EndpointReference (toEPR));
- clientOptions.setProperty(RMClientConstants.AcksTo,acksToEPR);
+ clientOptions.setProperty(SandeshaClientConstants.AcksTo,acksToEPR);
clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
clientOptions.setAction("urn:wsrm:Ping");
String sequenceKey = "sequence2";
- clientOptions.setProperty(RMClientConstants.SEQUENCE_KEY,sequenceKey);
+ clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
serviceClient.setOptions(clientOptions);
- serviceClient.engageModule(new QName ("sandesha2"));
serviceClient.fireAndForget(getPingOMBlock("ping1"));
serviceClient.fireAndForget(getPingOMBlock("ping2"));
- clientOptions.setProperty(RMClientConstants.LAST_MESSAGE, "true");
+ clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
serviceClient.fireAndForget(getPingOMBlock("ping3"));
boolean complete = false;
while (!complete) {
- SequenceReport sequenceReport = RMClientAPI.getOutgoingSequenceReport(toEPR,sequenceKey,configContext);
+ SequenceReport sequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
if (sequenceReport!=null && sequenceReport .getCompletedMessages().size()==3)
complete = true;
else {
Modified: webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/SyncEchoClient.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/SyncEchoClient.java?rev=395224&r1=395223&r2=395224&view=diff
==============================================================================
--- webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/SyncEchoClient.java (original)
+++ webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/SyncEchoClient.java Wed Apr 19 04:47:29 2006
@@ -28,8 +28,8 @@
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.ConfigurationContextFactory;
import org.apache.sandesha2.Sandesha2Constants;
-import org.apache.sandesha2.client.RMClientAPI;
-import org.apache.sandesha2.client.RMClientConstants;
+import org.apache.sandesha2.client.SandeshaClient;
+import org.apache.sandesha2.client.SandeshaClientConstants;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
@@ -76,7 +76,7 @@
return;
}
- String axis2_xml = AXIS2_CLIENT_PATH + "axis2.xml";
+ String axis2_xml = AXIS2_CLIENT_PATH + "client_axis2.xml";
ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(AXIS2_CLIENT_PATH,axis2_xml);
ServiceClient serviceClient = new ServiceClient (configContext,null);
@@ -86,7 +86,7 @@
clientOptions.setTo(new EndpointReference (toEPR));
String sequenceKey = "sequence3";
- clientOptions.setProperty(RMClientConstants.SEQUENCE_KEY,sequenceKey);
+ clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
//You must set the following two properties in the request-reply case.
clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
@@ -97,19 +97,18 @@
// clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); //uncomment this to send messages in SOAP 1.2
-// clientOptions.setProperty(RMClientAPI.RM_SPEC_VERSION,Sandesha2Constants.SPEC_VERSIONS.WSRX); //uncomment this to send the messages according to the WSRX spec.
+// clientOptions.setProperty(SandeshaClient.RM_SPEC_VERSION,Sandesha2Constants.SPEC_VERSIONS.WSRX); //uncomment this to send the messages according to the WSRX spec.
-// clientOptions.setProperty(RMClientAPI.OFFERED_SEQUENCE_ID,SandeshaUtil.getUUID()); //Uncomment this to offer a sequenceID for the incoming sequence.
+// clientOptions.setProperty(SandeshaClient.OFFERED_SEQUENCE_ID,SandeshaUtil.getUUID()); //Uncomment this to offer a sequenceID for the incoming sequence.
serviceClient.setOptions(clientOptions);
- serviceClient.engageModule(new QName ("sandesha2")); //engaging the sandesha2 module
-
+
Callback callback1 = new TestCallback ("Callback 1");
serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo1",sequenceKey),callback1);
Callback callback2 = new TestCallback ("Callback 2");
serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo2",sequenceKey),callback2);
- clientOptions.setProperty(RMClientConstants.LAST_MESSAGE, "true");
+ clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
Callback callback3 = new TestCallback ("Callback 3");
serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo3",sequenceKey),callback3);
Modified: webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/SyncPingClient.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/SyncPingClient.java?rev=395224&r1=395223&r2=395224&view=diff
==============================================================================
--- webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/SyncPingClient.java (original)
+++ webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/SyncPingClient.java Wed Apr 19 04:47:29 2006
@@ -21,6 +21,7 @@
import javax.xml.namespace.QName;
import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.AddressingConstants;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
@@ -28,9 +29,9 @@
import org.apache.axis2.context.ConfigurationContextFactory;
import org.apache.axis2.context.MessageContextConstants;
import org.apache.sandesha2.SandeshaException;
-import org.apache.sandesha2.client.RMClientConstants;
-import org.apache.sandesha2.client.RMFaultCallback;
-import org.apache.sandesha2.client.RMClientAPI;
+import org.apache.sandesha2.client.SandeshaClientConstants;
+import org.apache.sandesha2.client.SandeshaListener;
+import org.apache.sandesha2.client.SandeshaClient;
import org.apache.sandesha2.client.SequenceReport;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
@@ -80,7 +81,7 @@
return;
}
- String axis2_xml = AXIS2_CLIENT_PATH + "axis2.xml";
+ String axis2_xml = AXIS2_CLIENT_PATH + "client_axis2.xml";
ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(AXIS2_CLIENT_PATH,axis2_xml);
Options clientOptions = new Options ();
@@ -90,25 +91,25 @@
clientOptions.setTo(new EndpointReference (toEPR));
String sequenceKey = "sequence1";
- clientOptions.setProperty(RMClientConstants.SEQUENCE_KEY,sequenceKey);
+ 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(RMClientAPI.RM_SPEC_VERSION,Sandesha2Constants.SPEC_VERSIONS.WSRX); //uncomment this to send the messages according to the WSRX spec.
+// clientOptions.setProperty(SandeshaClient.RM_SPEC_VERSION,Sandesha2Constants.SPEC_VERSIONS.WSRX); //uncomment this to send the messages according to the WSRX spec.
- clientOptions.setProperty(RMClientConstants.RM_FAULT_CALLBACK, new FaultCallback ());
+// clientOptions.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,AddressingConstants.Submission.WSA_NAMESPACE);
+
+ clientOptions.setProperty(SandeshaClientConstants.SANDESHA_LISTENER, new SandeshaListenerImpl ());
ServiceClient serviceClient = new ServiceClient (configContext,null);
clientOptions.setAction("urn:wsrm:Ping");
serviceClient.setOptions(clientOptions);
-
- serviceClient.engageModule(new QName ("sandesha2")); //engaging the sandesha2 module.
-
+
serviceClient.fireAndForget(getPingOMBlock("ping1"));
serviceClient.fireAndForget(getPingOMBlock("ping2"));
- clientOptions.setProperty(RMClientConstants.LAST_MESSAGE, "true");
+ clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
serviceClient.fireAndForget(getPingOMBlock("ping3"));
@@ -116,7 +117,7 @@
boolean complete = false;
while (!complete) {
- sequenceReport = RMClientAPI.getOutgoingSequenceReport(toEPR,sequenceKey,configContext);
+ sequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
if (sequenceReport!=null && sequenceReport.getCompletedMessages().size()==3)
complete = true;
else {
@@ -143,12 +144,15 @@
return pingElem;
}
- private class FaultCallback extends RMFaultCallback {
+ private class SandeshaListenerImpl implements SandeshaListener {
public void onError(AxisFault fault) {
System.out.println("*********** RM fault callbak called");
}
-
+
+ public void onTimeOut(SequenceReport report) {
+ System.out.println("Sequence timed out");
+ }
}
}
Modified: webservices/sandesha/trunk/samples/src/sandesha2/samples/simpleServer/SimpleSandesha2Server.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/samples/src/sandesha2/samples/simpleServer/SimpleSandesha2Server.java?rev=395224&r1=395223&r2=395224&view=diff
==============================================================================
--- webservices/sandesha/trunk/samples/src/sandesha2/samples/simpleServer/SimpleSandesha2Server.java (original)
+++ webservices/sandesha/trunk/samples/src/sandesha2/samples/simpleServer/SimpleSandesha2Server.java Wed Apr 19 04:47:29 2006
@@ -46,7 +46,7 @@
System.out.println("Starting sandesha2 server...");
- String axis2_xml = AXIS2_SERVER_PATH + "axis2.xml";
+ String axis2_xml = AXIS2_SERVER_PATH + "server_axis2.xml";
ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(AXIS2_SERVER_PATH,axis2_xml);
SimpleHTTPServer server = new SimpleHTTPServer (configContext,8080);
---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org