You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2010/05/29 13:38:35 UTC

svn commit: r949381 - in /cxf/trunk: api/src/main/java/org/apache/cxf/service/model/ common/common/src/main/java/org/apache/cxf/staxutils/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ rt/w...

Author: dkulp
Date: Sat May 29 11:38:35 2010
New Revision: 949381

URL: http://svn.apache.org/viewvc?rev=949381&view=rev
Log:
[CXF-2832] Validate the incoming Action
Make sure the unwrapped operation and messages propogate teh extensors
to the unwrapped version

Modified:
    cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractPropertiesHolder.java
    cxf/trunk/api/src/main/java/org/apache/cxf/service/model/OperationInfo.java
    cxf/trunk/api/src/main/java/org/apache/cxf/service/model/UnwrappedOperationInfo.java
    cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java
    cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java
    cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java
    cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java
    cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_fromjava/WSAFromJavaTest.java
    cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/WSAPureWsdlTest.java
    cxf/trunk/systests/ws-specs/src/test/resources/wsdl_systest_wsspec/add_numbers.wsdl

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractPropertiesHolder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractPropertiesHolder.java?rev=949381&r1=949380&r2=949381&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractPropertiesHolder.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractPropertiesHolder.java Sat May 29 11:38:35 2010
@@ -29,28 +29,75 @@ import java.util.concurrent.atomic.Atomi
 import javax.xml.namespace.QName;
 
 public abstract class AbstractPropertiesHolder implements Extensible {
+    private AbstractPropertiesHolder delegate;
+    private boolean delegateProperties;
+    
     private AtomicReference<Map<String, Object>> propertyMap = new AtomicReference<Map<String, Object>>();
     private AtomicReference<Object[]> extensors = new AtomicReference<Object[]>();
     private Map<QName, Object> extensionAttributes;
     private String documentation;
     
     
+    public final void setDelegate(AbstractPropertiesHolder p, boolean props) {
+        delegate = p;
+        delegateProperties = props;
+        if (delegate == null) {
+            return;
+        }
+        if (documentation != null) {
+            delegate.setDocumentation(documentation);
+            documentation = null;
+        }
+        if (extensionAttributes != null) {
+            delegate.setExtensionAttributes(extensionAttributes);
+            extensionAttributes = null;
+        }
+        if (extensors.get() != null) {
+            for (Object el : extensors.get()) {
+                delegate.addExtensor(el);
+            }
+            extensors.set(null);
+        }
+        if (delegateProperties && propertyMap.get() != null) {
+            for (Map.Entry<String, Object> p2 : propertyMap.get().entrySet()) {
+                delegate.setProperty(p2.getKey(), p2.getValue());
+            }
+            propertyMap.set(null);
+        }
+    }
+    
     public String getDocumentation() {
+        if (delegate != null) {
+            return delegate.getDocumentation();
+        }
         return documentation;
     }
     public void setDocumentation(String s) {
-        documentation = s;
+        if (delegate != null) {
+            delegate.setDocumentation(s);
+        } else {
+            documentation = s;
+        }
     }
     public Map<String, Object> getProperties() {
+        if (delegate != null && delegateProperties) {
+            return delegate.getProperties();
+        }
         return propertyMap.get();
     }
     public Object getProperty(String name) {
+        if (delegate != null && delegateProperties) {
+            return delegate.getProperty(name);
+        }
         if (null == propertyMap.get()) {
             return null;
         }
         return propertyMap.get().get(name);
     }
     public Object removeProperty(String name) {
+        if (delegate != null && delegateProperties) {
+            delegate.removeProperty(name);
+        }
         if (null == propertyMap.get()) {
             return null;
         }
@@ -61,6 +108,9 @@ public abstract class AbstractProperties
         return cls.cast(getProperty(name));
     }
     public boolean hasProperty(String name) {
+        if (delegate != null && delegateProperties) {
+            return delegate.hasProperty(name);
+        }
         Map<String, Object> map = propertyMap.get();
         if (map != null) {
             return map.containsKey(name);
@@ -69,6 +119,10 @@ public abstract class AbstractProperties
     }
     
     public void setProperty(String name, Object v) {
+        if (delegate != null && delegateProperties) {
+            delegate.setProperty(name, v);
+            return;
+        }
         if (null == propertyMap.get()) {
             propertyMap.compareAndSet(null, new ConcurrentHashMap<String, Object>(4));
         }
@@ -80,6 +134,10 @@ public abstract class AbstractProperties
     }
     
     public boolean containsExtensor(Object el) {
+        if (delegate != null) {
+            return delegate.containsExtensor(el);
+        }
+
         Object exts[] = extensors.get();
         if (exts != null) {
             for (Object o : exts) {
@@ -91,6 +149,10 @@ public abstract class AbstractProperties
         return false;
     }
     public void addExtensor(Object el) {
+        if (delegate != null) {
+            delegate.addExtensor(el);
+            return;
+        }
         Object exts[] = extensors.get();
         Object exts2[];
         if (exts == null) {
@@ -109,6 +171,9 @@ public abstract class AbstractProperties
     }
 
     public <T> T getExtensor(Class<T> cls) {
+        if (delegate != null) {
+            return delegate.getExtensor(cls);
+        }
         Object exts[] = extensors.get();
         if (exts == null) {
             return null;
@@ -121,6 +186,10 @@ public abstract class AbstractProperties
         return null;
     }
     public <T> List<T> getExtensors(Class<T> cls) {
+        if (delegate != null) {
+            return delegate.getExtensors(cls);
+        }
+   
         Object exts[] = extensors.get();
         if (exts == null) {
             return null;
@@ -135,19 +204,32 @@ public abstract class AbstractProperties
     }
 
     public AtomicReference<Object[]> getExtensors() {
+        if (delegate != null) {
+            return delegate.getExtensors();
+        }
         return extensors;
     }
     
       
     public Object getExtensionAttribute(QName name) {        
+        if (delegate != null) {
+            return delegate.getExtensionAttribute(name);
+        }
         return null == extensionAttributes ? null : extensionAttributes.get(name);
     }
 
     public Map<QName, Object> getExtensionAttributes() {
+        if (delegate != null) {
+            return delegate.getExtensionAttributes();
+        }
         return extensionAttributes;
     }
     
     public void addExtensionAttribute(QName name, Object attr) {
+        if (delegate != null) {
+            delegate.addExtensionAttribute(name, attr);
+            return;
+        }
         if (null == extensionAttributes) {
             extensionAttributes = new HashMap<QName, Object>();
         }
@@ -155,6 +237,10 @@ public abstract class AbstractProperties
     }
    
     public void setExtensionAttributes(Map<QName, Object> attrs) {
+        if (delegate != null) {
+            delegate.setExtensionAttributes(attrs);
+            return;
+        }
         extensionAttributes = attrs;        
     }
 
@@ -168,6 +254,9 @@ public abstract class AbstractProperties
      * @return the configuration value or the default
      */
     public <T> T getTraversedExtensor(T defaultValue, Class<T> type) {
+        if (delegate != null) {
+            return delegate.getTraversedExtensor(defaultValue, type);
+        }
         T extensor = getExtensor(type);
         if (extensor == null) {
             return defaultValue;

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/service/model/OperationInfo.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/OperationInfo.java?rev=949381&r1=949380&r2=949381&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/service/model/OperationInfo.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/service/model/OperationInfo.java Sat May 29 11:38:35 2010
@@ -90,6 +90,9 @@ public class OperationInfo extends Abstr
     public void setOutput(String nm, MessageInfo out) {
         outName = nm;
         outputMessage = out;
+        if (unwrappedOperation != null && unwrappedOperation.getOutput() != null) {
+            unwrappedOperation.getOutput().setDelegate(out, false);
+        }
     }    
     public boolean hasOutput() {
         return outputMessage != null;
@@ -104,6 +107,9 @@ public class OperationInfo extends Abstr
     public void setInput(String nm, MessageInfo in) {
         inName = nm;
         inputMessage = in;
+        if (unwrappedOperation != null && unwrappedOperation.getInput() != null) {
+            unwrappedOperation.getInput().setDelegate(in, false);
+        }
     }
     public boolean hasInput() {
         return inputMessage != null;

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/service/model/UnwrappedOperationInfo.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/UnwrappedOperationInfo.java?rev=949381&r1=949380&r2=949381&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/service/model/UnwrappedOperationInfo.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/service/model/UnwrappedOperationInfo.java Sat May 29 11:38:35 2010
@@ -20,7 +20,6 @@
 package org.apache.cxf.service.model;
 
 import java.util.Collection;
-import java.util.List;
 
 import javax.xml.namespace.QName;
 
@@ -30,6 +29,7 @@ public class UnwrappedOperationInfo exte
     public UnwrappedOperationInfo(OperationInfo op) {
         super(op);
         wrappedOp = op;
+        setDelegate(wrappedOp, true);
     }
     
     public OperationInfo getWrappedOperation() {
@@ -52,27 +52,15 @@ public class UnwrappedOperationInfo exte
         return wrappedOp.getFaults();
     }
     
-    public Object getProperty(String name) {
-        return wrappedOp.getProperty(name);
-    }
-    
-    public <T> T getProperty(String name, Class<T> cls) {
-        return wrappedOp.getProperty(name, cls);
-    }
-    
-    public void setProperty(String name, Object v) {
-        wrappedOp.setProperty(name, v);
-    }
     
-    public void addExtensor(Object el) {
-        wrappedOp.addExtensor(el);
-    }
-
-    public <T> T getExtensor(Class<T> cls) {
-        return wrappedOp.getExtensor(cls);
-    }
-    public <T> List<T> getExtensors(Class<T> cls) {
-        return wrappedOp.getExtensors(cls);
+    public void setOutput(String nm, MessageInfo out) {
+        super.setOutput(nm, out);
+        out.setDelegate(wrappedOp.getOutput(), false);
+    }    
+
+    public void setInput(String nm, MessageInfo in) {
+        super.setInput(nm, in);
+        in.setDelegate(wrappedOp.getInput(), false);
     }
 
 }

Modified: cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java?rev=949381&r1=949380&r2=949381&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java (original)
+++ cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java Sat May 29 11:38:35 2010
@@ -1115,6 +1115,8 @@ public final class StaxUtils {
                 } catch (Exception ex) {
                     //ignore
                 }
+            } else if (source instanceof StaxSource) {
+                return ((StaxSource)source).getXMLStreamReader();
             } else if (source instanceof SAXSource) {
                 return createXMLStreamReader(((SAXSource)source).getInputSource());
             }

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java?rev=949381&r1=949380&r2=949381&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java (original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java Sat May 29 11:38:35 2010
@@ -46,6 +46,7 @@ import org.apache.cxf.resource.ResourceR
 import org.apache.cxf.service.invoker.Invoker;
 import org.apache.cxf.service.invoker.SingletonFactory;
 import org.apache.cxf.service.model.BindingInfo;
+import org.apache.cxf.service.model.BindingOperationInfo;
 
 /**
  * Bean to help easily create Server endpoints for JAX-WS. Example:
@@ -162,6 +163,13 @@ public class JaxWsServerFactoryBean exte
 
         if (implInfo.isWebServiceProvider()) {
             bindingInfo.getService().setProperty("soap.force.doclit.bare", Boolean.TRUE);
+            if (this.getServiceFactory().isPopulateFromClass()) {
+                //Provider, but no wsdl.  Synthetic ops
+                for (BindingOperationInfo op : bindingInfo.getOperations()) {
+                    op.setProperty("operation.is.synthetic", Boolean.TRUE);
+                    op.getOperationInfo().setProperty("operation.is.synthetic", Boolean.TRUE);
+                }
+            }
         }
 
         return bindingInfo;

Modified: cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java?rev=949381&r1=949380&r2=949381&view=diff
==============================================================================
--- cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java (original)
+++ cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java Sat May 29 11:38:35 2010
@@ -80,12 +80,12 @@ import static org.apache.cxf.ws.addressi
 public final class ContextUtils {
 
     public static final ObjectFactory WSA_OBJECT_FACTORY = new ObjectFactory();
+    public static final String ACTION = ContextUtils.class.getName() + ".ACTION";
 
     private static final EndpointReferenceType NONE_ENDPOINT_REFERENCE = 
         EndpointReferenceUtils.getEndpointReference(Names.WSA_NONE_ADDRESS);
     
     private static final Logger LOG = LogUtils.getL7dLogger(ContextUtils.class);
-    private static final String ACTION = ContextUtils.class.getName() + ".ACTION";
     
     /**
      * Used to fabricate a Uniform Resource Name from a UUID string
@@ -776,7 +776,10 @@ public final class ContextUtils {
                 bindingOpInfo = bindingOpInfo.getUnwrappedOperation();
             }
             if (fault == null) {
-                action = (String) message.get(SoapBindingConstants.SOAP_ACTION);
+                action = (String)message.get(ACTION);
+                if (StringUtils.isEmpty(action)) {
+                    action = (String) message.get(SoapBindingConstants.SOAP_ACTION);
+                }
                 if (action == null || "".equals(action)) {
                     MessageInfo msgInfo = 
                         ContextUtils.isRequestor(message)
@@ -828,7 +831,7 @@ public final class ContextUtils {
         return action;
     }
 
-    private static SoapOperationInfo getSoapOperationInfo(BindingOperationInfo bindingOpInfo) {
+    public static SoapOperationInfo getSoapOperationInfo(BindingOperationInfo bindingOpInfo) {
         SoapOperationInfo soi = bindingOpInfo.getExtensor(SoapOperationInfo.class);
         if (soi == null && bindingOpInfo.isUnwrapped()) {
             soi = bindingOpInfo.getWrappedOperation()

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=949381&r1=949380&r2=949381&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 Sat May 29 11:38:35 2010
@@ -39,6 +39,8 @@ 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.model.SoapOperationInfo;
+import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.endpoint.Client;
@@ -539,7 +541,7 @@ public class MAPAggregator extends Abstr
 
             if (ContextUtils.hasEmptyAction(maps)
                 && ContextUtils.isOutbound(message)) {
-                maps.setAction(ContextUtils.getAttributedURI(getActionUri(message)));
+                maps.setAction(ContextUtils.getAttributedURI(getActionUri(message, true)));
             }
         }
 
@@ -619,9 +621,9 @@ public class MAPAggregator extends Abstr
         return cause.getClass().getSimpleName();    
     }
 
-    protected String getActionUri(Message message) {
+    protected String getActionUri(Message message, boolean checkMessage) {
         BindingOperationInfo bop = message.getExchange().get(BindingOperationInfo.class);
-        if (bop == null) {
+        if (bop == null || Boolean.TRUE.equals(bop.getProperty("operation.is.synthetic"))) {
             return null;
         }
         OperationInfo op = bop.getOperationInfo();
@@ -629,24 +631,38 @@ public class MAPAggregator extends Abstr
             op = ((UnwrappedOperationInfo)op).getWrappedOperation();
         }
         
-        String actionUri = (String) message.get(SoapBindingConstants.SOAP_ACTION);
+        String actionUri = null;
+        if (checkMessage) {
+            actionUri = (String) message.get(ContextUtils.ACTION);
+            if (actionUri == null) {
+                actionUri = (String) message.get(SoapBindingConstants.SOAP_ACTION);
+            }
+        }
         if (actionUri != null) {
             return actionUri;
         }
         String opNamespace = getActionBaseUri(op);
         
-        if (ContextUtils.isRequestor(message)) {
+        boolean inbound = !ContextUtils.isOutbound(message);
+        boolean requestor = ContextUtils.isRequestor(message);
+        boolean inMsg = requestor ^ inbound;
+        if (ContextUtils.isFault(message)) {
+            String faultName = getFaultNameFromMessage(message);
+            actionUri = getActionFromFaultMessage(op, faultName);
+        } else if (inMsg) {
             String explicitAction = getActionFromInputMessage(op);
-            if (explicitAction != null) {
+            if (StringUtils.isEmpty(explicitAction)) {
+                SoapOperationInfo soi = ContextUtils.getSoapOperationInfo(bop);
+                explicitAction = soi == null ? null : soi.getAction();
+            }            
+            
+            if (!StringUtils.isEmpty(explicitAction)) {
                 actionUri = explicitAction;
             } else if (null == op.getInputName()) {
                 actionUri = addPath(opNamespace, op.getName().getLocalPart() + "Request");
             } else {
                 actionUri = addPath(opNamespace, op.getInputName());
             }
-        } else if (ContextUtils.isFault(message)) {
-            String faultName = getFaultNameFromMessage(message);
-            actionUri = getActionFromFaultMessage(op, faultName);
         } else {
             String explicitAction = getActionFromOutputMessage(op);
             if (explicitAction != null) {
@@ -948,16 +964,27 @@ public class MAPAggregator extends Abstr
             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 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 =
+                    BUNDLE.getString("MISSING_ACTION_MESSAGE");
+
+                ContextUtils.storeMAPFaultName(Names.HEADER_REQUIRED_NAME,
+                                               message);
+                ContextUtils.storeMAPFaultReason(reason, message);
+                return false;
+            }
             if (s != null && s.size() > 0) {
                 String sa = s.get(0);
                 if (sa.startsWith("\"")) {
                     sa = sa.substring(1, sa.lastIndexOf('"'));
                 }
+                String action = maps.getAction() == null ? "" : maps.getAction().getValue();
                 if (!StringUtils.isEmpty(sa)
-                    && !sa.equals(maps.getAction().getValue())) {
+                    && !sa.equals(action)) {
                     //don't match, must send fault back....
                     String reason =
                         BUNDLE.getString("INVALID_SOAPACTION_MESSAGE");
@@ -966,19 +993,27 @@ public class MAPAggregator extends Abstr
                                                    message);
                     ContextUtils.storeMAPFaultReason(reason, message);
                     return false;
+                } else if (!StringUtils.isEmpty(s1)
+                    && !action.equals(s1)
+                    && !action.equals(s1 + "Request")
+                    && !s1.equals(action + "Request")) {
+                    //if java first, it's likely to have "Request", if wsdl first,
+                    //it will depend if the wsdl:input has a name or not. Thus, we'll
+                    //check both plain and with the "Request" trailer
+                    
+                    //doesn't match what's in the wsdl/annotations
+                    String reason =
+                        BundleUtils.getFormattedString(BUNDLE,
+                                "ACTION_NOT_SUPPORTED_MSG", action);
+                    
+                    ContextUtils.storeMAPFaultName(Names.ACTION_NOT_SUPPORTED_NAME,
+                                                   message);
+                    ContextUtils.storeMAPFaultReason(reason, message);
+                    return false;
                 }
-            }
-            
-            if (maps.getAction() == null || maps.getAction().getValue() == null) {
-                String reason =
-                    BUNDLE.getString("MISSING_ACTION_MESSAGE");
-
-                ContextUtils.storeMAPFaultName(Names.HEADER_REQUIRED_NAME,
-                                               message);
-                ContextUtils.storeMAPFaultReason(reason, message);
-                return false;
                 
             }
+            
         
             if (!allowDuplicates) {
                 AttributedURIType messageID = maps.getMessageID();

Modified: cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java?rev=949381&r1=949380&r2=949381&view=diff
==============================================================================
--- cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java (original)
+++ cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java Sat May 29 11:38:35 2010
@@ -52,6 +52,7 @@ import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.interceptor.Interceptor;
 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.ws.addressing.AddressingProperties;
 import org.apache.cxf.ws.addressing.AddressingPropertiesImpl;
@@ -155,13 +156,15 @@ public class MAPCodec extends AbstractSo
      * @param message the messsage message
      */     
     private void mediate(SoapMessage message) {
-        if (ContextUtils.isOutbound(message)) {
-            encode(message, ContextUtils.retrieveMAPs(message, false, true));
-        } else if (null == ContextUtils.retrieveMAPs(message, false, false, false)) {            
-            AddressingProperties maps = decode(message);
-            ContextUtils.storeMAPs(maps, message, false);
-            markPartialResponse(message, maps);
-            restoreExchange(message, maps);     
+        if (!MessageUtils.getContextualBoolean(message, MAPAggregator.ADDRESSING_DISABLED, false)) {
+            if (ContextUtils.isOutbound(message)) {
+                encode(message, ContextUtils.retrieveMAPs(message, false, true));
+            } else if (null == ContextUtils.retrieveMAPs(message, false, false, false)) {            
+                AddressingProperties maps = decode(message);
+                ContextUtils.storeMAPs(maps, message, false);
+                markPartialResponse(message, maps);
+                restoreExchange(message, maps);     
+            }
         }
     }
 

Modified: cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_fromjava/WSAFromJavaTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_fromjava/WSAFromJavaTest.java?rev=949381&r1=949380&r2=949381&view=diff
==============================================================================
--- cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_fromjava/WSAFromJavaTest.java (original)
+++ cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_fromjava/WSAFromJavaTest.java Sat May 29 11:38:35 2010
@@ -23,6 +23,7 @@ import java.io.ByteArrayOutputStream;
 import java.net.URL;
 import java.util.Map;
 import javax.xml.ws.BindingProvider;
+import javax.xml.ws.soap.SOAPFaultException;
 
 import org.apache.cxf.systest.ws.AbstractWSATestBase;
 import org.apache.cxf.systest.ws.addr_fromjava.client.AddNumberImpl;
@@ -124,7 +125,6 @@ public class WSAFromJavaTest extends Abs
 
     @Test
     public void testAddNumbersJaxWsContext() throws Exception {
-        ByteArrayOutputStream input = setupInLogging();
         ByteArrayOutputStream output = setupOutLogging();
 
         AddNumberImpl port = getPort();
@@ -133,14 +133,15 @@ public class WSAFromJavaTest extends Abs
         java.util.Map<String, Object> requestContext = bp.getRequestContext();
         requestContext.put(BindingProvider.SOAPACTION_URI_PROPERTY, "cxf");
 
-        assertEquals(3, port.addNumbers(1, 2));
-
+        try {
+            assertEquals(3, port.addNumbers(1, 2));
+            fail("Should have thrown an ActionNotSupported exception");
+        } catch (SOAPFaultException ex) {
+            //expected
+        }
         String expectedOut = "cxf</Action>";
         assertTrue(output.toString().indexOf(expectedOut) != -1);
         assertTrue(output.toString().indexOf("SOAPAction=[\"cxf\"]") != -1);
-        
-        String expectedIn = "http://cxf.apache.org/output";
-        assertTrue(input.toString().indexOf(expectedIn) != -1);
     }
 
     private AddNumberImpl getPort() {

Modified: cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/WSAPureWsdlTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/WSAPureWsdlTest.java?rev=949381&r1=949380&r2=949381&view=diff
==============================================================================
--- cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/WSAPureWsdlTest.java (original)
+++ cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/WSAPureWsdlTest.java Sat May 29 11:38:35 2010
@@ -33,6 +33,7 @@ import javax.xml.ws.Dispatch;
 import javax.xml.ws.Response;
 import javax.xml.ws.Service.Mode;
 import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.soap.SOAPFaultException;
 
 import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.frontend.ClientProxy;
@@ -42,6 +43,7 @@ import org.apache.cxf.systest.ws.Abstrac
 import org.apache.cxf.systest.ws.addr_feature.AddNumbersPortType;
 import org.apache.cxf.systest.ws.addr_feature.AddNumbersResponse;
 import org.apache.cxf.systest.ws.addr_feature.AddNumbersService;
+import org.apache.cxf.ws.addressing.ContextUtils;
 import org.apache.cxf.ws.addressing.soap.MAPCodec;
 
 import org.junit.Before;
@@ -184,6 +186,39 @@ public class WSAPureWsdlTest extends Abs
 
         
     }
+    
+    @Test
+    public void testDispatchActionMissmatch() throws Exception {
+        String req = "<S:Envelope xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\">"
+                    + "<S:Body><addNumbers3 xmlns=\"http://apache.org/cxf/systest/ws/addr_feature/\">"
+                    + "<number1>1</number1><number2>2</number2></addNumbers3>"
+                    + "</S:Body></S:Envelope>";
+        //String base = "http://apache.org/cxf/systest/ws/addr_feature/AddNumbersPortType/";
+        String expectedOut = "http://bad.action";
+        
+        URL wsdl = getClass().getResource("/wsdl_systest_wsspec/add_numbers.wsdl");
+        assertNotNull("WSDL is null", wsdl);
+        AddNumbersService service = new AddNumbersService(wsdl, serviceName);
+
+
+        Dispatch<Source> disp = service.createDispatch(AddNumbersService.AddNumbersPort,
+                                                       Source.class, Mode.MESSAGE);
+
+        disp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, 
+                                     "http://localhost:9094/jaxws/add");
+
+        //manually set the action
+        disp.getRequestContext().put(BindingProvider.SOAPACTION_URI_PROPERTY,
+                                     expectedOut);
+        disp.getRequestContext().put(ContextUtils.ACTION,
+                                     expectedOut + "/wsaAction");
+        try {
+            disp.invoke(new StreamSource(new StringReader(req)));
+            fail("no exception");
+        } catch (SOAPFaultException f) {
+            //expected
+        }
+    }
 
     private AddNumbersPortType getPort() {
         URL wsdl = getClass().getResource("/wsdl_systest_wsspec/add_numbers.wsdl");

Modified: cxf/trunk/systests/ws-specs/src/test/resources/wsdl_systest_wsspec/add_numbers.wsdl
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-specs/src/test/resources/wsdl_systest_wsspec/add_numbers.wsdl?rev=949381&r1=949380&r2=949381&view=diff
==============================================================================
--- cxf/trunk/systests/ws-specs/src/test/resources/wsdl_systest_wsspec/add_numbers.wsdl (original)
+++ cxf/trunk/systests/ws-specs/src/test/resources/wsdl_systest_wsspec/add_numbers.wsdl Sat May 29 11:38:35 2010
@@ -122,7 +122,7 @@
 			<!-- 	    </fault> -->
 		</operation>
 		<operation name="addNumbers3">
-			<soap:operation soapAction="" />
+			<soap:operation soapAction="3in" />
 			<input>
 				<soap:body use="literal" />
 			</input>