Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 367F310FA9 for ; Fri, 22 Nov 2013 16:54:42 +0000 (UTC) Received: (qmail 32910 invoked by uid 500); 22 Nov 2013 16:54:40 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 32394 invoked by uid 500); 22 Nov 2013 16:54:35 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 32385 invoked by uid 99); 22 Nov 2013 16:54:34 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Nov 2013 16:54:34 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Nov 2013 16:54:32 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 226BD23888E7; Fri, 22 Nov 2013 16:54:12 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@cxf.apache.org From: ashakirin@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20131122165412.226BD23888E7@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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())); + } }