Author: dkulp Date: Tue Feb 19 20:51:52 2013 New Revision: 1447913 URL: http://svn.apache.org/r1447913 Log: Merged revisions 1447900 via git cherry-pick from https://svn.apache.org/repos/asf/cxf/branches/2.7.x-fixes
........ r1447900 | dkulp | 2013-02-19 15:27:14 -0500 (Tue, 19 Feb 2013) | 10 lines Merged revisions 1447874 via git cherry-pick from https://svn.apache.org/repos/asf/cxf/trunk ........ r1447874 | dkulp | 2013-02-19 14:16:44 -0500 (Tue, 19 Feb 2013) | 2 lines Fix a problem where the wrong fault was returned. ........ ........ Modified: cxf/branches/2.6.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/MustUnderstandInterceptor.java Modified: cxf/branches/2.6.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/MustUnderstandInterceptor.java URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/MustUnderstandInterceptor.java?rev=1447913&r1=1447912&r2=1447913&view=diff ============================================================================== --- cxf/branches/2.6.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/MustUnderstandInterceptor.java (original) +++ cxf/branches/2.6.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/MustUnderstandInterceptor.java Tue Feb 19 20:51:52 2013 @@ -95,6 +95,18 @@ public class MustUnderstandInterceptor e checkUltimateReceiverHeaders(ultimateReceiverHeaders, mustUnderstandQNames, soapMessage); } } + @Override + public void handleFault(SoapMessage msg) { + Set<QName> unknowns = CastUtils.cast((Set<?>)msg.get(MustUnderstandInterceptor.UNKNOWNS)); + if (msg.getExchange().getBindingOperationInfo() == null + && unknowns != null && !unknowns.isEmpty()) { + //per jaxws spec, if there are must understands that we didn't understand, but couldn't map + //to an operation either, we need to throw the mustunderstand fault, not the one related to + //an unknown operation + msg.setContent(Exception.class, new SoapFault(new Message("MUST_UNDERSTAND", BUNDLE, unknowns), + msg.getVersion().getMustUnderstand())); + } + } private void checkUltimateReceiverHeaders(Set<Header> ultimateReceiverHeaders, Set<QName> mustUnderstandQNames, @@ -236,6 +248,7 @@ public class MustUnderstandInterceptor e if (!notFound.isEmpty()) { + soapMessage.remove(UNKNOWNS); throw new SoapFault(new Message("MUST_UNDERSTAND", BUNDLE, notFound), soapVersion.getMustUnderstand()); } @@ -263,11 +276,10 @@ public class MustUnderstandInterceptor e Set<QName> paramHeaders = HeaderUtil.getHeaderQNameInOperationParam(message); unknowns.removeAll(paramHeaders); + message.remove(MustUnderstandInterceptor.UNKNOWNS); if (!unknowns.isEmpty()) { throw new SoapFault(new Message("MUST_UNDERSTAND", BUNDLE, unknowns), message.getVersion().getMustUnderstand()); - } else { - message.remove(MustUnderstandInterceptor.UNKNOWNS); } } }
