You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by de...@apache.org on 2005/09/29 12:24:34 UTC

svn commit: r292412 - in /webservices/axis2/trunk/java/modules: core/src/org/apache/axis2/clientapi/InOutMEPClient.java core/src/org/apache/axis2/engine/SOAPMessageBodyBasedDispatcher.java integration/test/org/apache/axis2/tcp/TCPEchoRawXMLTest.java

Author: deepal
Date: Thu Sep 29 03:24:18 2005
New Revision: 292412

URL: http://svn.apache.org/viewcvs?rev=292412&view=rev
Log:
1. Adding one more test method to TCPEchoRawXMLTest.java
2. If the body is empty previously it gave a ServletException rather that giving AxisFult in SOAPMessageBodyBasedDispatcher.java
3. Removed unnecessary or condition in InOutMEPClient.java

Modified:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/InOutMEPClient.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/SOAPMessageBodyBasedDispatcher.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/tcp/TCPEchoRawXMLTest.java

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/InOutMEPClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/InOutMEPClient.java?rev=292412&r1=292411&r2=292412&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/InOutMEPClient.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/InOutMEPClient.java Thu Sep 29 03:24:18 2005
@@ -18,6 +18,7 @@
 
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
+import org.apache.axis2.deployment.util.PhasesInfo;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
@@ -29,6 +30,7 @@
 import org.apache.axis2.description.TransportOutDescription;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.AxisEngine;
+import org.apache.axis2.engine.AxisConfigurationImpl;
 import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.om.OMException;
 import org.apache.axis2.soap.SOAPBody;
@@ -100,7 +102,7 @@
 
     public InOutMEPClient(ServiceContext serviceContext) {
         super(serviceContext, WSDLConstants.MEP_URI_OUT_IN);
-        //service context has the engine context set in to it ! 
+        //service context has the engine context set in to it !
         callbackReceiver = new CallbackReceiver();
     }
 
@@ -126,9 +128,9 @@
         msgctx.setMessageID(messageID);
         //
         if (useSeparateListener) {
-            //This mean doing a Request-Response invocation using two channel. If the 
+            //This mean doing a Request-Response invocation using two channel. If the
             //transport is two way transport (e.g. http) Only one channel is used (e.g. in http cases
-            //202 OK is sent to say no repsone avalible). Axis2 get blocked return when the response is avalible. 
+            //202 OK is sent to say no repsone avalible). Axis2 get blocked return when the response is avalible.
 
             SyncCallBack callback = new SyncCallBack();
             //this method call two channel non blocking method to do the work and wait on the callbck
@@ -167,7 +169,6 @@
             msgctx.setConfigurationContext(syscontext);
 
             checkTransport(msgctx);
-
             //find and set the Operation Context
             OperationContext operationContext = OperationContextFactory.createOperationContext(WSDLConstants.MEP_CONSTANT_IN_OUT,
                     axisop,
@@ -292,8 +293,7 @@
                     senderTransport.equals(listenerTransport);
             boolean isATwoWaytransport =
                     Constants.TRANSPORT_HTTP.equals(senderTransport)
-                            || Constants.TRANSPORT_TCP.equals(senderTransport)
-                            || Constants.TRANSPORT_HTTP.equals(senderTransport);
+                            || Constants.TRANSPORT_TCP.equals(senderTransport);
             if ((!isTransportsEqual || !isATwoWaytransport)) {
                 throw new AxisFault(Messages.getMessage("useSeparateListenerLimited"));
             }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/SOAPMessageBodyBasedDispatcher.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/SOAPMessageBodyBasedDispatcher.java?rev=292412&r1=292411&r2=292412&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/SOAPMessageBodyBasedDispatcher.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/SOAPMessageBodyBasedDispatcher.java Thu Sep 29 03:24:18 2005
@@ -57,7 +57,10 @@
             throws AxisFault {
         OMElement bodyFirstChild = messageContext.getEnvelope().getBody()
                 .getFirstElement();
-        operationName = new QName(bodyFirstChild.getLocalName());
+        if(bodyFirstChild !=null)
+              operationName = new QName(bodyFirstChild.getLocalName());
+        else
+           throw  new AxisFault("Empty Body SOAPEnevelop");
 
         return service.getOperation(operationName);
     }

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/tcp/TCPEchoRawXMLTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/tcp/TCPEchoRawXMLTest.java?rev=292412&r1=292411&r2=292412&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/tcp/TCPEchoRawXMLTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/tcp/TCPEchoRawXMLTest.java Thu Sep 29 03:24:18 2005
@@ -20,13 +20,19 @@
 import junit.framework.TestCase;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
+import org.apache.axis2.deployment.DeploymentException;
+import org.apache.axis2.deployment.util.PhasesInfo;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.clientapi.AsyncResult;
 import org.apache.axis2.clientapi.Callback;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.context.ServiceContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.description.ServiceDescription;
+import org.apache.axis2.description.OperationDescription;
 import org.apache.axis2.engine.Echo;
+import org.apache.axis2.engine.AxisConfigurationImpl;
 import org.apache.axis2.integration.UtilServer;
 import org.apache.axis2.integration.UtilsTCPServer;
 import org.apache.axis2.om.OMAbstractFactory;
@@ -34,6 +40,7 @@
 import org.apache.axis2.om.OMFactory;
 import org.apache.axis2.om.OMNamespace;
 import org.apache.axis2.soap.SOAPFactory;
+import org.apache.axis2.soap.SOAPEnvelope;
 import org.apache.axis2.transport.http.SimpleHTTPServer;
 import org.apache.axis2.util.Utils;
 import org.apache.commons.logging.Log;
@@ -46,8 +53,8 @@
 public class TCPEchoRawXMLTest extends TestCase {
     private EndpointReference targetEPR =
             new EndpointReference("tcp://127.0.0.1:"
-            + (UtilServer.TESTING_PORT)
-            + "/axis/services/EchoXMLService/echoOMElement");
+                    + (UtilServer.TESTING_PORT)
+                    + "/axis/services/EchoXMLService/echoOMElement");
     private QName serviceName = new QName("EchoXMLService");
     private QName operationName = new QName("echoOMElement");
     private QName transportName = new QName("http://localhost/my",
@@ -80,8 +87,8 @@
                         operationName);
         UtilsTCPServer.deployService(service);
         clientService = Utils.createSimpleService(serviceName,
-                        Echo.class.getName(),
-                        operationName);
+                Echo.class.getName(),
+                operationName);
         serviceContext = UtilServer.createAdressedEnabledClientSide(clientService);
     }
 
@@ -164,7 +171,7 @@
                 call.invokeBlocking(operationName.getLocalPart(),
                         payload);
         result.serializeWithCache(XMLOutputFactory.newInstance().createXMLStreamWriter(
-                                System.out));
+                System.out));
         call.close();
     }
 
@@ -194,9 +201,49 @@
         OMElement result = call.invokeBlocking(
                 operationName.getLocalPart(), method);
         result.serializeWithCache(XMLOutputFactory.newInstance().createXMLStreamWriter(
-                                System.out));
+                System.out));
         call.close();
 
+    }
+
+    public void testEchoXMLSyncMC() throws Exception {
+        ConfigurationContextFactory confac = new ConfigurationContextFactory();
+        ConfigurationContext configContext= confac.buildClientConfigurationContext(Constants.TESTING_REPOSITORY);
+
+        OperationDescription opdesc = new OperationDescription(new QName("echoOMElement"));
+        org.apache.axis2.clientapi.Call call = new org.apache.axis2.clientapi.Call(Constants.TESTING_REPOSITORY);
+        call.setTo(targetEPR);
+
+        call.setWsaAction(operationName.getLocalPart());
+        call.setTransportInfo(Constants.TRANSPORT_TCP, Constants.TRANSPORT_TCP, false);
+
+        OMFactory fac = OMAbstractFactory.getOMFactory();
+
+        OMNamespace omNs = fac.createOMNamespace("http://localhost/my", "my");
+        OMElement method = fac.createOMElement("echoOMElement", omNs);
+        OMElement value = fac.createOMElement("myValue", omNs);
+        value.setText("Isaac Assimov, the foundation Sega");
+        method.addChild(value);
+        SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
+        SOAPEnvelope envelope = factory.getDefaultEnvelope();
+        envelope.getBody().addChild(method);
+
+        MessageContext requestContext = new MessageContext(configContext);
+        ServiceDescription srevice = new ServiceDescription(serviceName);
+        srevice.addOperation(opdesc);
+        configContext.getAxisConfiguration().addService(srevice);
+        requestContext.setServiceDescription(service);
+        requestContext.setOperationDescription(opdesc);
+
+        //  requestContext.setTo(targetEPR);
+
+        requestContext.setEnvelope(envelope);
+        MessageContext res= call.invokeBlocking(opdesc, requestContext);
+
+        SOAPEnvelope env=   call.invokeBlocking("echoOMElement", envelope);
+//        SOAPEnvelope env=  res.getEnvelope();
+        env.getBody().serializeWithCache(XMLOutputFactory.newInstance().createXMLStreamWriter(
+                System.out));
     }