Author: dkulp
Date: Tue Feb 19 20:27:14 2013
New Revision: 1447900
URL: http://svn.apache.org/r1447900
Log:
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.7.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/MustUnderstandInterceptor.java
Modified:
cxf/branches/2.7.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.7.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/MustUnderstandInterceptor.java?rev=1447900&r1=1447899&r2=1447900&view=diff
==============================================================================
---
cxf/branches/2.7.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/MustUnderstandInterceptor.java
(original)
+++
cxf/branches/2.7.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/MustUnderstandInterceptor.java
Tue Feb 19 20:27:14 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);
}
}
}