Author: chamikara Date: Wed Jan 4 22:02:11 2006 New Revision: 366094 URL: http://svn.apache.org/viewcvs?rev=366094&view=rev Log: Changes to comply with latest Axis2 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=366094&r1=366093&r2=366094&view=diff ============================================================================== --- webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/AsyncEchoClient.java (original) +++ webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/AsyncEchoClient.java Wed Jan 4 22:02:11 2006 @@ -22,16 +22,20 @@ import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.client.Call; 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.axis2.description.AxisService; 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.Sandesha2ClientAPI; -import org.apache.sandesha2.Sandesha2Constants; +import org.apache.sandesha2.client.RMReport; +import org.apache.sandesha2.client.Sandesha2ClientAPI; import org.apache.sandesha2.util.SandeshaUtil; public class AsyncEchoClient { @@ -46,7 +50,7 @@ private String toEPR = "http://" + toIP + ":" + toPort + "/axis2/services/RMInteropService"; - private String acksToEPR = "http://" + ackIP + ":" + ackPort + "/axis2/services/AnonymousService/echoString"; + private String acksToEPR = "http://" + ackIP + ":" + ackPort + "/axis2/services/" + "__ANONYMOUS_SERVICE__"; private static String SANDESHA2_HOME = ""; //Change this to ur path. @@ -74,36 +78,41 @@ return; } - Call call = new Call(AXIS2_CLIENT_PATH); - call.engageModule(new QName("Sandesha2-0.9")); + ConfigurationContext configContext = new ConfigurationContextFactory().createConfigurationContextFromFileSystem(AXIS2_CLIENT_PATH); + + ServiceClient serviceClient = new ServiceClient (configContext,null); + + Options clientOptions = new Options (); - clientOptions.setProperty(Options.COPY_PROPERTIES,new Boolean (true)); - call.setClientOptions(clientOptions); + clientOptions.setProperty(Options.COPY_PROPERTIES,new Boolean (true)); + clientOptions.setTo(new EndpointReference (toEPR)); + clientOptions.setProperty(Sandesha2ClientAPI.AcksTo,acksToEPR); + clientOptions.setProperty(Sandesha2ClientAPI.SEQUENCE_KEY,"sequence1"); + //You must set the following two properties in the request-reply case. - clientOptions.setListenerTransportProtocol(Constants.TRANSPORT_HTTP); + clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP); clientOptions.setUseSeparateListener(true); - clientOptions.setProperty(Sandesha2ClientAPI.AcksTo,acksToEPR); - clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); - clientOptions.setTo(new EndpointReference(toEPR)); - clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,toEPR); - clientOptions.setProperty(Sandesha2ClientAPI.SEQUENCE_KEY,"sequence1"); //Optional - clientOptions.setSoapAction("test:soap:action"); - clientOptions.setProperty(Sandesha2ClientAPI.OFFERED_SEQUENCE_ID,SandeshaUtil.getUUID()); //Optional + serviceClient.setOptions(clientOptions); + serviceClient.engageModule(new QName ("Sandesha2-0.9")); + + String offeredSequenceID = SandeshaUtil.getUUID(); + clientOptions.setProperty(Sandesha2ClientAPI.OFFERED_SEQUENCE_ID,offeredSequenceID); //Optional + Callback callback1 = new TestCallback ("Callback 1"); - call.invokeNonBlocking("echoString", getEchoOMBlock("echo1"),callback1); + serviceClient.sendReceiveNonblocking(getEchoOMBlock("echo1"),callback1); Callback callback2 = new TestCallback ("Callback 2"); - call.invokeNonBlocking("echoString", getEchoOMBlock("echo2"),callback2); + serviceClient.sendReceiveNonblocking(getEchoOMBlock("echo2"),callback2); + clientOptions.setProperty(Sandesha2ClientAPI.LAST_MESSAGE, "true"); Callback callback3 = new TestCallback ("Callback 3"); - call.invokeNonBlocking("echoString", getEchoOMBlock("echo3"),callback3); + serviceClient.sendReceiveNonblocking(getEchoOMBlock("echo3"),callback3); while (!callback3.isComplete()) { Thread.sleep(1000); } - - call.close(); + } private static OMElement getEchoOMBlock(String text) { @@ -147,7 +156,7 @@ } - public void reportError(Exception e) { + 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/samples/src/sandesha2/samples/interop/AsyncPingClient.java URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/AsyncPingClient.java?rev=366094&r1=366093&r2=366094&view=diff ============================================================================== --- webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/AsyncPingClient.java (original) +++ webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/AsyncPingClient.java Wed Jan 4 22:02:11 2006 @@ -22,12 +22,15 @@ import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.client.MessageSender; 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.description.AxisService; 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.Sandesha2ClientAPI; +import org.apache.sandesha2.client.Sandesha2ClientAPI; public class AsyncPingClient { @@ -42,7 +45,7 @@ private String toEPR = "http://" + toIP + ":" + toPort + "/axis2/services/RMInteropService"; - private String acksToEPR = "http://" + ackIP + ":" + ackPort + "/axis2/services/AnonymousService/echoString"; + private String acksToEPR = "http://" + ackIP + ":" + ackPort + "/axis2/services/" + "__ANONYMOUS_SERVICE__"; private static String SANDESHA2_HOME = ""; //Change this to ur path. @@ -68,19 +71,26 @@ return; } - MessageSender sender = new MessageSender (AXIS2_CLIENT_PATH); + ConfigurationContext configContext = new ConfigurationContextFactory().createConfigurationContextFromFileSystem(AXIS2_CLIENT_PATH); + + ServiceClient serviceClient = new ServiceClient (configContext,null); + Options clientOptions = new Options (); + clientOptions.setProperty(Options.COPY_PROPERTIES,new Boolean (true)); - sender.setClientOptions(clientOptions); - //clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); + clientOptions.setTo(new EndpointReference (toEPR)); clientOptions.setProperty(Sandesha2ClientAPI.AcksTo,acksToEPR); - sender.engageModule(new QName ("Sandesha2-0.9")); - clientOptions.setTo(new EndpointReference(toEPR)); clientOptions.setProperty(Sandesha2ClientAPI.SEQUENCE_KEY,"sequence1"); - sender.send("ping",getPingOMBlock("ping1")); - sender.send("ping",getPingOMBlock("ping2")); + + serviceClient.setOptions(clientOptions); + serviceClient.engageModule(new QName ("Sandesha2-0.9")); + + serviceClient.fireAndForget(getPingOMBlock("ping1")); + serviceClient.fireAndForget(getPingOMBlock("ping2")); + clientOptions.setProperty(Sandesha2ClientAPI.LAST_MESSAGE, "true"); - sender.send("ping",getPingOMBlock("ping3")); + 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=366094&r1=366093&r2=366094&view=diff ============================================================================== --- webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/SyncEchoClient.java (original) +++ webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/SyncEchoClient.java Wed Jan 4 22:02:11 2006 @@ -23,16 +23,23 @@ import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.client.Call; 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.description.AxisOperation; +import org.apache.axis2.description.AxisService; 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.Sandesha2ClientAPI; +import org.apache.sandesha2.client.Sandesha2ClientAPI; import org.apache.sandesha2.util.SandeshaUtil; +import sandesha2.samples.interop.AsyncEchoClient.TestCallback; + public class SyncEchoClient { private String toIP = "127.0.0.1"; @@ -45,7 +52,7 @@ private static String AXIS2_CLIENT_PATH = SANDESHA2_HOME + "\\target\\repos\\client\\"; //this will be available after a maven build - public static void main(String[] args) throws AxisFault { + public static void main(String[] args) throws Exception { String axisClientRepo = null; if (args!=null && args.length>0) @@ -59,33 +66,47 @@ new SyncEchoClient().run(); } - private void run () throws AxisFault { + private void run () throws Exception { if ("".equals(SANDESHA2_HOME)){ System.out.println("ERROR: Please change to your Sandesha2 installation directory."); return; } - Call call = new Call(AXIS2_CLIENT_PATH); - call.engageModule(new QName("Sandesha2-0.9")); + + ConfigurationContext configContext = new ConfigurationContextFactory().createConfigurationContextFromFileSystem(AXIS2_CLIENT_PATH); + + ServiceClient serviceClient = new ServiceClient (configContext,null); + + Options clientOptions = new Options (); - clientOptions.setProperty(Options.COPY_PROPERTIES,new Boolean (true)); - clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); - call.setClientOptions(clientOptions); + clientOptions.setProperty(Options.COPY_PROPERTIES,new Boolean (true)); + clientOptions.setTo(new EndpointReference (toEPR)); + clientOptions.setProperty(Sandesha2ClientAPI.SEQUENCE_KEY,"sequence1"); + //You must set the following two properties in the request-reply case. - clientOptions.setListenerTransportProtocol(Constants.TRANSPORT_HTTP); + clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP); clientOptions.setUseSeparateListener(true); - clientOptions.setTo(new EndpointReference(toEPR)); - clientOptions.setProperty(Sandesha2ClientAPI.SEQUENCE_KEY,"sequence1"); - //clientOptions.setProperty(Sandesha2ClientAPI.OFFERED_SEQUENCE_ID,SandeshaUtil.getUUID()); + serviceClient.setOptions(clientOptions); + serviceClient.engageModule(new QName ("Sandesha2-0.9")); + + String offeredSequenceID = SandeshaUtil.getUUID(); + clientOptions.setProperty(Sandesha2ClientAPI.OFFERED_SEQUENCE_ID,offeredSequenceID); //Optional + Callback callback1 = new TestCallback ("Callback 1"); - call.invokeNonBlocking("echoString", getEchoOMBlock("echo1"),callback1); + serviceClient.sendReceiveNonblocking(getEchoOMBlock("echo1"),callback1); Callback callback2 = new TestCallback ("Callback 2"); - call.invokeNonBlocking("echoString", getEchoOMBlock("echo2"),callback2); + serviceClient.sendReceiveNonblocking(getEchoOMBlock("echo2"),callback2); + clientOptions.setProperty(Sandesha2ClientAPI.LAST_MESSAGE, "true"); Callback callback3 = new TestCallback ("Callback 3"); - call.invokeNonBlocking("echoString", getEchoOMBlock("echo3"),callback3); + serviceClient.sendReceiveNonblocking(getEchoOMBlock("echo3"),callback3); + + while (!callback3.isComplete()) { + Thread.sleep(1000); + } + } private static OMElement getEchoOMBlock(String text) { @@ -133,7 +154,7 @@ } - public void reportError(Exception e) { + public void onError(Exception e) { // TODO Auto-generated method stub System.out.println("Error reported for test call back"); } 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=366094&r1=366093&r2=366094&view=diff ============================================================================== --- webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/SyncPingClient.java (original) +++ webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/SyncPingClient.java Wed Jan 4 22:02:11 2006 @@ -20,15 +20,22 @@ import org.apache.axis2.AxisFault; import org.apache.axis2.addressing.EndpointReference; +import org.apache.axis2.client.InOnlyMEPClient; import org.apache.axis2.client.MessageSender; +import org.apache.axis2.client.OperationClient; 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.description.AxisService; +import org.apache.axis2.engine.AxisConfiguration; +import org.apache.axis2.engine.MessageReceiver; 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.SOAP11Constants; -import org.apache.axis2.soap.SOAP12Constants; -import org.apache.sandesha2.Sandesha2ClientAPI; +import org.apache.sandesha2.client.Sandesha2ClientAPI; public class SyncPingClient { @@ -64,25 +71,26 @@ System.out.println("ERROR: Please change to your Sandesha2 installation directory."); return; } + ConfigurationContext configContext = new ConfigurationContextFactory().createConfigurationContextFromFileSystem(AXIS2_CLIENT_PATH); - MessageSender sender = new MessageSender (AXIS2_CLIENT_PATH); - sender.engageModule(new QName ("Sandesha2-0.9")); Options clientOptions = new Options (); - sender.setClientOptions(clientOptions); + // clientOptions.setr\ + clientOptions.setProperty(Options.COPY_PROPERTIES, new Boolean (true)); + clientOptions.setTo(new EndpointReference (toEPR)); + clientOptions.setProperty(Sandesha2ClientAPI.SEQUENCE_KEY,"sequence1"); - //clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); + ServiceClient serviceClient = new ServiceClient (configContext,null); + //serviceClient. - clientOptions.setProperty(Options.COPY_PROPERTIES,new Boolean (true)); - clientOptions.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI); - clientOptions.setTo(new EndpointReference(toEPR)); - //clientOptions. + serviceClient.engageModule(new QName ("Sandesha2-0.9")); + serviceClient.setOptions(clientOptions); + + serviceClient.fireAndForget(getPingOMBlock("ping1")); + serviceClient.fireAndForget(getPingOMBlock("ping2")); - clientOptions.setProperty(Sandesha2ClientAPI.SEQUENCE_KEY,"sequence1"); - sender.send("ping",getPingOMBlock("ping1")); - sender.send("ping",getPingOMBlock("ping2")); clientOptions.setProperty(Sandesha2ClientAPI.LAST_MESSAGE, "true"); - sender.send("ping",getPingOMBlock("ping3")); - + serviceClient.fireAndForget(getPingOMBlock("ping3")); + } private static OMElement getPingOMBlock(String text) { --------------------------------------------------------------------- To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org For additional commands, e-mail: sandesha-dev-help@ws.apache.org