Author: chamikara
Date: Tue Apr  4 01:57:20 2006
New Revision: 391252

URL: http://svn.apache.org/viewcvs?rev=391252&view=rev
Log:
Updated sample files

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

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=391252&r1=391251&r2=391252&view=diff
==============================================================================
--- 
webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/AsyncEchoClient.java
 (original)
+++ 
webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/AsyncEchoClient.java
 Tue Apr  4 01:57:20 2006
@@ -21,6 +21,7 @@
 import javax.xml.namespace.QName;
 
 import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.AddressingConstants;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.client.Options;
 import org.apache.axis2.client.ServiceClient;
@@ -31,10 +32,12 @@
 import org.apache.axis2.context.MessageContextConstants;
 import org.apache.axis2.description.ClientUtils;
 import org.apache.sandesha2.client.Sandesha2ClientAPI;
+import org.apache.sandesha2.util.SandeshaUtil;
 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;
 
 public class AsyncEchoClient {
@@ -68,6 +71,7 @@
        
        public static void main(String[] args) throws Exception {
                
+               
                String axisClientRepo = null;
                if (args!=null && args.length>0)
                        axisClientRepo = args[0];
@@ -95,10 +99,9 @@
                
                Options clientOptions = new Options ();
                
-               clientOptions.setProperty(Options.COPY_PROPERTIES,new Boolean 
(true));
                clientOptions.setTo(new EndpointReference (toEPR));
                
-               String acksTo = 
serviceClient.getMyEPR(Constants.TRANSPORT_HTTP).getAddress();
+               String acksTo = 
serviceClient.getMyEPR(Constants.TRANSPORT_HTTP).getAddress() + "/" + 
ServiceClient.ANON_OUT_IN_OP;
                clientOptions.setProperty(Sandesha2ClientAPI.AcksTo,acksTo);
                
                String sequenceKey = "sequence4";
@@ -108,11 +111,13 @@
                
 //             
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.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);   
//uncomment this to send messages in SOAP 1.2
                
 //             
clientOptions.setProperty(Sandesha2ClientAPI.RM_SPEC_VERSION,Sandesha2Constants.SPEC_VERSIONS.WSRX);
  //uncomment this to send the messages according to the WSRX spec.
                
-//             
clientOptions.setProperty(Sandesha2ClientAPI.OFFERED_SEQUENCE_ID,SandeshaUtil.getUUID());
  //Uncomment this to offer a sequenceID for the incoming sequence.
+               
clientOptions.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,AddressingConstants.Submission.WSA_NAMESPACE);
+               
clientOptions.setProperty(Sandesha2ClientAPI.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.
                clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
@@ -122,7 +127,7 @@
                serviceClient.engageModule(new QName ("sandesha2"));  
//engaging the sandesha2 module.
                
                Callback callback1 = new TestCallback ("Callback 1");
-               
serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo1",sequenceKey),callback1);
+               serviceClient.sendReceiveNonBlocking 
(getEchoOMBlock("echo1",sequenceKey),callback1);
                
                Callback callback2 = new TestCallback ("Callback 2");
                
serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo2",sequenceKey),callback2);
@@ -132,16 +137,17 @@
                
                Callback callback4 = new TestCallback ("Callback 4");
                
serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo4",sequenceKey),callback4);
-               
-               Options newOptions = new Options (clientOptions);
-               newOptions.setProperty(Sandesha2ClientAPI.LAST_MESSAGE, "true");
-               serviceClient.setOptions(newOptions);
+
+               clientOptions.setProperty(Sandesha2ClientAPI.LAST_MESSAGE, 
"true");
                Callback callback5 = new TestCallback ("Callback 5");
                
serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo5",sequenceKey),callback5);
                
         while (!callback5.isComplete()) {
             Thread.sleep(1000);
         }
+        
+        Thread.sleep(4000);
+        
        }
 
        private static OMElement getEchoOMBlock(String text, String 
sequenceKey) {

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=391252&r1=391251&r2=391252&view=diff
==============================================================================
--- 
webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/AsyncPingClient.java
 (original)
+++ 
webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/AsyncPingClient.java
 Tue Apr  4 01:57:20 2006
@@ -28,6 +28,7 @@
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.ConfigurationContextFactory;
 import org.apache.sandesha2.client.Sandesha2ClientAPI;
+import org.apache.sandesha2.client.reports.SequenceReport;
 import org.apache.axiom.om.OMAbstractFactory;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMFactory;
@@ -89,11 +90,13 @@
                
 //             
clientOptions.setProperty(Sandesha2ClientAPI.RM_SPEC_VERSION,Sandesha2Constants.SPEC_VERSIONS.WSRX);
  //uncomment this to send the messages according to the WSRX spec.
                
-               clientOptions.setProperty(Options.COPY_PROPERTIES,new Boolean 
(true));
                clientOptions.setTo(new EndpointReference (toEPR));
                clientOptions.setProperty(Sandesha2ClientAPI.AcksTo,acksToEPR);
                clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
-               
clientOptions.setProperty(Sandesha2ClientAPI.SEQUENCE_KEY,"sequence2");
+               clientOptions.setAction("urn:wsrm:Ping");
+               
+               String sequenceKey = "sequence2";
+               
clientOptions.setProperty(Sandesha2ClientAPI.SEQUENCE_KEY,sequenceKey);
                
                serviceClient.setOptions(clientOptions);
                serviceClient.engageModule(new QName ("sandesha2"));
@@ -101,10 +104,24 @@
                serviceClient.fireAndForget(getPingOMBlock("ping1"));
                serviceClient.fireAndForget(getPingOMBlock("ping2"));
                
-               Options newOptions = new Options (clientOptions);
-               newOptions.setProperty(Sandesha2ClientAPI.LAST_MESSAGE, "true");
-               serviceClient.setOptions(newOptions);
+               clientOptions.setProperty(Sandesha2ClientAPI.LAST_MESSAGE, 
"true");
                serviceClient.fireAndForget(getPingOMBlock("ping3"));
+               
+               boolean complete = false;
+               while (!complete) {
+                       SequenceReport sequenceReport = 
Sandesha2ClientAPI.getOutgoingSequenceReport(toEPR,sequenceKey,configContext);
+                       if (sequenceReport!=null && sequenceReport 
.getCompletedMessages().size()==3)
+                               complete = true;
+                       else {
+                               try {
+                                       Thread.sleep(1000);
+                               } catch (InterruptedException e) {
+                                       e.printStackTrace();
+                               }
+                       }
+               }
+               
+               serviceClient.finalizeInvoke();
        }
        
        private static OMElement getPingOMBlock(String text) {

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=391252&r1=391251&r2=391252&view=diff
==============================================================================
--- 
webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/SyncEchoClient.java
 (original)
+++ 
webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/SyncEchoClient.java
 Tue Apr  4 01:57:20 2006
@@ -82,7 +82,6 @@
                
                Options clientOptions = new Options ();
                
-               clientOptions.setProperty(Options.COPY_PROPERTIES,new Boolean 
(true));
                clientOptions.setTo(new EndpointReference (toEPR));
                
                String sequenceKey = "sequence3";
@@ -91,6 +90,7 @@
                //You must set the following two properties in the 
request-reply case.
                clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
                clientOptions.setUseSeparateListener(true);
+               clientOptions.setAction("urn:wsrm:EchoString");
                
 //             
clientOptions.setProperty(MessageContextConstants.CHUNKED,Constants.VALUE_FALSE);
   //uncomment this to send messages without chunking.
                
@@ -108,9 +108,7 @@
                Callback callback2 = new TestCallback ("Callback 2");
                
serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo2",sequenceKey),callback2);
                
-               Options newOptions = new Options (clientOptions);
-               newOptions.setProperty(Sandesha2ClientAPI.LAST_MESSAGE, "true");
-               serviceClient.setOptions(newOptions);
+               clientOptions.setProperty(Sandesha2ClientAPI.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=391252&r1=391251&r2=391252&view=diff
==============================================================================
--- 
webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/SyncPingClient.java
 (original)
+++ 
webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/SyncPingClient.java
 Tue Apr  4 01:57:20 2006
@@ -28,12 +28,14 @@
 import org.apache.axis2.context.ConfigurationContextFactory;
 import org.apache.axis2.context.MessageContextConstants;
 import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.client.RMFaultCallback;
 import org.apache.sandesha2.client.Sandesha2ClientAPI;
 import org.apache.sandesha2.client.reports.SequenceReport;
 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;
 
 
 public class SyncPingClient {
@@ -79,9 +81,11 @@
                
                String axis2_xml = AXIS2_CLIENT_PATH + "axis2.xml";
                ConfigurationContext configContext = 
ConfigurationContextFactory.createConfigurationContextFromFileSystem(AXIS2_CLIENT_PATH,axis2_xml);
+               
                Options clientOptions = new Options ();
+               
+               
                
clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportToEPR);
-               clientOptions.setProperty(Options.COPY_PROPERTIES, new Boolean 
(true));
                clientOptions.setTo(new EndpointReference (toEPR));
                
                String sequenceKey = "sequence1";
@@ -89,32 +93,26 @@
            
 //             
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.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);   
//uncomment this to send messages in SOAP 1.2
                
 //             
clientOptions.setProperty(Sandesha2ClientAPI.RM_SPEC_VERSION,Sandesha2Constants.SPEC_VERSIONS.WSRX);
  //uncomment this to send the messages according to the WSRX spec.
                
-               ServiceClient serviceClient = new ServiceClient 
(configContext,null);           
-               serviceClient.engageModule(new QName ("sandesha2"));  
//engaging the sandesha2 module.
-               
+               clientOptions.setProperty(Sandesha2ClientAPI.RM_FAULT_CALLBACK, 
new FaultCallback ());
+               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"));
                
-               Options newOptions = new Options (clientOptions);
-               newOptions.setProperty(Sandesha2ClientAPI.LAST_MESSAGE, "true");
-               serviceClient.setOptions(newOptions);
-               
-               serviceClient.fireAndForget(getPingOMBlock("ping31"));
+               clientOptions.setProperty(Sandesha2ClientAPI.LAST_MESSAGE, 
"true");
+
+               serviceClient.fireAndForget(getPingOMBlock("ping3"));
                
                SequenceReport sequenceReport = null;
                
-               try {
-                       sequenceReport = 
Sandesha2ClientAPI.getOutgoingSequenceReport(toEPR,sequenceKey,configContext);
-               } catch (SandeshaException e1) {
-                       //no data available.
-               }
-               
                boolean complete = false;
                while (!complete) {
                        sequenceReport = 
Sandesha2ClientAPI.getOutgoingSequenceReport(toEPR,sequenceKey,configContext);
@@ -129,7 +127,6 @@
                        }
                }
                
-               
Sandesha2ClientAPI.terminateSequence(toEPR,sequenceKey,serviceClient,configContext);
                serviceClient.finalizeInvoke();
        }
        
@@ -143,6 +140,14 @@
                pingElem.addChild(textElem);
 
                return pingElem;
+       }
+       
+       private class FaultCallback extends RMFaultCallback {
+
+               public void onError(AxisFault fault) {
+                       System.out.println("*********** RM fault callbak 
called");
+               }
+               
        }
        
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to