Author: dkulp
Date: Wed Jan 5 18:15:53 2011
New Revision: 1055566
URL: http://svn.apache.org/viewvc?rev=1055566&view=rev
Log:
Make sure the soap action on SOAP 1.2 is also checked
Modified:
cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapActionInInterceptor.java
cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.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=1055566&r1=1055565&r2=1055566&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
Wed Jan 5 18:15:53 2011
@@ -46,9 +46,14 @@ public class SoapActionInInterceptor ext
addAfter(EndpointSelectionInterceptor.class.getName());
}
- public void handleMessage(SoapMessage message) throws Fault {
+ public static String getSoapAction(Message m) {
+ if (!(m instanceof SoapMessage)) {
+ return null;
+ }
+ SoapMessage message = (SoapMessage)m;
if (message.getVersion() instanceof Soap11) {
- Map<String, List<String>> headers =
CastUtils.cast((Map)message.get(Message.PROTOCOL_HEADERS));
+ Map<String, List<String>> headers
+ = CastUtils.cast((Map)message.get(Message.PROTOCOL_HEADERS));
if (headers != null) {
List<String> sa =
headers.get(SoapBindingConstants.SOAP_ACTION);
if (sa != null && sa.size() > 0) {
@@ -56,14 +61,14 @@ public class SoapActionInInterceptor ext
if (action.startsWith("\"")) {
action = action.substring(1, action.length() - 1);
}
- getAndSetOperation(message, action);
+ return action;
}
}
} else if (message.getVersion() instanceof Soap12) {
String ct = (String) message.get(Message.CONTENT_TYPE);
if (ct == null) {
- return;
+ return null;
}
int start = ct.indexOf("action=");
@@ -79,10 +84,17 @@ public class SoapActionInInterceptor ext
end = ct.length();
}
}
-
- getAndSetOperation(message, ct.substring(start, end));
+ return ct.substring(start, end);
}
}
+ return null;
+ }
+
+ public void handleMessage(SoapMessage message) throws Fault {
+ String action = getSoapAction(message);
+ if (!StringUtils.isEmpty(action)) {
+ getAndSetOperation(message, action);
+ }
}
private void getAndSetOperation(SoapMessage message, String action) {
Modified:
cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java?rev=1055566&r1=1055565&r2=1055566&view=diff
==============================================================================
---
cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java
(original)
+++
cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java
Wed Jan 5 18:15:53 2011
@@ -26,7 +26,6 @@ import java.text.MessageFormat;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -38,6 +37,7 @@ import javax.xml.ws.WebFault;
import org.apache.cxf.Bus;
import org.apache.cxf.binding.soap.SoapBindingConstants;
import org.apache.cxf.binding.soap.SoapFault;
+import org.apache.cxf.binding.soap.interceptor.SoapActionInInterceptor;
import org.apache.cxf.binding.soap.model.SoapOperationInfo;
import org.apache.cxf.common.i18n.BundleUtils;
import org.apache.cxf.common.logging.LogUtils;
@@ -47,7 +47,6 @@ import org.apache.cxf.endpoint.ClientLif
import org.apache.cxf.endpoint.ClientLifeCycleManager;
import org.apache.cxf.endpoint.Endpoint;
import org.apache.cxf.feature.AbstractFeature;
-import org.apache.cxf.helpers.CastUtils;
import org.apache.cxf.helpers.IOUtils;
import org.apache.cxf.interceptor.Fault;
import org.apache.cxf.interceptor.OneWayProcessorInterceptor;
@@ -1154,13 +1153,8 @@ public class MAPAggregator extends Abstr
if (maps != null) {
//WSAB spec, section 4.2 validation (SOAPAction must match action
- Map<String, List<String>> headers
- = CastUtils.cast((Map<?,
?>)message.get(Message.PROTOCOL_HEADERS));
- List<String> s = headers == null ? null :
headers.get(Names.SOAP_ACTION_HEADER);
+ String sa = SoapActionInInterceptor.getSoapAction(message);
String s1 = this.getActionUri(message, false);
- if (s == null && headers != null) {
- s = headers.get(Names.SOAP_ACTION_HEADER.toLowerCase());
- }
if (maps.getAction() == null || maps.getAction().getValue() ==
null) {
String reason =
@@ -1172,9 +1166,8 @@ public class MAPAggregator extends Abstr
valid = false;
}
- if (s != null && s.size() > 0 && valid
+ if (!StringUtils.isEmpty(sa) && valid
&&
!MessageUtils.isTrue(message.get(MAPAggregator.ACTION_VERIFIED))) {
- String sa = s.get(0);
if (sa.startsWith("\"")) {
sa = sa.substring(1, sa.lastIndexOf('"'));
}