cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ashaki...@apache.org
Subject svn commit: r1544605 - /cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapActionInInterceptor.java
Date Fri, 22 Nov 2013 16:54:12 GMT
Author: ashakirin
Date: Fri Nov 22 16:54:11 2013
New Revision: 1544605

URL: http://svn.apache.org/r1544605
Log:
[CXF-5387] Added property to relax validation of SOAP Action in case if it not specified in
WSDL/service model

Modified:
    cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapActionInInterceptor.java

Modified: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapActionInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapActionInInterceptor.java?rev=1544605&r1=1544604&r2=1544605&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapActionInInterceptor.java
(original)
+++ cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapActionInInterceptor.java
Fri Nov 22 16:54:11 2013
@@ -36,6 +36,7 @@ import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.service.model.OperationInfo;
@@ -44,6 +45,7 @@ import org.apache.cxf.ws.addressing.JAXW
 public class SoapActionInInterceptor extends AbstractSoapInterceptor {
     
     private static final Logger LOG = LogUtils.getL7dLogger(SoapActionInInterceptor.class);
+    private static final String ALLOW_NON_MATCHING_TO_DEFAULT = "allowNonMatchingToDefaultSoapAction";
     
     public SoapActionInInterceptor() {
         super(Phase.READ);
@@ -124,8 +126,7 @@ public class SoapActionInInterceptor ext
             .getBinding().getOperations();
         if (bops != null) {
             for (BindingOperationInfo boi : bops) {
-                SoapOperationInfo soi = boi.getExtensor(SoapOperationInfo.class);
-                if (soi != null && action.equals(soi.getAction())) {
+                if (isActionMatch(message, boi, action)) {
                     if (bindingOp != null) {
                         //more than one op with the same action, will need to parse normally
                         return;
@@ -172,8 +173,7 @@ public class SoapActionInInterceptor ext
             if (StringUtils.isEmpty(action)) {
                 return;
             }
-            SoapOperationInfo soi = boi.getExtensor(SoapOperationInfo.class);
-            if (soi == null || action.equals(soi.getAction())) {
+            if (isActionMatch(message, boi, action)) {
                 return;
             }
 
@@ -189,5 +189,13 @@ public class SoapActionInInterceptor ext
         }
     }
 
+    private static boolean isActionMatch(SoapMessage message, BindingOperationInfo boi, String
action) {
+        SoapOperationInfo soi = boi.getExtensor(SoapOperationInfo.class);
+        boolean allowNoMatchingToDefault = MessageUtils.getContextualBoolean(message,
+                                                                    ALLOW_NON_MATCHING_TO_DEFAULT,
+                                                                    false);
+        return ((soi != null) && action.equals(soi.getAction()))
+            || ((soi != null) && allowNoMatchingToDefault && StringUtils.isEmpty(soi.getAction()));
+    }
 
 }



Mime
View raw message