Author: chamikara
Date: Mon Mar  6 18:44:20 2006
New Revision: 383753

URL: http://svn.apache.org/viewcvs?rev=383753&view=rev
Log:
Updated 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

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=383753&r1=383752&r2=383753&view=diff
==============================================================================
--- 
webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/AsyncEchoClient.java
 (original)
+++ 
webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/AsyncEchoClient.java
 Mon Mar  6 18:44:20 2006
@@ -52,13 +52,14 @@
        private String ackPort = "9070";
        
        private String toPort = "8070";
+       
        private String transportToPort = "8070";
        
        private String toEPR = "http://"; + toIP +  ":" + toPort + 
"/axis2/services/RMInteropService";
        
        private String transportToEPR = "http://"; + toIP +  ":" + 
transportToPort + "/axis2/services/RMInteropService";
        
-       private String acksToEPR = "http://"; + ackIP +  ":" + ackPort + 
"/axis2/services/" + "__ANONYMOUS_SERVICE__";
+       //private String acksToEPR = "http://"; + ackIP +  ":" + ackPort + 
"/axis2/services/" + "__ANONYMOUS_SERVICE__";
        
        private static String SANDESHA2_HOME = "<SANDESHA2_HOME>"; //Change 
this to ur path.
        
@@ -96,7 +97,9 @@
                
                clientOptions.setProperty(Options.COPY_PROPERTIES,new Boolean 
(true));
                clientOptions.setTo(new EndpointReference (toEPR));
-               clientOptions.setProperty(Sandesha2ClientAPI.AcksTo,acksToEPR);
+               
+               String acksTo = 
serviceClient.getMyEPR(Constants.TRANSPORT_HTTP).getAddress();
+               clientOptions.setProperty(Sandesha2ClientAPI.AcksTo,acksTo);
                
                String sequenceKey = "sequence4";
                
clientOptions.setProperty(Sandesha2ClientAPI.SEQUENCE_KEY,sequenceKey);
@@ -130,7 +133,9 @@
                Callback callback4 = new TestCallback ("Callback 4");
                
serviceClient.sendReceiveNonblocking(getEchoOMBlock("echo4",sequenceKey),callback4);
                
-               clientOptions.setProperty(Sandesha2ClientAPI.LAST_MESSAGE, 
"true");
+               Options newOptions = new Options (clientOptions);
+               newOptions.setProperty(Sandesha2ClientAPI.LAST_MESSAGE, "true");
+               serviceClient.setOptions(newOptions);
                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=383753&r1=383752&r2=383753&view=diff
==============================================================================
--- 
webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/AsyncPingClient.java
 (original)
+++ 
webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/AsyncPingClient.java
 Mon Mar  6 18:44:20 2006
@@ -27,6 +27,7 @@
 import org.apache.axis2.client.ServiceClient;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.sandesha2.Sandesha2Constants;
 import org.apache.sandesha2.client.Sandesha2ClientAPI;
 import org.apache.ws.commons.om.OMAbstractFactory;
 import org.apache.ws.commons.om.OMElement;
@@ -70,7 +71,7 @@
                new AsyncPingClient().run();
        }
        
-       public void run () throws AxisFault {
+       private void run () throws AxisFault {
                if ("<SANDESHA2_HOME>".equals(SANDESHA2_HOME)){
                        System.out.println("ERROR: Please change 
<SANDESHA2_HOME> to your Sandesha2 installation directory.");
                        return;
@@ -101,9 +102,10 @@
                serviceClient.fireAndForget(getPingOMBlock("ping1"));
                serviceClient.fireAndForget(getPingOMBlock("ping2"));
                
-               clientOptions.setProperty(Sandesha2ClientAPI.LAST_MESSAGE, 
"true");
+               Options newOptions = new Options (clientOptions);
+               newOptions.setProperty(Sandesha2ClientAPI.LAST_MESSAGE, "true");
+               serviceClient.setOptions(newOptions);
                serviceClient.fireAndForget(getPingOMBlock("ping3"));
-               
        }
        
        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=383753&r1=383752&r2=383753&view=diff
==============================================================================
--- 
webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/SyncEchoClient.java
 (original)
+++ 
webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/SyncEchoClient.java
 Mon Mar  6 18:44:20 2006
@@ -27,6 +27,7 @@
 import org.apache.axis2.client.async.Callback;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.sandesha2.Sandesha2Constants;
 import org.apache.sandesha2.client.Sandesha2ClientAPI;
 import org.apache.ws.commons.om.OMAbstractFactory;
 import org.apache.ws.commons.om.OMElement;
@@ -107,7 +108,9 @@
                Callback callback2 = new TestCallback ("Callback 2");
                
serviceClient.sendReceiveNonblocking(getEchoOMBlock("echo2",sequenceKey),callback2);
                
-               clientOptions.setProperty(Sandesha2ClientAPI.LAST_MESSAGE, 
"true");
+               Options newOptions = new Options (clientOptions);
+               newOptions.setProperty(Sandesha2ClientAPI.LAST_MESSAGE, "true");
+               serviceClient.setOptions(newOptions);
                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=383753&r1=383752&r2=383753&view=diff
==============================================================================
--- 
webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/SyncPingClient.java
 (original)
+++ 
webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/SyncPingClient.java
 Mon Mar  6 18:44:20 2006
@@ -27,8 +27,9 @@
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.ConfigurationContextFactory;
 import org.apache.axis2.context.MessageContextConstants;
-import org.apache.axis2.description.ParameterImpl;
+import org.apache.sandesha2.SandeshaException;
 import org.apache.sandesha2.client.Sandesha2ClientAPI;
+import org.apache.sandesha2.client.SequenceReport;
 import org.apache.ws.commons.om.OMAbstractFactory;
 import org.apache.ws.commons.om.OMElement;
 import org.apache.ws.commons.om.OMFactory;
@@ -69,7 +70,7 @@
                new SyncPingClient ().run();
        }
        
-       public void run () throws AxisFault {
+       private void run () throws AxisFault {
                
                if ("<SANDESHA2_HOME>".equals(SANDESHA2_HOME)){
                        System.out.println("ERROR: Please change 
<SANDESHA2_HOME> to your Sandesha2 installation directory.");
@@ -82,7 +83,9 @@
                
clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportToEPR);
                clientOptions.setProperty(Options.COPY_PROPERTIES, new Boolean 
(true));
                clientOptions.setTo(new EndpointReference (toEPR));
-               
clientOptions.setProperty(Sandesha2ClientAPI.SEQUENCE_KEY,"sequence1");
+               
+               String sequenceKey = "sequence1";
+               
clientOptions.setProperty(Sandesha2ClientAPI.SEQUENCE_KEY,sequenceKey);
            
 //             
clientOptions.setProperty(MessageContextConstants.CHUNKED,Constants.VALUE_FALSE);
   //uncomment this to send messages without chunking.
                
@@ -91,9 +94,6 @@
 //             
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);           
-               clientOptions.setProperty("prop1","test1234");
-               serviceClient.getAxisService().addParameter (new ParameterImpl  
("prop2","test12345"));
-               
                serviceClient.engageModule(new QName ("sandesha2"));  
//engaging the sandesha2 module.
                
                serviceClient.setOptions(clientOptions);
@@ -101,9 +101,33 @@
                serviceClient.fireAndForget(getPingOMBlock("ping1"));
                serviceClient.fireAndForget(getPingOMBlock("ping2"));
                
-               clientOptions.setProperty(Sandesha2ClientAPI.LAST_MESSAGE, 
"true");
+               Options newOptions = new Options (clientOptions);
+               newOptions.setProperty(Sandesha2ClientAPI.LAST_MESSAGE, "true");
+               serviceClient.setOptions(newOptions);
+               
                serviceClient.fireAndForget(getPingOMBlock("ping31"));
                
+               SequenceReport sequenceReport = null;
+               
+               try {
+                       sequenceReport = 
Sandesha2ClientAPI.getOutgoingSequenceReport(toEPR,sequenceKey,configContext);
+               } catch (SandeshaException e1) {
+                       //no data available.
+               }
+               
+//             while (sequenceReport==null || 
sequenceReport.getSequenceStatus()!=SequenceReport.SEQUENCE_STATUS_COMPLETED) {
+//                     try {
+//                             sequenceReport = 
Sandesha2ClientAPI.getOutgoingSequenceReport(toEPR,sequenceKey,configContext);
+//                     } catch (SandeshaException e) {
+//                             try {
+//                                     Thread.sleep(1000);
+//                             } catch (InterruptedException e1) {
+//                                     e1.printStackTrace();
+//                             }
+//                     } 
+//             }
+               
+               serviceClient.finalizeInvoke();
        }
        
        private static OMElement getPingOMBlock(String text) {



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

Reply via email to