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 he...@apache.org on 2005/05/31 13:38:02 UTC

svn commit: r179207 - in /webservices/axis/trunk/java: etc/ modules/core/src/org/apache/axis/context/ modules/core/src/org/apache/axis/engine/ modules/samples/test/org/apache/axis/engine/

Author: hemapani
Date: Tue May 31 04:38:01 2005
New Revision: 179207

URL: http://svn.apache.org/viewcvs?rev=179207&view=rev
Log:
fixing the bug regarding the consecative Message Request

Added:
    webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/EchoRawXMLLoadTest.java
Modified:
    webservices/axis/trunk/java/etc/project.xml
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/ConfigurationContext.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/OperationContext.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/AbstractDispatcher.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/AxisEngine.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/Phase.java

Modified: webservices/axis/trunk/java/etc/project.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/etc/project.xml?rev=179207&r1=179206&r2=179207&view=diff
==============================================================================
--- webservices/axis/trunk/java/etc/project.xml (original)
+++ webservices/axis/trunk/java/etc/project.xml Tue May 31 04:38:01 2005
@@ -172,6 +172,7 @@
         <exclude>**/*Abstract*.java</exclude>
 	    <exclude>**/*Util*.java</exclude> 
 		<exclude>**/*PhaseResolvingTest.java</exclude>
+		<exclude>**/*EnginePausingTest.java</exclude>
   
    
       </excludes>

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/ConfigurationContext.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/ConfigurationContext.java?rev=179207&r1=179206&r2=179207&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/ConfigurationContext.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/ConfigurationContext.java Tue May 31 04:38:01 2005
@@ -63,7 +63,7 @@
 
     }
 
-    public void removeService(QName name) {
+    public synchronized void removeService(QName name) {
         serviceContextMap.remove(name);
     }
 
@@ -81,7 +81,7 @@
         axisConfiguration = configuration;
     }
 
-     public void registerOperationContext(String messageID, OperationContext mepContext) {
+     public synchronized void registerOperationContext(String messageID, OperationContext mepContext) {
         this.operationContextMap.put(messageID, mepContext);
     }
 
@@ -93,7 +93,7 @@
         return this.operationContextMap;
     }
 
-    public void registerServiceContext(String serviceInstanceID, ServiceContext serviceContext) {
+    public synchronized void registerServiceContext(String serviceInstanceID, ServiceContext serviceContext) {
         this.serviceContextMap.put(serviceInstanceID, serviceContext);
     }
 

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/OperationContext.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/OperationContext.java?rev=179207&r1=179206&r2=179207&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/OperationContext.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/OperationContext.java Tue May 31 04:38:01 2005
@@ -105,7 +105,7 @@
      *
      * @param msgContext
      */
-    public void addMessageContext(MessageContext msgContext) throws AxisFault {
+    public synchronized void addMessageContext(MessageContext msgContext) throws AxisFault {
         // this needs to store the msgContext in either inMessageContext or
         // outMessageContext depending on the MEP of the OperationDescription
         // and on the current state of the operation.

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/AbstractDispatcher.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/AbstractDispatcher.java?rev=179207&r1=179206&r2=179207&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/AbstractDispatcher.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/AbstractDispatcher.java Tue May 31 04:38:01 2005
@@ -17,6 +17,7 @@
 
 import org.apache.axis.context.ConfigurationContext;
 import org.apache.axis.context.MessageContext;
+import org.apache.axis.context.OperationContext;
 import org.apache.axis.description.HandlerDescription;
 import org.apache.axis.description.OperationDescription;
 import org.apache.axis.description.ServiceDescription;
@@ -61,7 +62,8 @@
         if (msgctx.getServiceContext() != null && msgctx.getOperationContext() == null) {
             OperationDescription axisOperation = findOperation(msgctx.getServiceContext().getServiceConfig(),msgctx);
             if(axisOperation != null){
-                msgctx.setOperationContext(axisOperation.findOperationContext(msgctx,msgctx.getServiceContext(),msgctx.isServerSide()));
+                OperationContext operationContext = axisOperation.findOperationContext(msgctx,msgctx.getServiceContext(),msgctx.isServerSide());
+                msgctx.setOperationContext(operationContext);
             }
         }
 

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/AxisEngine.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/AxisEngine.java?rev=179207&r1=179206&r2=179207&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/AxisEngine.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/AxisEngine.java Tue May 31 04:38:01 2005
@@ -96,9 +96,11 @@
             ConfigurationContext sysCtx = context.getSystemContext();
             ArrayList phases = sysCtx.getAxisConfiguration().getInPhasesUptoAndIncludingPostDispatch();
             invokePhases(phases, context);
+            verifyContextBuilt(context);
             
             OperationContext operationContext = context.getOperationContext();
-            phases = operationContext.getAxisOperation().getRemainingPhasesInFlow();
+            OperationDescription operationDescription = operationContext.getAxisOperation();
+            phases = operationDescription.getRemainingPhasesInFlow();
             invokePhases(phases, context);
             if (context.isServerSide()) {
                 // add invoke Phase

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/Phase.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/Phase.java?rev=179207&r1=179206&r2=179207&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/Phase.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/Phase.java Tue May 31 04:38:01 2005
@@ -45,9 +45,6 @@
      */
     private Log log = LogFactory.getLog(getClass());
 
-    private int indexOfHandlerToExecute = 0;
-
-
     /**
      * to keet info about phase first handler
      */
@@ -146,6 +143,7 @@
             }
         }
         //Invoking the rest of handler except phaseFirst and phaseLast
+        int indexOfHandlerToExecute = 0;
         while (indexOfHandlerToExecute < handlers.size()) {
             if (msgctx.isPaused()) {
                 break;
@@ -157,7 +155,6 @@
                     handler.invoke(msgctx);
                     //This line should be after the invoke as if the invocation failed this handlers is takn care of and
                     //no need to revoke agien
-                    //         executionStack.push(handler);
                     indexOfHandlerToExecute++;
                 }
             }

Added: webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/EchoRawXMLLoadTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/EchoRawXMLLoadTest.java?rev=179207&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/EchoRawXMLLoadTest.java (added)
+++ webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/EchoRawXMLLoadTest.java Tue May 31 04:38:01 2005
@@ -0,0 +1,159 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis.engine;
+
+//todo
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+
+import junit.framework.TestCase;
+
+import org.apache.axis.Constants;
+import org.apache.axis.addressing.AddressingConstants;
+import org.apache.axis.addressing.EndpointReference;
+import org.apache.axis.clientapi.AsyncResult;
+import org.apache.axis.clientapi.Callback;
+import org.apache.axis.context.MessageContext;
+import org.apache.axis.context.ServiceContext;
+import org.apache.axis.description.ServiceDescription;
+import org.apache.axis.integration.UtilServer;
+import org.apache.axis.om.OMAbstractFactory;
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMFactory;
+import org.apache.axis.om.OMNamespace;
+import org.apache.axis.soap.SOAPFactory;
+import org.apache.axis.transport.http.SimpleHTTPServer;
+import org.apache.axis.util.Utils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class EchoRawXMLLoadTest extends TestCase {
+    private EndpointReference targetEPR =
+            new EndpointReference(AddressingConstants.WSA_TO,
+                    "http://127.0.0.1:"
+            + (UtilServer.TESTING_PORT)
+            + "/axis/services/EchoXMLService/echoOMElement");
+    private Log log = LogFactory.getLog(getClass());
+    private QName serviceName = new QName("EchoXMLService");
+    private QName operationName = new QName("echoOMElement");
+    private QName transportName = new QName("http://localhost/my", "NullTransport");
+
+    private AxisConfiguration engineRegistry;
+    private MessageContext mc;
+    //private Thread thisThread;
+   // private SimpleHTTPServer sas;
+    private ServiceContext serviceContext;
+    private ServiceDescription service;
+
+    private boolean finish = false;
+
+    public EchoRawXMLLoadTest() {
+        super(EchoRawXMLLoadTest.class.getName());
+    }
+
+    public EchoRawXMLLoadTest(String testName) {
+        super(testName);
+    }
+
+    protected void setUp() throws Exception {
+        UtilServer.start();
+        service =
+                Utils.createSimpleService(serviceName,
+                        org.apache.axis.engine.Echo.class.getName(),
+                        operationName);
+        UtilServer.deployService(service);
+        serviceContext =
+                UtilServer.getConfigurationContext().createServiceContext(service.getName());
+
+    }
+
+    protected void tearDown() throws Exception {
+        UtilServer.unDeployService(serviceName);
+        UtilServer.stop();
+    }
+
+    private OMElement createEnvelope() {
+        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.addChild(fac.createText(value, "Isaac Assimov, the foundation Sega"));
+        method.addChild(value);
+        
+        return method;
+    }
+
+//    public void testEchoXMLASync() throws Exception {
+//                OMElement payload = createEnvelope();
+//
+//        org.apache.axis.clientapi.Call call = new org.apache.axis.clientapi.Call();
+//
+//        call.setTo(targetEPR);
+//        call.setTransportInfo(Constants.TRANSPORT_HTTP, Constants.TRANSPORT_HTTP, false);
+//
+//        Callback callback = new Callback() {
+//            public void onComplete(AsyncResult result) {
+//                try {
+//                    result.getResponseEnvelope().serializeWithCache(XMLOutputFactory.newInstance().createXMLStreamWriter(System.out));
+//                } catch (XMLStreamException e) {
+//                    reportError(e);
+//                } finally {
+//                    finish = true;
+//                }
+//            }
+//
+//            public void reportError(Exception e) {
+//                e.printStackTrace();
+//                finish = true;
+//            }
+//        };
+//
+//        call.invokeNonBlocking(operationName.getLocalPart(), payload, callback);
+//        int index = 0;
+//        while (!finish) {
+//            Thread.sleep(1000);
+//            index++;
+//            if(index > 10 ){
+//                throw new AxisFault("Server is shutdown as the Async response take too longs time");
+//            }
+//        }
+//
+//
+//        log.info("send the reqest");
+//    }
+
+    public void testEchoXMLSync() throws Exception {
+        SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
+
+        OMElement payload = createEnvelope();
+
+        org.apache.axis.clientapi.Call call = new org.apache.axis.clientapi.Call();
+
+        call.setTo(targetEPR);
+        call.setTransportInfo(Constants.TRANSPORT_HTTP, Constants.TRANSPORT_HTTP, false);
+
+        OMElement result =
+                (OMElement) call.invokeBlocking(operationName.getLocalPart(), payload);
+                
+        OMElement result1 =
+                        (OMElement) call.invokeBlocking(operationName.getLocalPart(), payload);
+        
+        result.serializeWithCache(XMLOutputFactory.newInstance().createXMLStreamWriter(System.out));
+    }
+}