You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ga...@apache.org on 2007/05/01 20:22:40 UTC
svn commit: r534182 - in
/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap:
HeaderUtil.java interceptor/MustUnderstandInterceptor.java
Author: gawor
Date: Tue May 1 11:22:39 2007
New Revision: 534182
URL: http://svn.apache.org/viewvc?view=rev&rev=534182
Log:
Make MustUnderstandInterceptor run on client (and added a bunch of null checks)
Modified:
incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/HeaderUtil.java
incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/MustUnderstandInterceptor.java
Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/HeaderUtil.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/HeaderUtil.java?view=diff&rev=534182&r1=534181&r2=534182
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/HeaderUtil.java (original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/HeaderUtil.java Tue May 1 11:22:39 2007
@@ -42,9 +42,19 @@
private static Set<QName> getHeaderParts(BindingMessageInfo bmi) {
Object obj = bmi.getProperty(HEADERS_PROPERTY);
if (obj == null) {
- Set<QName> set = new HashSet<QName>();
- List<MessagePartInfo> mps = bmi.getMessageInfo().getMessageParts();
- for (ExtensibilityElement ext : bmi.getExtensors(ExtensibilityElement.class)) {
+ Set<QName> set = getHeaderQNames(bmi);
+ bmi.setProperty(HEADERS_PROPERTY, set);
+ return set;
+ }
+ return CastUtils.cast((Set<?>)obj);
+ }
+
+ private static Set<QName> getHeaderQNames(BindingMessageInfo bmi) {
+ Set<QName> set = new HashSet<QName>();
+ List<MessagePartInfo> mps = bmi.getMessageInfo().getMessageParts();
+ List<ExtensibilityElement> extList = bmi.getExtensors(ExtensibilityElement.class);
+ if (extList != null) {
+ for (ExtensibilityElement ext : extList) {
if (SOAPBindingUtil.isSOAPHeader(ext)) {
SoapHeader header = SOAPBindingUtil.getSoapHeader(ext);
String pn = header.getPart();
@@ -60,10 +70,8 @@
}
}
}
- bmi.setProperty(HEADERS_PROPERTY, set);
- return set;
}
- return CastUtils.cast((Set<?>)obj);
+ return set;
}
public static Set<QName> getHeaderQNameInOperationParam(SoapMessage soapMessage) {
@@ -71,8 +79,12 @@
BindingOperationInfo bop = soapMessage.getExchange()
.get(BindingOperationInfo.class);
if (bop != null) {
- headers.addAll(getHeaderParts(bop.getInput()));
- headers.addAll(getHeaderParts(bop.getOutput()));
+ if (bop.getInput() != null) {
+ headers.addAll(getHeaderParts(bop.getInput()));
+ }
+ if (bop.getOutput() != null) {
+ headers.addAll(getHeaderParts(bop.getOutput()));
+ }
}
return headers;
}
Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/MustUnderstandInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/MustUnderstandInterceptor.java?view=diff&rev=534182&r1=534181&r2=534182
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/MustUnderstandInterceptor.java (original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/MustUnderstandInterceptor.java Tue May 1 11:22:39 2007
@@ -51,11 +51,7 @@
}
public void handleMessage(SoapMessage soapMessage) {
- SoapVersion soapVersion = soapMessage.getVersion();
- //Client-in message needs not to handle MustUnderstand
- if (isRequestor(soapMessage)) {
- return;
- }
+ SoapVersion soapVersion = soapMessage.getVersion();
Set<Element> mustUnderstandHeaders = new HashSet<Element>();
Set<URI> serviceRoles = new HashSet<URI>();
Set<QName> notUnderstandQNames = new HashSet<QName>();
@@ -80,6 +76,7 @@
Set<URI> serviceRoles) {
Set<QName> paramHeaders = HeaderUtil.getHeaderQNameInOperationParam(soapMessage);
+
if (paramHeaders != null) {
mustUnderstandQNames.addAll(paramHeaders);
}