ws-axis-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dee...@apache.org
Subject svn commit: r365886 - in /webservices/axis2/trunk/java/modules: codegen/src/org/apache/axis2/rpc/client/ core/src/org/apache/axis2/client/ integration/test/org/apache/axis2/mail/ integration/test/org/apache/axis2/processingModel/ integration/test/org/a...
Date Wed, 04 Jan 2006 10:32:41 GMT
Author: deepal
Date: Wed Jan  4 02:32:13 2006
New Revision: 365886

URL: http://svn.apache.org/viewcvs?rev=365886&view=rev
Log:
- optimized imports
- remove RPCCall
- extend  RESTCall from ServiceClient 

Removed:
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/rpc/client/RPCCall.java
Modified:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/RESTCall.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/WSDLMEPClientBuilder.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/mail/MailOneWayRawXMLTest.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/processingModel/SoapProcessingModelTest.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/MultirefTest.java
    webservices/axis2/trunk/java/modules/samples/src/sample/yahooservices/RESTSearch/RESTSearchClient.java
    webservices/axis2/trunk/java/modules/samples/src/userguide/clients/MailClient.java

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/RESTCall.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/RESTCall.java?rev=365886&r1=365885&r2=365886&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/RESTCall.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/RESTCall.java Wed
Jan  4 02:32:13 2006
@@ -19,28 +19,22 @@
 
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.client.async.Callback;
-import org.apache.axis2.context.ServiceContext;
 import org.apache.axis2.om.OMAbstractFactory;
 import org.apache.axis2.om.OMElement;
 
-public class RESTCall extends Call {
+public class RESTCall extends ServiceClient {
     public RESTCall() throws AxisFault {
         super();
     }
 
-    public RESTCall(ServiceContext service) {
-        super(service);
-    }
 
-    public OMElement invokeBlocking() throws AxisFault {
-        return super.invokeBlocking("nothing",
-                OMAbstractFactory.getOMFactory().createOMElement("nothing",
-                        "nothing", "nothing"));
+    public OMElement sendReceive() throws AxisFault {
+        return super.sendReceive(OMAbstractFactory.getOMFactory().createOMElement("nothing",
+                "nothing", "nothing"));
     }
 
-    public void invokeNonBlocking(Callback callback) throws AxisFault {
-        super.invokeNonBlocking("nothing",
-                OMAbstractFactory.getOMFactory().createOMElement("nothing",
-                        "nothing", "nothing"), callback);
+    public void sendReceiveNonblocking(Callback callback) throws AxisFault {
+        super.sendReceiveNonblocking(OMAbstractFactory.getOMFactory().createOMElement("nothing",
+                "nothing", "nothing"), callback);
     }
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/WSDLMEPClientBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/WSDLMEPClientBuilder.java?rev=365886&r1=365885&r2=365886&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/WSDLMEPClientBuilder.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/WSDLMEPClientBuilder.java
Wed Jan  4 02:32:13 2006
@@ -31,14 +31,7 @@
 import org.apache.axis2.wsdl.WSDLVersionWrapper;
 import org.apache.axis2.wsdl.builder.WOMBuilder;
 import org.apache.axis2.wsdl.builder.WOMBuilderFactory;
-import org.apache.wsdl.WSDLBinding;
-import org.apache.wsdl.WSDLBindingOperation;
-import org.apache.wsdl.WSDLConstants;
-import org.apache.wsdl.WSDLDescription;
-import org.apache.wsdl.WSDLEndpoint;
-import org.apache.wsdl.WSDLInterface;
-import org.apache.wsdl.WSDLOperation;
-import org.apache.wsdl.WSDLService;
+import org.apache.wsdl.*;
 import org.apache.wsdl.extensions.SOAPAddress;
 import org.apache.wsdl.extensions.SOAPOperation;
 
@@ -136,7 +129,7 @@
             }
         }
 
-        MEPClient mepclient = null;
+        MEPClient mepclient;
 
         if ((wsdlop.getInputMessage() != null) && (wsdlop.getOutputMessage() != null)
&& !isoneway) {
             mepclient = new InOutMEPClient(serviceContext);
@@ -163,7 +156,7 @@
     }
 
     private WSDLEndpoint findEndpoint(QName endpointname, WSDLService service) throws AxisFault
{
-        WSDLEndpoint endpoint = null;
+        WSDLEndpoint endpoint;
 
         if (endpointname == null) {
             Iterator endpoints = service.getEndpoints().values().iterator();
@@ -197,7 +190,7 @@
     }
 
     private WSDLService findService(QName serviceName) throws AxisFault {
-        WSDLService service = null;
+        WSDLService service;
 
         if (serviceName == null) {
             Iterator services = description.getServices().values().iterator();

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/mail/MailOneWayRawXMLTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/mail/MailOneWayRawXMLTest.java?rev=365886&r1=365885&r2=365886&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/mail/MailOneWayRawXMLTest.java
(original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/mail/MailOneWayRawXMLTest.java
Wed Jan  4 02:32:13 2006
@@ -19,14 +19,12 @@
 //todo
 
 import junit.framework.TestCase;
-import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 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.MessageContext;
-import org.apache.axis2.context.ServiceContext;
 import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.description.OutInAxisOperation;
@@ -36,19 +34,14 @@
 import org.apache.axis2.om.OMFactory;
 import org.apache.axis2.om.OMNamespace;
 import org.apache.axis2.soap.SOAPEnvelope;
-import org.apache.axis2.soap.SOAPFactory;
 import org.apache.axis2.transport.mail.SimpleMailListener;
-import org.apache.axis2.util.Utils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 
 import javax.xml.namespace.QName;
 
 public class MailOneWayRawXMLTest extends TestCase {
     private EndpointReference targetEPR =
             new EndpointReference("mailto:foo@127.0.0.1" +
-            "/axis/services/EchoXMLService/echoOMElement");
-    private Log log = LogFactory.getLog(getClass());
+                    "/axis/services/EchoXMLService/echoOMElement");
     private QName serviceName = new QName("EchoXMLService");
     private QName operationName = new QName("echoOMElement");
 
@@ -57,7 +50,6 @@
 
     private SOAPEnvelope envelope;
 
-    private boolean finish = false;
 
     public MailOneWayRawXMLTest() {
         super(MailOneWayRawXMLTest.class.getName());
@@ -79,16 +71,15 @@
 
         AxisService service = new AxisService(serviceName.getLocalPart());
         AxisOperation axisOperation = new OutInAxisOperation(
-                );
+        );
         axisOperation.setName(operationName);
         axisOperation.setMessageReceiver(new MessageReceiver() {
-            public void receive(MessageContext messageCtx) throws AxisFault {
+            public void receive(MessageContext messageCtx) {
                 envelope = messageCtx.getEnvelope();
             }
         });
         service.addOperation(axisOperation);
         configContext.getAxisConfiguration().addService(service);
-        ServiceContext serviceContext = Utils.fillContextInformation(axisOperation,  service,
configContext);
     }
 
     protected void tearDown() throws Exception {
@@ -110,28 +101,26 @@
     public void testOneWay() throws Exception {
         AxisService service = new AxisService(serviceName.getLocalPart());
         AxisOperation axisOperation = new OutInAxisOperation(
-                );
+        );
         axisOperation.setName(operationName);
         axisOperation.setMessageReceiver(new MessageReceiver() {
-            public void receive(MessageContext messageCtx) throws AxisFault {
+            public void receive(MessageContext messageCtx) {
                 envelope = messageCtx.getEnvelope();
             }
         });
         service.addOperation(axisOperation);
         configContext.getAxisConfiguration().addService(service);
-        ServiceContext serviceContext = Utils.fillContextInformation(axisOperation,  service,
configContext);
-
-        SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
 
         OMElement payload = createEnvelope();
 
-        MessageSender sender = new MessageSender(serviceContext);
+        ServiceClient servicClient = new ServiceClient(configContext, service);
 
         Options options = new Options();
         options.setTo(targetEPR);
 
-        sender.send(operationName.getLocalPart(), payload);
-        int index = 0;
+        servicClient.setOptions(options);
+
+        servicClient.sendRobust(operationName, payload);
         while (envelope == null) {
 //          if(index < 10){
             Thread.sleep(4000);

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/processingModel/SoapProcessingModelTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/processingModel/SoapProcessingModelTest.java?rev=365886&r1=365885&r2=365886&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/processingModel/SoapProcessingModelTest.java
(original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/processingModel/SoapProcessingModelTest.java
Wed Jan  4 02:32:13 2006
@@ -21,8 +21,9 @@
 import junit.framework.TestCase;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
-import org.apache.axis2.client.InOutMEPClient;
+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.MessageContext;
 import org.apache.axis2.context.ServiceContext;
@@ -44,6 +45,7 @@
 public class SoapProcessingModelTest extends TestCase implements TestConstants {
 
     private AxisService service;
+    private AxisService clientService;
 
     private boolean finish = false;
 
@@ -59,6 +61,8 @@
         UtilServer.start();
         service = Utils.createSimpleService(serviceName, Echo.class.getName(),
                 operationName);
+        clientService = Utils.createSimpleServiceforClient(serviceName, Echo.class.getName(),
+                operationName);
         UtilServer.deployService(service);
 
     }
@@ -69,37 +73,39 @@
     }
 
     public void sendMessageWithHeader(SOAPEnvelope envelope) throws AxisFault {
-        InOutMEPClient inOutMC = null;
+        ServiceClient serviceClient = null;
 
         try {
             ConfigurationContext configContext = Utils
                     .getNewConfigurationContext(Constants.TESTING_REPOSITORY);
+            configContext.getAxisConfiguration().addService(clientService);
 
             ServiceContext serviceContext = new ServiceGroupContext(
-                    configContext, service.getParent())
-                    .getServiceContext(service);
-            inOutMC = new InOutMEPClient(serviceContext);
+                    configContext, clientService.getParent())
+                    .getServiceContext(clientService);
+            serviceClient = new ServiceClient(configContext, clientService);
 
-            MessageContext msgctx = new MessageContext(serviceContext
-                    .getConfigurationContext());
+            MessageContext msgctx = new MessageContext(serviceContext .getConfigurationContext());
 
             msgctx.setEnvelope(envelope);
 
             Options options = new Options();
-            inOutMC.setClientOptions(options);
+            serviceClient.setOptions(options);
             options.setTo(targetEPR);
             options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
 
-            inOutMC.invokeBlocking(serviceContext
-                    .getAxisService().getOperation(operationName), msgctx);
+            OperationClient opClient = serviceClient.createClient(operationName);
+            opClient.addMessageContext(msgctx);
+            opClient.setOptions(options);
+            opClient.execute(true);
+
         } catch (Exception e) {
             e.printStackTrace();
             fail("Exception Occurred !! ." + e.getMessage());
             throw new AxisFault(e);
         } finally {
-            inOutMC.close();
+            serviceClient.finalizeInvoke();
         }
-        // fail("Fix Me Deepal");
     }
 
     public void testSendingMustUnderstandWithNextRole() throws Exception {

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/MultirefTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/MultirefTest.java?rev=365886&r1=365885&r2=365886&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/MultirefTest.java
(original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/MultirefTest.java
Wed Jan  4 02:32:13 2006
@@ -20,7 +20,9 @@
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.EndpointReference;
+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.context.MessageContext;
@@ -38,13 +40,13 @@
 import org.apache.axis2.om.OMNamespace;
 import org.apache.axis2.om.impl.llom.builder.StAXOMBuilder;
 import org.apache.axis2.receivers.AbstractMessageReceiver;
-import org.apache.axis2.rpc.client.RPCCall;
 import org.apache.axis2.rpc.client.RPCServiceClient;
 import org.apache.axis2.rpc.receivers.RPCMessageReceiver;
 import org.apache.axis2.soap.SOAPEnvelope;
 import org.apache.axis2.soap.SOAPFactory;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.wsdl.WSDLConstants;
 import org.apache.wsdl.WSDLService;
 
 import javax.xml.namespace.QName;
@@ -87,7 +89,6 @@
     private void configureSystem(String opName) throws AxisFault {
         targetEPR =
                 new EndpointReference("http://127.0.0.1:"
-//                        + (5000)
                         + (UtilServer.TESTING_PORT)
                         + "/axis/services/EchoXMLService/" + opName);
         String className = "org.apache.axis2.rpc.RPCServiceClass";
@@ -120,23 +121,27 @@
         ref.addAttribute(fac.createOMAttribute("id", null, "1"));
         ref.setText("hello Axis2");
         envelope.getBody().addChild(ref);
-        RPCCall call =
-                new RPCCall("target/test-resources/integrationRepo");
 
         Options options = new Options();
-        call.setClientOptions(options);
+
         options.setTo(targetEPR);
         options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
 
+        ConfigurationContext configConetxt = new ConfigurationContextFactory()
+                .buildConfigurationContext("target/test-resources/integrationRepo");
+        RPCServiceClient rpcClient = new RPCServiceClient(configConetxt, null);
+        rpcClient.setOptions(options);
+        MessageContext reqMessageContext = new MessageContext(configConetxt);
+        OperationClient opClinet = rpcClient.createClient(ServiceClient.ANON_OUT_IN_OP);
+        opClinet.setOptions(options);
+        reqMessageContext.setEnvelope(envelope);
 
-        SOAPEnvelope env = call.invokeBlocking("echoString", envelope);
+        opClinet.addMessageContext(reqMessageContext);
+        opClinet.execute(true);
 
-        ConfigurationContextFactory configfactory = new ConfigurationContextFactory();
-        ConfigurationContext configContext = configfactory.buildConfigurationContext(
-                "target/test-resources/integrationRepo");
-        RPCServiceClient sender = new RPCServiceClient(configContext, null);
-        sender.setOptions(options);
-        options.setTo(targetEPR);
+        MessageContext responseMessageContx = opClinet.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+
+        SOAPEnvelope env = responseMessageContx.getEnvelope();
 
 
         assertEquals(env.getBody().getFirstElement().getFirstElement().getText(), "hello
Axis2");
@@ -170,15 +175,27 @@
         ref2.setText("10");
         envelope.getBody().addChild(ref2);
 
-
-        RPCCall call =
-                new RPCCall("target/test-resources/integrationRepo");
-
         Options options = new Options();
-        call.setClientOptions(options);
         options.setTo(targetEPR);
         options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
-        SOAPEnvelope env = call.invokeBlocking("add", envelope);
+
+        ConfigurationContext configConetxt = new ConfigurationContextFactory()
+                .buildConfigurationContext("target/test-resources/integrationRepo");
+        RPCServiceClient rpcClient = new RPCServiceClient(configConetxt, null);
+        rpcClient.setOptions(options);
+        MessageContext reqMessageContext = new MessageContext(configConetxt);
+        OperationClient opClinet = rpcClient.createClient(ServiceClient.ANON_OUT_IN_OP);
+        opClinet.setOptions(options);
+        reqMessageContext.setEnvelope(envelope);
+
+        opClinet.addMessageContext(reqMessageContext);
+        opClinet.execute(true);
+
+        MessageContext responseMessageContx = opClinet.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+
+        SOAPEnvelope env = responseMessageContx.getEnvelope();
+
+
         assertEquals(env.getBody().getFirstElement().getFirstElement().getText(), "20");
     }
 
@@ -204,15 +221,26 @@
         ref.addAttribute(fac.createOMAttribute("id", null, "1"));
         ref.setText("10");
         envelope.getBody().addChild(ref);
-        RPCCall call =
-                new RPCCall("target/test-resources/integrationRepo");
 
         Options options = new Options();
-        call.setClientOptions(options);
         options.setTo(targetEPR);
         options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
 
-        SOAPEnvelope env = call.invokeBlocking("add", envelope);
+        ConfigurationContext configConetxt = new ConfigurationContextFactory()
+                .buildConfigurationContext("target/test-resources/integrationRepo");
+        RPCServiceClient rpcClient = new RPCServiceClient(configConetxt, null);
+        rpcClient.setOptions(options);
+        MessageContext reqMessageContext = new MessageContext(configConetxt);
+        OperationClient opClinet = rpcClient.createClient(ServiceClient.ANON_OUT_IN_OP);
+        opClinet.setOptions(options);
+        reqMessageContext.setEnvelope(envelope);
+
+        opClinet.addMessageContext(reqMessageContext);
+        opClinet.execute(true);
+
+        MessageContext responseMessageContx = opClinet.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+        SOAPEnvelope env = responseMessageContx.getEnvelope();
+
         assertEquals(env.getBody().getFirstElement().getFirstElement().getText(), "20");
     }
 
@@ -245,15 +273,22 @@
             ref2.setText("10");
             envelope.getBody().addChild(ref2);
 
-
-            RPCCall call =
-                    new RPCCall("target/test-resources/integrationRepo");
-
             Options options = new Options();
-            call.setClientOptions(options);
             options.setTo(targetEPR);
             options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
-            call.invokeBlocking("add", envelope);
+
+            ConfigurationContext configConetxt = new ConfigurationContextFactory()
+                    .buildConfigurationContext("target/test-resources/integrationRepo");
+            RPCServiceClient rpcClient = new RPCServiceClient(configConetxt, null);
+            rpcClient.setOptions(options);
+            MessageContext reqMessageContext = new MessageContext(configConetxt);
+            OperationClient opClinet = rpcClient.createClient(ServiceClient.ANON_OUT_IN_OP);
+            opClinet.setOptions(options);
+            reqMessageContext.setEnvelope(envelope);
+
+            opClinet.addMessageContext(reqMessageContext);
+            opClinet.execute(true);
+
             fail("This should fail with : " + "org.apache.axis2.AxisFault: Invalid reference
:2");
         } catch (AxisFault axisFault) {
             String val = axisFault.getMessage();
@@ -297,19 +332,31 @@
         OMElement om4 = getOMelemnt(ref4, fac);
         envelope.getBody().addChild(om4);
 
-        RPCCall call =
-                new RPCCall("target/test-resources/integrationRepo");
-
         Options options = new Options();
-        call.setClientOptions(options);
         options.setTo(targetEPR);
         options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
-        SOAPEnvelope env = call.invokeBlocking("editBean", envelope);
+
+        ConfigurationContext configConetxt = new ConfigurationContextFactory()
+                .buildConfigurationContext("target/test-resources/integrationRepo");
+        RPCServiceClient rpcClient = new RPCServiceClient(configConetxt, null);
+        rpcClient.setOptions(options);
+        MessageContext reqMessageContext = new MessageContext(configConetxt);
+        OperationClient opClinet = rpcClient.createClient(ServiceClient.ANON_OUT_IN_OP);
+        opClinet.setOptions(options);
+        reqMessageContext.setEnvelope(envelope);
+
+        opClinet.addMessageContext(reqMessageContext);
+        opClinet.execute(true);
+
+        MessageContext responseMessageContx = opClinet.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+
+        SOAPEnvelope env = responseMessageContx.getEnvelope();
+
         OMElement response = env.getBody().getFirstElement();
         MyBean resBean = (MyBean) BeanUtil.deserialize(MyBean.class, response.getFirstElement());
         assertNotNull(resBean);
         assertEquals(resBean.getAge(), 159);
-        call.close();
+        rpcClient.finalizeInvoke();
     }
 
 
@@ -345,20 +392,31 @@
         OMElement om4 = getOMelemnt(ref4, fac);
         envelope.getBody().addChild(om4);
 
-        RPCCall call =
-                new RPCCall("target/test-resources/integrationRepo");
-
         Options options = new Options();
-        call.setClientOptions(options);
         options.setTo(targetEPR);
         options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
 
-        SOAPEnvelope env = call.invokeBlocking("beanOM", envelope);
+        ConfigurationContext configConetxt = new ConfigurationContextFactory()
+                .buildConfigurationContext("target/test-resources/integrationRepo");
+        RPCServiceClient rpcClient = new RPCServiceClient(configConetxt, null);
+        rpcClient.setOptions(options);
+        MessageContext reqMessageContext = new MessageContext(configConetxt);
+        OperationClient opClinet = rpcClient.createClient(ServiceClient.ANON_OUT_IN_OP);
+        opClinet.setOptions(options);
+        reqMessageContext.setEnvelope(envelope);
+
+        opClinet.addMessageContext(reqMessageContext);
+        opClinet.execute(true);
+
+        MessageContext responseMessageContx = opClinet.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+
+        SOAPEnvelope env = responseMessageContx.getEnvelope();
+
         OMElement response = env.getBody().getFirstElement();
         MyBean resBean = (MyBean) BeanUtil.deserialize(MyBean.class, response.getFirstElement());
         assertNotNull(resBean);
         assertEquals(resBean.getAge(), 159);
-        call.close();
+        rpcClient.finalizeInvoke();
     }
 
 
@@ -395,15 +453,26 @@
         String ref4 = "<reference id=\"4\">Colombo3</reference>";
         OMElement om4 = getOMelemnt(ref4, fac);
         envelope.getBody().addChild(om4);
-
-        RPCCall call =
-                new RPCCall("target/test-resources/integrationRepo");
-
         Options options = new Options();
-        call.setClientOptions(options);
         options.setTo(targetEPR);
         options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
-        SOAPEnvelope env = call.invokeBlocking("omrefs", envelope);
+
+        ConfigurationContext configConetxt = new ConfigurationContextFactory()
+                .buildConfigurationContext("target/test-resources/integrationRepo");
+        RPCServiceClient rpcClient = new RPCServiceClient(configConetxt, null);
+        rpcClient.setOptions(options);
+        MessageContext reqMessageContext = new MessageContext(configConetxt);
+        OperationClient opClinet = rpcClient.createClient(ServiceClient.ANON_OUT_IN_OP);
+        opClinet.setOptions(options);
+        reqMessageContext.setEnvelope(envelope);
+
+        opClinet.addMessageContext(reqMessageContext);
+        opClinet.execute(true);
+
+        MessageContext responseMessageContx = opClinet.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+
+        SOAPEnvelope env = responseMessageContx.getEnvelope();
+
         OMElement response = env.getBody().getFirstElement();
 
         ArrayList args = new ArrayList();
@@ -412,7 +481,7 @@
         Object [] resBean = BeanUtil.deserialize(response, args.toArray());
         assertNotNull(resBean);
         assertEquals(((Boolean) resBean[0]).booleanValue(), true);
-        call.close();
+        rpcClient.finalizeInvoke();
     }
 
     private OMElement getOMelemnt(String str, OMFactory fac) throws AxisFault {
@@ -459,14 +528,26 @@
                 "<town>Colombo3</town><number>1010</number>\n" +
                 "</reference>";
         envelope.getBody().addChild(getOMelemnt(str, fac));
-        RPCCall call =
-                new RPCCall("target/test-resources/integrationRepo");
 
         Options options = new Options();
-        call.setClientOptions(options);
         options.setTo(targetEPR);
         options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
-        SOAPEnvelope env = call.invokeBlocking("echoEmployee", envelope);
+        ConfigurationContext configConetxt = new ConfigurationContextFactory()
+                .buildConfigurationContext("target/test-resources/integrationRepo");
+        RPCServiceClient rpcClient = new RPCServiceClient(configConetxt, null);
+        rpcClient.setOptions(options);
+        MessageContext reqMessageContext = new MessageContext(configConetxt);
+        OperationClient opClinet = rpcClient.createClient(ServiceClient.ANON_OUT_IN_OP);
+        opClinet.setOptions(options);
+        reqMessageContext.setEnvelope(envelope);
+
+        opClinet.addMessageContext(reqMessageContext);
+        opClinet.execute(true);
+
+        MessageContext responseMessageContx = opClinet.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+
+        SOAPEnvelope env = responseMessageContx.getEnvelope();
+
         Employee emp = (Employee) BeanUtil.deserialize(Employee.class, env.getBody().getFirstElement().getFirstElement());
         assertNotNull(emp);
     }
@@ -511,15 +592,27 @@
             throw new AxisFault(factoryConfigurationError);
         }
         envelope.getBody().addChild(staxOMBuilder.getDocumentElement());
-        RPCCall call =
-                new RPCCall("target/test-resources/integrationRepo");
 
         Options options = new Options();
-        call.setClientOptions(options);
         options.setTo(targetEPR);
         options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
 
-        SOAPEnvelope env = call.invokeBlocking("handleArrayList", envelope);
+
+        ConfigurationContext configConetxt = new ConfigurationContextFactory()
+                .buildConfigurationContext("target/test-resources/integrationRepo");
+        RPCServiceClient rpcClient = new RPCServiceClient(configConetxt, null);
+        rpcClient.setOptions(options);
+        MessageContext reqMessageContext = new MessageContext(configConetxt);
+        OperationClient opClinet = rpcClient.createClient(ServiceClient.ANON_OUT_IN_OP);
+        opClinet.setOptions(options);
+        reqMessageContext.setEnvelope(envelope);
+
+        opClinet.addMessageContext(reqMessageContext);
+        opClinet.execute(true);
+
+        MessageContext responseMessageContx = opClinet.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+
+        SOAPEnvelope env = responseMessageContx.getEnvelope();
         assertEquals(env.getBody().getFirstElement().getFirstElement().getText(), "abcdefghiklm10");
     }
 

Modified: webservices/axis2/trunk/java/modules/samples/src/sample/yahooservices/RESTSearch/RESTSearchClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/samples/src/sample/yahooservices/RESTSearch/RESTSearchClient.java?rev=365886&r1=365885&r2=365886&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/samples/src/sample/yahooservices/RESTSearch/RESTSearchClient.java
(original)
+++ webservices/axis2/trunk/java/modules/samples/src/sample/yahooservices/RESTSearch/RESTSearchClient.java
Wed Jan  4 02:32:13 2006
@@ -14,14 +14,14 @@
 
             RESTCall call = new RESTCall();
             Options options = new Options();
-            call.setClientOptions(options);
+            call.setOptions(options);
             options.setTo(new EndpointReference(epr));
             options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
             options.setProperty(Constants.Configuration.ENABLE_REST, Constants.VALUE_TRUE);
             options.setProperty(Constants.Configuration.ENABLE_REST_THROUGH_GET, Constants.VALUE_TRUE);
 
             //if post is through GET of HTTP
-            OMElement response = call.invokeBlocking();
+            OMElement response = call.sendReceive();
             response.serialize(System.out);
 
         } catch (Exception e) {

Modified: webservices/axis2/trunk/java/modules/samples/src/userguide/clients/MailClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/samples/src/userguide/clients/MailClient.java?rev=365886&r1=365885&r2=365886&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/samples/src/userguide/clients/MailClient.java (original)
+++ webservices/axis2/trunk/java/modules/samples/src/userguide/clients/MailClient.java Wed
Jan  4 02:32:13 2006
@@ -18,8 +18,8 @@
 
 import org.apache.axis2.AxisFault;
 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.om.OMAbstractFactory;
 import org.apache.axis2.om.OMElement;
 import org.apache.axis2.om.OMFactory;
@@ -33,14 +33,14 @@
     private static String toEpr = "http://localhost:8080/axis2/services/myservice";
 
     public static void main(String[] args) throws AxisFault {
-        MessageSender msgSender = new MessageSender();
-
         Options options = new Options();
         options.setTo(
                 new EndpointReference(toEpr));
-        msgSender.setClientOptions(options);
+        ServiceClient servicClient = new ServiceClient();
+
+        servicClient.setOptions(options);
 
-        msgSender.send("echo", getPayload());
+        servicClient.sendRobust(getPayload());
     }
 
     private static OMElement getPayload() {



Mime
View raw message