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 pr...@apache.org on 2008/07/28 17:25:21 UTC

svn commit: r680382 - in /webservices/axis2/trunk/java/modules: addressing/src/META-INF/ addressing/src/org/apache/axis2/addressing/ addressing/src/org/apache/axis2/addressing/i18n/ addressing/src/org/apache/axis2/handlers/addressing/ addressing/test/o...

Author: pradine
Date: Mon Jul 28 08:25:17 2008
New Revision: 680382

URL: http://svn.apache.org/viewvc?rev=680382&view=rev
Log:
Fix for jira issue AXIS2-3949.

Added:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/AddressingFaultsHelper.java
      - copied unchanged from r678268, webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/addressing/AddressingFaultsHelper.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/i18n/
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/i18n/AddressingMessages.java
      - copied unchanged from r678268, webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/addressing/i18n/AddressingMessages.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/i18n/resource.properties
      - copied unchanged from r678268, webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/addressing/i18n/resource.properties
    webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/addressing/AddressingFaultsTest.java
      - copied unchanged from r678268, webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/addressing/AddressingFaultsTest.java
Removed:
    webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/addressing/AddressingFaultsHelper.java
    webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/addressing/i18n/
    webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/addressing/
Modified:
    webservices/axis2/trunk/java/modules/addressing/src/META-INF/module.xml
    webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingValidationHandler.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/AddressingBasedDispatcher.java

Modified: webservices/axis2/trunk/java/modules/addressing/src/META-INF/module.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/src/META-INF/module.xml?rev=680382&r1=680381&r2=680382&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/src/META-INF/module.xml (original)
+++ webservices/axis2/trunk/java/modules/addressing/src/META-INF/module.xml Mon Jul 28 08:25:17 2008
@@ -24,7 +24,7 @@
             <order phase="Addressing" before="AddressingBasedDispatcher"/>
         </handler>
         <handler name="AddressingValidationHandler" class="org.apache.axis2.handlers.addressing.AddressingValidationHandler">
-            <order phase="Addressing" after="AddressingBasedDispatcher"/>
+            <order phase="Dispatch" after="SOAPMessageBodyBasedDispatcher"/>
         </handler>
     </InFlow>
 

Modified: webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingValidationHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingValidationHandler.java?rev=680382&r1=680381&r2=680382&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingValidationHandler.java (original)
+++ webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingValidationHandler.java Mon Jul 28 08:25:17 2008
@@ -52,8 +52,6 @@
             // is in use we should throw an ActionNotSupported Fault, unless we've been told
             // not to do this check (by Synapse, for instance)
             if (JavaUtils.isTrue(msgContext.getProperty(ADDR_VALIDATE_ACTION), true)) {
-                checkAction(msgContext);
-
                 // Check if the wsa:MessageID is required or not.
                 checkMessageIDHeader(msgContext);
             }
@@ -142,18 +140,6 @@
     }
 
     /**
-     * If addressing was found and the dispatch failed we SHOULD (and hence will) return a
-     * WS-Addressing ActionNotSupported fault. This will make more sense once the
-     * AddressingBasedDsipatcher is moved into the addressing module
-     */
-    private void checkAction(MessageContext msgContext) throws AxisFault {
-        if ((msgContext.getAxisService() == null) || (msgContext.getAxisOperation() == null)) {
-            AddressingFaultsHelper
-                    .triggerActionNotSupportedFault(msgContext, msgContext.getWSAAction());
-        }
-    }
-
-    /**
      * Validate that a message id is present when required. The check applied here only applies to
      * WS-Addressing headers that comply with the 2005/08 (final) spec.
      *

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/AddressingBasedDispatcher.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/AddressingBasedDispatcher.java?rev=680382&r1=680381&r2=680382&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/AddressingBasedDispatcher.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dispatchers/AddressingBasedDispatcher.java Mon Jul 28 08:25:17 2008
@@ -21,6 +21,7 @@
 
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.addressing.AddressingFaultsHelper;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.context.OperationContext;
 import org.apache.axis2.context.ServiceContext;
@@ -30,6 +31,7 @@
 import org.apache.axis2.description.HandlerDescription;
 import org.apache.axis2.engine.AbstractDispatcher;
 import org.apache.axis2.i18n.Messages;
+import org.apache.axis2.util.JavaUtils;
 import org.apache.axis2.util.LoggingControl;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -66,6 +68,8 @@
      * @noinspection MethodReturnOfConcreteClass
      */
     public InvocationResponse invoke(MessageContext msgctx) throws AxisFault {
+        InvocationResponse response = InvocationResponse.CONTINUE;
+        
         // first check we can dispatch using the relates to
         if (msgctx.getRelatesTo() != null) {
             String relatesTo = msgctx.getRelatesTo().getValue();
@@ -103,10 +107,39 @@
                                 " Dispatched successfully on the RelatesTo. operation=" +
                                 operationContext.getAxisOperation());
                     }
-                    return InvocationResponse.CONTINUE;
                 }
             }
         }
-        return super.invoke(msgctx);
+        //Else we will try to dispatch based on the WS-A Action
+        else {
+            response = super.invoke(msgctx);
+            Object flag = msgctx.getLocalProperty(IS_ADDR_INFO_ALREADY_PROCESSED);
+            if (log.isTraceEnabled()) {
+                log.trace("invoke: IS_ADDR_INFO_ALREADY_PROCESSED=" + flag);
+            }
+
+            if (JavaUtils.isTrueExplicitly(flag)) {
+                // If no AxisOperation has been found at the end of the dispatch phase and addressing
+                // is in use we should throw an ActionNotSupported Fault, unless we've been told
+                // not to do this check (by Synapse, for instance)
+                if (JavaUtils.isTrue(msgctx.getProperty(ADDR_VALIDATE_ACTION), true)) {
+                    checkAction(msgctx);
+                }
+            }
+        }
+        
+        return response;
+    }
+    
+    /**
+     * If addressing was found and the dispatch failed we SHOULD (and hence will) return a
+     * WS-Addressing ActionNotSupported fault. This will make more sense once the
+     * AddressingBasedDsipatcher is moved into the addressing module
+     */
+    private void checkAction(MessageContext msgContext) throws AxisFault {
+        if ((msgContext.getAxisService() == null) || (msgContext.getAxisOperation() == null)) {
+            AddressingFaultsHelper
+                    .triggerActionNotSupportedFault(msgContext, msgContext.getWSAAction());
+        }
     }
 }