Index: apache-cxf-2.2.12-patch-04/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Messages.properties
===================================================================
diff -u -N -r13684 -r17026
--- apache-cxf-2.2.12-patch-04/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Messages.properties	(.../Messages.properties)	(revision 13684)
+++ apache-cxf-2.2.12-patch-04/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Messages.properties	(.../Messages.properties)	(revision 17026)
@@ -29,4 +29,5 @@
 INVALID_11_VERSION=A SOAP 1.2 message is not valid when sent to a SOAP 1.1 only endpoint.
 NO_NAMESPACE=No namespace on "{0}" element.
 BP_2211_RPCLIT_CANNOT_BE_NULL=Cannot write part {0}. RPC/Literal parts cannot be null. (WS-I BP R2211)
-UNKNOWN_RPC_LIT_PART=Found element {0} but could not find matching RPC/Literal part
\ No newline at end of file
+UNKNOWN_RPC_LIT_PART=Found element {0} but could not find matching RPC/Literal part
+SOAP_ACTION_MISMATCH=The given SOAPAction {0} does not match an operation.
Index: apache-cxf-2.2.12-patch-04/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapActionInInterceptor.java
===================================================================
diff -u -N -r13684 -r17026
--- apache-cxf-2.2.12-patch-04/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapActionInInterceptor.java	(.../SoapActionInInterceptor.java)	(revision 13684)
+++ apache-cxf-2.2.12-patch-04/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapActionInInterceptor.java	(.../SoapActionInInterceptor.java)	(revision 17026)
@@ -22,12 +22,14 @@
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
+import java.util.logging.Logger;
 
 import org.apache.cxf.binding.soap.Soap11;
 import org.apache.cxf.binding.soap.Soap12;
 import org.apache.cxf.binding.soap.SoapBindingConstants;
 import org.apache.cxf.binding.soap.SoapMessage;
 import org.apache.cxf.binding.soap.model.SoapOperationInfo;
+import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.helpers.CastUtils;
@@ -37,33 +39,41 @@
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.service.model.OperationInfo;
+import org.apache.cxf.ws.addressing.JAXWSAConstants;
 
 public class SoapActionInInterceptor extends AbstractSoapInterceptor {
     
+    private static final Logger LOG = LogUtils.getL7dLogger(SoapActionInInterceptor.class);
+    
     public SoapActionInInterceptor() {
         super(Phase.READ);
         addAfter(ReadHeadersInterceptor.class.getName());
         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) {
                     String action = sa.get(0);
                     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,41 +89,109 @@
                         end = ct.length();
                     }
                 }
-                
-                getAndSetOperation(message, ct.substring(start, end));
+                return ct.substring(start, end);
             }
         }
+        return null;
     }
+    
+    public void handleMessage(SoapMessage message) throws Fault {
+        if (isRequestor(message)) {
+            return;
+        }
+        
+        String action = getSoapAction(message);
+        if (!StringUtils.isEmpty(action)) {
+            getAndSetOperation(message, action);
+            message.put(SoapBindingConstants.SOAP_ACTION, action);
+        }
+    }
 
-    private void getAndSetOperation(SoapMessage message, String action) {
+    public static void getAndSetOperation(SoapMessage message, String action) {
         if (StringUtils.isEmpty(action)) {
             return;
         }
-        message.put(SoapBindingConstants.SOAP_ACTION, action);
         
         Exchange ex = message.getExchange();
         Endpoint ep = ex.get(Endpoint.class);
+        if (ep == null) {
+            return;
+        }
         
         BindingOperationInfo bindingOp = null;
         
-        Collection<BindingOperationInfo> bops = ep.getBinding().getBindingInfo().getOperations();
-        if (bops == null) {
-            return;
-        }
-        for (BindingOperationInfo boi : bops) {
-            SoapOperationInfo soi = (SoapOperationInfo) boi.getExtensor(SoapOperationInfo.class);
-            if (soi != null && action.equals(soi.getAction())) {
-                if (bindingOp != null) {
-                    //more than one op with the same action, will need to parse normally
-                    return;
+        Collection<BindingOperationInfo> bops = ep.getEndpointInfo()
+            .getBinding().getOperations();
+        if (bops != null) {
+            for (BindingOperationInfo boi : bops) {
+                SoapOperationInfo soi = boi.getExtensor(SoapOperationInfo.class);
+                if (soi != null && action.equals(soi.getAction())) {
+                    if (bindingOp != null) {
+                        //more than one op with the same action, will need to parse normally
+                        return;
+                    }
+                    bindingOp = boi;
                 }
-                bindingOp = boi;
+                Object o = boi.getOperationInfo().getInput()
+                    .getExtensionAttribute(JAXWSAConstants.WSAM_ACTION_QNAME);
+                if (o == null) {
+                    o = boi.getOperationInfo().getInput()
+                        .getExtensionAttribute(JAXWSAConstants.WSAW_ACTION_QNAME);
+                }
+                if (o != null && action.equals(o.toString())) {
+                    if (bindingOp != null && bindingOp != boi) {
+                        //more than one op with the same action, will need to parse normally
+                        return;
+                    }
+                    bindingOp = boi;
+                }
             }
         }
-        if (bindingOp != null) {
-            ex.put(BindingOperationInfo.class, bindingOp);
-            ex.put(OperationInfo.class, bindingOp.getOperationInfo());
+        
+        if (bindingOp == null) {
+            //we didn't match the an operation, we'll try again later to make
+            //sure the incoming message did end up matching an operation.
+            //This could occur in some cases like WS-RM and WS-SecConv that will
+            //intercept the message with a new endpoint/operation
+            message.getInterceptorChain().add(new SoapActionInAttemptTwoInterceptor());
+            return;
         }
+
+        ex.put(BindingOperationInfo.class, bindingOp);
+        ex.put(OperationInfo.class, bindingOp.getOperationInfo());
     }
+    
+    public static class SoapActionInAttemptTwoInterceptor extends AbstractSoapInterceptor {
+        public SoapActionInAttemptTwoInterceptor() {
+            super(Phase.PRE_LOGICAL);
+        }
+        public void handleMessage(SoapMessage message) throws Fault {
+            BindingOperationInfo boi = message.getExchange().getBindingOperationInfo();
+            if (boi == null) {
+                return;
+            }
+            String action = getSoapAction(message);
+            if (StringUtils.isEmpty(action)) {
+                return;
+            }
+            SoapOperationInfo soi = boi.getExtensor(SoapOperationInfo.class);
+            if (soi == null || action.equals(soi.getAction())) {
+                return;
+            }
+            
+            Object o = boi.getOperationInfo().getInput()
+                .getExtensionAttribute(JAXWSAConstants.WSAM_ACTION_QNAME);
+            if (o == null) {
+                o = boi.getOperationInfo().getInput()
+                    .getExtensionAttribute(JAXWSAConstants.WSAW_ACTION_QNAME);
+            }
+            if (o != null && action.equals(o.toString())) {
+                return;
+            }
 
+            throw new Fault("SOAP_ACTION_MISMATCH", LOG, null, action);
+        }
+    }
+
+
 }
Index: apache-cxf-2.2.12-patch-04/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLBindingFactory.java
===================================================================
diff -u -N -r13684 -r17026
--- apache-cxf-2.2.12-patch-04/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLBindingFactory.java	(.../XMLBindingFactory.java)	(revision 13684)
+++ apache-cxf-2.2.12-patch-04/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLBindingFactory.java	(.../XMLBindingFactory.java)	(revision 17026)
@@ -35,6 +35,8 @@
 import org.apache.cxf.interceptor.WrappedOutInterceptor;
 import org.apache.cxf.service.model.BindingInfo;
 import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.MessageInfo;
+import org.apache.cxf.service.model.MessagePartInfo;
 import org.apache.cxf.service.model.OperationInfo;
 import org.apache.cxf.service.model.ServiceInfo;
 
@@ -66,7 +68,9 @@
         info.setName(new QName(service.getName().getNamespaceURI(), 
                                service.getName().getLocalPart() + "XMLBinding"));
 
-        for (OperationInfo op : service.getInterface().getOperations()) {                       
+        for (OperationInfo op : service.getInterface().getOperations()) {
+            adjustConcreteNames(op.getInput());
+            adjustConcreteNames(op.getOutput());
             BindingOperationInfo bop = 
                 info.buildOperation(op.getName(), op.getInputName(), op.getOutputName());
             info.addOperation(bop);
@@ -75,4 +79,15 @@
         return info;
     }
 
+    private void adjustConcreteNames(MessageInfo mi) {
+        if (mi != null) {
+            for (MessagePartInfo mpi : mi.getMessageParts()) {
+                if (!mpi.isElement()) {
+                    //if it's not an element, we need to make it one
+                    mpi.setConcreteName(mpi.getName());
+                }
+            }
+        }
+    }
+
 }
Index: apache-cxf-2.2.12-patch-04/rt/bindings/xml/src/test/java/org/apache/cxf/binding/xml/interceptor/XMLMessageInInterceptorTest.java
===================================================================
diff -u -N -r13684 -r17026
--- apache-cxf-2.2.12-patch-04/rt/bindings/xml/src/test/java/org/apache/cxf/binding/xml/interceptor/XMLMessageInInterceptorTest.java	(.../XMLMessageInInterceptorTest.java)	(revision 13684)
+++ apache-cxf-2.2.12-patch-04/rt/bindings/xml/src/test/java/org/apache/cxf/binding/xml/interceptor/XMLMessageInInterceptorTest.java	(.../XMLMessageInInterceptorTest.java)	(revision 17026)
@@ -52,17 +52,17 @@
                         MyComplexStructType.class);
         
         OperationInfo op = serviceInfo.getInterface().getOperation(new QName(ns, "testMultiParamPart"));
-        op.getInput().getMessagePartByIndex(0).setTypeClass(MyComplexStructType.class);
-        op.getInput().getMessagePartByIndex(1).setTypeClass(String.class);
+        op.getInput().getMessagePartByIndex(0).setTypeClass(String.class);
+        op.getInput().getMessagePartByIndex(1).setTypeClass(MyComplexStructType.class);
         
         in.handleMessage(xmlMessage);
         docLitIn.handleMessage(xmlMessage);
         List list = xmlMessage.getContent(List.class);
         assertNotNull(list);
         assertEquals("expect 2 param", 2, list.size());
         assertEquals("method input in2 is MyComplexStructType", true,
-                        list.get(0) instanceof MyComplexStructType);
-        assertEquals("method input in1 is String tli", true, ((String) list.get(1)).indexOf("tli") >= 0);
+                list.get(1) instanceof MyComplexStructType);
+        assertEquals("method input in1 is String tli", true, ((String) list.get(0)).indexOf("tli") >= 0);
     }
 
     @Test
Index: apache-cxf-2.2.12-patch-04/rt/bindings/xml/src/test/resources/message-bare-multi-param.xml
===================================================================
diff -u -N -r13684 -r17026
--- apache-cxf-2.2.12-patch-04/rt/bindings/xml/src/test/resources/message-bare-multi-param.xml	(.../message-bare-multi-param.xml)	(revision 13684)
+++ apache-cxf-2.2.12-patch-04/rt/bindings/xml/src/test/resources/message-bare-multi-param.xml	(.../message-bare-multi-param.xml)	(revision 17026)
@@ -18,17 +18,17 @@
 -->
 <multiParamRootReq
 	xmlns="http://apache.org/hello_world_xml_http/bare">
+	<requestType
+		xmlns="http://apache.org/hello_world_xml_http/bare/types"
+		xmlns:ns2="http://www.w3.org/2005/02/addressing/wsdl"
+		xmlns:xs="http://www.w3.org/2001/XMLSchema">
+		tli
+	</requestType>
 	<myComplexStruct
 		xmlns="http://apache.org/hello_world_xml_http/bare/types"
 		xmlns:ns2="http://www.w3.org/2005/02/addressing/wsdl">
 		<elem1>this is element 1</elem1>
 		<elem2>this is element 2</elem2>
 		<elem3>42</elem3>
 	</myComplexStruct>
-	<requestType
-		xmlns="http://apache.org/hello_world_xml_http/bare/types"
-		xmlns:ns2="http://www.w3.org/2005/02/addressing/wsdl"
-		xmlns:xs="http://www.w3.org/2001/XMLSchema">
-		tli
-	</requestType>
 </multiParamRootReq>
Index: apache-cxf-2.2.12-patch-04/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java
===================================================================
diff -u -N -r14876 -r17026
--- apache-cxf-2.2.12-patch-04/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java	(.../DocLiteralInInterceptor.java)	(revision 14876)
+++ apache-cxf-2.2.12-patch-04/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java	(.../DocLiteralInInterceptor.java)	(revision 17026)
@@ -35,6 +35,7 @@
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageContentsList;
+import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.service.model.BindingMessageInfo;
 import org.apache.cxf.service.model.BindingOperationInfo;
@@ -189,15 +190,16 @@
                     } else {
                         p = findMessagePart(exchange, operations, elName, client, paramNum, message);
                     }
-    
-                    if (p == null) {
-                        throw new Fault(new org.apache.cxf.common.i18n.Message("NO_PART_FOUND", LOG, elName),
-                                        Fault.FAULT_CODE_CLIENT);
+                    
+                    boolean dlb = Boolean.TRUE.equals(si.getProperty("soap.force.doclit.bare"));
+                    if (!dlb) {
+                        //Make sure the elName found on the wire is actually OK for 
+                        //the purpose we need it
+                        validatePart(p, elName, message);
                     }
-    
+                    
                     o = dr.read(p, xmlReader);
-                    if (Boolean.TRUE.equals(si.getProperty("soap.force.doclit.bare")) 
-                        && parameters.isEmpty()) {
+                    if (dlb && parameters.isEmpty()) {
                         // webservice provider does not need to ensure size
                         parameters.add(o);
                     } else {
@@ -221,6 +223,48 @@
         }
     }
     
+    private void validatePart(MessagePartInfo p, QName elName, Message m) {
+        if (p == null) {
+            throw new Fault(new org.apache.cxf.common.i18n.Message("NO_PART_FOUND", LOG, elName),
+                            Fault.FAULT_CODE_CLIENT);
+
+        }
+
+        Boolean synth = false;
+        if (p.getMessageInfo() != null && p.getMessageInfo().getOperation() != null) {
+            OperationInfo op = p.getMessageInfo().getOperation();
+            Boolean b = (Boolean)op.getProperty("operation.is.synthetic");
+            if (b != null) {
+                synth = b;
+            }
+        }
+        
+        if (MessageUtils.getContextualBoolean(m, "soap.no.validate.parts", false)) {
+            // something like a Provider service or similar that is forcing a
+            // doc/lit/bare on an endpoint that may not really be doc/lit/bare.  
+            // we need to just let these through per spec so the endpoint
+            // can process it
+            synth = true;
+        }
+        if (synth) {
+            return;
+        }
+        if (p.isElement()) {
+            if (p.getConcreteName() != null
+                && !elName.equals(p.getConcreteName())
+                && !synth) {
+                throw new Fault("UNEXPECTED_ELEMENT", LOG, null, elName,
+                                p.getConcreteName());
+            }
+        } else {
+            if (!(elName.equals(p.getName()) || elName.equals(p.getConcreteName()))
+                && !synth) {
+                throw new Fault("UNEXPECTED_ELEMENT", LOG, null, elName,
+                                p.getConcreteName());
+            }
+        }
+    }
+    
     private void getPara(DepthXMLStreamReader xmlReader,
                          DataReader<XMLStreamReader> dr,
                          MessageContentsList parameters,
Index: apache-cxf-2.2.12-patch-04/rt/core/src/main/java/org/apache/cxf/interceptor/Messages.properties
===================================================================
diff -u -N -r13684 -r17026
--- apache-cxf-2.2.12-patch-04/rt/core/src/main/java/org/apache/cxf/interceptor/Messages.properties	(.../Messages.properties)	(revision 13684)
+++ apache-cxf-2.2.12-patch-04/rt/core/src/main/java/org/apache/cxf/interceptor/Messages.properties	(.../Messages.properties)	(revision 17026)
@@ -40,4 +40,5 @@
 EXCEPTION_WHILE_WRITING_FAULT = Exception occurred while writing fault.
 EXCEPTION_WHILE_CREATING_EXCEPTION = Exception occurred while creating exception: {0}
 UNEXPECTED_WRAPPER_ELEMENT = Unexpected wrapper element {0} found.   Expected {1}.
+UNEXPECTED_ELEMENT = Unexpected element {0} found.   Expected {1}.
  
Index: apache-cxf-2.2.12-patch-04/rt/core/src/test/java/org/apache/cxf/interceptor/DocLiteralInInterceptorTest.java
===================================================================
diff -u -N -r13684 -r17026
--- apache-cxf-2.2.12-patch-04/rt/core/src/test/java/org/apache/cxf/interceptor/DocLiteralInInterceptorTest.java	(.../DocLiteralInInterceptorTest.java)	(revision 13684)
+++ apache-cxf-2.2.12-patch-04/rt/core/src/test/java/org/apache/cxf/interceptor/DocLiteralInInterceptorTest.java	(.../DocLiteralInInterceptorTest.java)	(revision 17026)
@@ -102,12 +102,19 @@
         exchange.put(Endpoint.class, endpoint);
         
         OperationInfo operationInfo = new OperationInfo();
+        operationInfo.setProperty("operation.is.synthetic", Boolean.TRUE);
         MessageInfo messageInfo = new MessageInfo(operationInfo, Type.INPUT, 
                                                   new QName("http://foo.com", "bar"));
         messageInfo.addMessagePart(new MessagePartInfo(new QName("http://foo.com", "partInfo1"), null));
         messageInfo.addMessagePart(new MessagePartInfo(new QName("http://foo.com", "partInfo2"), null));
         messageInfo.addMessagePart(new MessagePartInfo(new QName("http://foo.com", "partInfo3"), null));
         messageInfo.addMessagePart(new MessagePartInfo(new QName("http://foo.com", "partInfo4"), null));
+        
+        for (MessagePartInfo mpi : messageInfo.getMessageParts()) {
+            mpi.setMessageContainer(messageInfo);
+        }
+
+        
         operationInfo.setInput("inputName", messageInfo);
         
         BindingOperationInfo boi = new BindingOperationInfo(null, operationInfo);
Index: apache-cxf-2.2.12-patch-04/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java
===================================================================
diff -u -N -r13684 -r17026
--- apache-cxf-2.2.12-patch-04/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java	(.../JaxWsServerFactoryBean.java)	(revision 13684)
+++ apache-cxf-2.2.12-patch-04/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java	(.../JaxWsServerFactoryBean.java)	(revision 17026)
@@ -47,6 +47,7 @@
 import org.apache.cxf.service.invoker.SingletonFactory;
 import org.apache.cxf.service.model.BindingInfo;
 import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.EndpointInfo;
 
 /**
  * Bean to help easily create Server endpoints for JAX-WS. Example:
@@ -162,6 +163,9 @@
         if (implInfo.isWebServiceProvider()) {
             bindingInfo.getService().setProperty("soap.force.doclit.bare", Boolean.TRUE);
             if (this.getServiceFactory().isPopulateFromClass()) {
+                for (EndpointInfo ei : bindingInfo.getService().getEndpoints()) {
+                    ei.setProperty("soap.no.validate.parts", Boolean.TRUE);
+                }
                 //Provider, but no wsdl.  Synthetic ops
                 for (BindingOperationInfo op : bindingInfo.getOperations()) {
                     op.setProperty("operation.is.synthetic", Boolean.TRUE);
Index: apache-cxf-2.2.12-patch-04/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
===================================================================
diff -u -N -r14877 -r17026
--- apache-cxf-2.2.12-patch-04/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java	(.../ServiceImpl.java)	(revision 14877)
+++ apache-cxf-2.2.12-patch-04/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java	(.../ServiceImpl.java)	(revision 17026)
@@ -295,6 +295,11 @@
         configureObject(dispatchService);
         for (ServiceInfo si : dispatchService.getServiceInfos()) {
             si.setProperty("soap.force.doclit.bare", Boolean.TRUE);
+            if (null == wsdlURL) {
+                for (EndpointInfo ei : si.getEndpoints()) {
+                    ei.setProperty("soap.no.validate.parts", Boolean.TRUE);
+                }
+            }
         }
         return serviceFactory;
     }    
Index: apache-cxf-2.2.12-patch-04/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
===================================================================
diff -u -N -r13684 -r17026
--- apache-cxf-2.2.12-patch-04/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java	(.../JaxWsServiceFactoryBean.java)	(revision 13684)
+++ apache-cxf-2.2.12-patch-04/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java	(.../JaxWsServiceFactoryBean.java)	(revision 17026)
@@ -295,6 +295,11 @@
             // Bind every operation to the invoke method.
             for (ServiceInfo si : getService().getServiceInfos()) {
                 si.setProperty("soap.force.doclit.bare", Boolean.TRUE);
+                if (!isFromWsdl()) {
+                    for (EndpointInfo ei : si.getEndpoints()) {
+                        ei.setProperty("soap.no.validate.parts", Boolean.TRUE);
+                    }
+                }
                 for (BindingInfo bind : si.getBindings()) {
                     for (BindingOperationInfo bop : bind.getOperations()) {
                         OperationInfo o = bop.getOperationInfo();
Index: apache-cxf-2.2.12-patch-04/rt/javascript/src/main/resources/org/apache/cxf/javascript/cxf-utils.js
===================================================================
diff -u -N -r13684 -r17026
--- apache-cxf-2.2.12-patch-04/rt/javascript/src/main/resources/org/apache/cxf/javascript/cxf-utils.js	(.../cxf-utils.js)	(revision 13684)
+++ apache-cxf-2.2.12-patch-04/rt/javascript/src/main/resources/org/apache/cxf/javascript/cxf-utils.js	(.../cxf-utils.js)	(revision 17026)
@@ -715,16 +715,26 @@
 		this.req.setRequestHeader("Content-Type", "text/xml;charset=utf-8");
 	}
 
-    if (headers) { // must be array indexed by header field.
+    var action = this.soapAction;
+	if (headers) { // must be array indexed by header field.
         // avoid extra properties on the headers.
         for (var h in headers) {
-            if(headers.hasOwnProperty(h)) {
+            if (h == "SOAPAction") {
+                action = headers[h];
+        	} else if(headers.hasOwnProperty(h)) {
                 this.req.setRequestHeader(h, headers[h]);
             }
         }
     }	
 
-	this.req.setRequestHeader("SOAPAction", this.soapAction);
+	if (action.length == 0) {
+    	action = "\"\"";
+	}
+	if (action.charAt(0) != '"') {
+    	action = '\"' + action + '\"';
+	}
+    
+	this.req.setRequestHeader("SOAPAction", action);
 	this.req.setRequestHeader("MessageType", this.messageType);
 
 	var requester = this; /* setup a closure */
Index: apache-cxf-2.2.12-patch-04/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java
===================================================================
diff -u -N -r13684 -r17026
--- apache-cxf-2.2.12-patch-04/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java	(.../MAPCodec.java)	(revision 13684)
+++ apache-cxf-2.2.12-patch-04/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java	(.../MAPCodec.java)	(revision 17026)
@@ -44,6 +44,7 @@
 import org.apache.cxf.binding.soap.SoapMessage;
 import org.apache.cxf.binding.soap.SoapVersion;
 import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor;
+import org.apache.cxf.binding.soap.interceptor.SoapActionInInterceptor;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.headers.Header;
@@ -151,9 +152,9 @@
     }
 
     /**
-     * Mediate message flow, peforming MAP {en|de}coding.
+     * Mediate message flow, performing MAP {en|de}coding.
      * 
-     * @param message the messsage message
+     * @param message the message message
      */     
     private void mediate(SoapMessage message) {
         if (!MessageUtils.getContextualBoolean(message, MAPAggregator.ADDRESSING_DISABLED, false)) {
@@ -163,7 +164,19 @@
                 AddressingProperties maps = decode(message);
                 ContextUtils.storeMAPs(maps, message, false);
                 markPartialResponse(message, maps);
-                restoreExchange(message, maps);     
+                restoreExchange(message, maps);
+                
+                if (maps != null 
+                    && !MessageUtils.isRequestor(message) 
+                    && message.getExchange().getBindingOperationInfo() == null
+                    && !MessageUtils.isOutbound(message)
+                    && maps.getAction() != null) {
+                    //try and use the Action from the maps to find the operation
+                    String action = maps.getAction().getValue();
+                    if (action != null) {
+                        SoapActionInInterceptor.getAndSetOperation(message, action);
+                    }
+                }
             }
         }
     }
Index: apache-cxf-2.2.12-patch-04/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/SecureConversationInInterceptor.java
===================================================================
diff -u -N -r13684 -r17026
--- apache-cxf-2.2.12-patch-04/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/SecureConversationInInterceptor.java	(.../SecureConversationInInterceptor.java)	(revision 13684)
+++ apache-cxf-2.2.12-patch-04/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/SecureConversationInInterceptor.java	(.../SecureConversationInInterceptor.java)	(revision 17026)
@@ -226,13 +226,12 @@
                 store = new MemoryTokenStore();
                 endpoint.getEndpointInfo().setProperty(TokenStore.class.getName(), store);
             }
-            endpoint = STSUtils.createSTSEndpoint(bus, 
+            endpoint = STSUtils.createSCEndpoint(bus, 
                                                   namespace,
                                                   endpoint.getEndpointInfo().getTransportId(),
                                                   destination.getAddress().getAddress().getValue(),
                                                   message.getVersion().getBindingId(), 
-                                                  policy,
-                                                  null);
+                                                  policy);
             endpoint.getEndpointInfo().setProperty(TokenStore.class.getName(), store);
             message.getExchange().put(TokenStore.class.getName(), store);
         
Index: apache-cxf-2.2.12-patch-04/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java
===================================================================
diff -u -N -r13684 -r17026
--- apache-cxf-2.2.12-patch-04/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java	(.../STSClient.java)	(revision 13684)
+++ apache-cxf-2.2.12-patch-04/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java	(.../STSClient.java)	(revision 17026)
@@ -424,6 +424,12 @@
         //operation is not correct as the Action is not set correctly.   Let's see if
         //we can at least find it by name and then set the action and such manually later.
         for (BindingOperationInfo boi : bi.getOperations()) {
+            if (suffix.endsWith(boi.getName().getLocalPart())) {
+                return boi;
+            }
+        }        
+        //Still didn't find anything useful
+        for (BindingOperationInfo boi : bi.getOperations()) {
             if (boi.getInput().getMessageInfo().getMessageParts().size() > 0) {
                 MessagePartInfo mpi = boi.getInput().getMessageInfo().getMessagePart(0);
                 if ("RequestSecurityToken".equals(mpi.getConcreteName().getLocalPart())) {
Index: apache-cxf-2.2.12-patch-04/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSUtils.java
===================================================================
diff -u -N -r13684 -r17026
--- apache-cxf-2.2.12-patch-04/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSUtils.java	(.../STSUtils.java)	(revision 13684)
+++ apache-cxf-2.2.12-patch-04/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSUtils.java	(.../STSUtils.java)	(revision 17026)
@@ -78,19 +78,41 @@
         return TOKEN_TYPE_SCT_05_12;
     }
     
-    
+    public static Endpoint createSTSEndpoint(Bus bus,
+                                            String namespace,
+                                            String transportId,
+                                            String location,
+                                            String soapVersion,
+                                            Policy policy,
+                                            QName epName) throws BusException, EndpointException {
+        return createSTSEndpoint(bus, namespace, transportId, location, soapVersion, policy, epName, false);
+    }
+
+    public static Endpoint createSCEndpoint(Bus bus,
+                                            String namespace,
+                                            String transportId,
+                                            String location,
+                                            String soapVersion,
+                                            Policy policy) throws BusException, EndpointException {
+        return createSTSEndpoint(bus, namespace, transportId, location, soapVersion, policy, null, true);
+    }
+
+    //CHECKSTYLE:OFF
     public static Endpoint createSTSEndpoint(Bus bus, 
                                              String namespace,
                                              String transportId,
                                              String location,
                                              String soapVersion,
                                              Policy policy,
-                                             QName epName) throws BusException, EndpointException {
+                                             QName epName,
+                                             boolean sc) throws BusException, EndpointException {
+        //CHECKSTYLE:ON
+        
         Service service = null;
         String ns = namespace + "/wsdl";
         ServiceInfo si = new ServiceInfo();
         
-        QName iName = new QName(ns, "SecurityTokenService");
+        QName iName = new QName(ns, sc ? "SecureConversationTokenService" : "SecurityTokenService");
         si.setName(iName);
         InterfaceInfo ii = new InterfaceInfo(si, iName);
         
@@ -125,7 +147,7 @@
             soi = new SoapOperationInfo();
             boi.addExtensor(soi);
         }
-        soi.setAction(namespace + "/RST/Issue");
+        soi.setAction(namespace + (sc ? "/RST/SCT" : "/RST/Issue"));
         
         boi = bi.getOperation(coi);
         soi = boi.getExtensor(SoapOperationInfo.class);
Index: apache-cxf-2.2.12-patch-04/systests/uncategorized/src/test/java/org/apache/cxf/systest/callback/ServerImpl.java
===================================================================
diff -u -N -r13684 -r17026
--- apache-cxf-2.2.12-patch-04/systests/uncategorized/src/test/java/org/apache/cxf/systest/callback/ServerImpl.java	(.../ServerImpl.java)	(revision 13684)
+++ apache-cxf-2.2.12-patch-04/systests/uncategorized/src/test/java/org/apache/cxf/systest/callback/ServerImpl.java	(.../ServerImpl.java)	(revision 17026)
@@ -22,6 +22,7 @@
 
 import javax.annotation.Resource;
 import javax.xml.namespace.QName;
+import javax.xml.ws.BindingProvider;
 import javax.xml.ws.Service;
 import javax.xml.ws.soap.SOAPBinding;
 import javax.xml.ws.wsaddressing.W3CEndpointReference;
@@ -84,6 +85,8 @@
             Service service = Service.create(null, serviceName);
             service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, address);
             CallbackPortType port =  (CallbackPortType)service.getPort(portName, sei);
+            //TODO! fix instead of disabling validation..
+            ((BindingProvider)port).getRequestContext().put("soap.no.validate.parts", true);
 
             port.serverSayHi("Sean");
 
Index: apache-cxf-2.2.12-patch-04/systests/uncategorized/src/test/java/org/apache/cxf/systest/soap/RPCEncodedSoapActionGreeterImpl.java
===================================================================
diff -u -N
--- apache-cxf-2.2.12-patch-04/systests/uncategorized/src/test/java/org/apache/cxf/systest/soap/RPCEncodedSoapActionGreeterImpl.java	(revision 0)
+++ apache-cxf-2.2.12-patch-04/systests/uncategorized/src/test/java/org/apache/cxf/systest/soap/RPCEncodedSoapActionGreeterImpl.java	(revision 17026)
@@ -0,0 +1,40 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.systest.soap;
+
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+import org.apache.hello_world_soap_action.WrappedGreeter;
+
+@WebService(endpointInterface = "org.apache.hello_world_soap_action.WrappedGreeter", 
+serviceName = "WrappedSOAPService")
+@SOAPBinding(style = SOAPBinding.Style.RPC, use = SOAPBinding.Use.ENCODED)
+public class RPCEncodedSoapActionGreeterImpl implements WrappedGreeter {
+
+    public String sayHiRequestWrapped(String in) {
+        return "sayHi";
+    }
+
+    public String sayHiRequest2Wrapped(String in) {
+        return "sayHi2";
+    }
+
+}
Index: apache-cxf-2.2.12-patch-04/systests/uncategorized/src/test/java/org/apache/cxf/systest/soap/RPCLitSoapActionGreeterImpl.java
===================================================================
diff -u -N
--- apache-cxf-2.2.12-patch-04/systests/uncategorized/src/test/java/org/apache/cxf/systest/soap/RPCLitSoapActionGreeterImpl.java	(revision 0)
+++ apache-cxf-2.2.12-patch-04/systests/uncategorized/src/test/java/org/apache/cxf/systest/soap/RPCLitSoapActionGreeterImpl.java	(revision 17026)
@@ -0,0 +1,40 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.systest.soap;
+
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+import org.apache.hello_world_soap_action.WrappedGreeter;
+
+@WebService(endpointInterface = "org.apache.hello_world_soap_action.WrappedGreeter", 
+serviceName = "WrappedSOAPService")
+@SOAPBinding(style = SOAPBinding.Style.RPC)
+public class RPCLitSoapActionGreeterImpl implements WrappedGreeter {
+
+    public String sayHiRequestWrapped(String in) {
+        return "sayHi";
+    }
+
+    public String sayHiRequest2Wrapped(String in) {
+        return "sayHi2";
+    }
+
+}
Index: apache-cxf-2.2.12-patch-04/systests/uncategorized/src/test/java/org/apache/cxf/systest/soap/SoapActionTest.java
===================================================================
diff -u -N -r13684 -r17026
--- apache-cxf-2.2.12-patch-04/systests/uncategorized/src/test/java/org/apache/cxf/systest/soap/SoapActionTest.java	(.../SoapActionTest.java)	(revision 13684)
+++ apache-cxf-2.2.12-patch-04/systests/uncategorized/src/test/java/org/apache/cxf/systest/soap/SoapActionTest.java	(.../SoapActionTest.java)	(revision 17026)
@@ -19,6 +19,8 @@
 
 package org.apache.cxf.systest.soap;
 
+import javax.xml.ws.BindingProvider;
+
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.binding.soap.Soap12;
@@ -27,6 +29,7 @@
 import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
 import org.apache.cxf.testutil.common.TestUtil;
 import org.apache.hello_world_soap_action.Greeter;
+import org.apache.hello_world_soap_action.WrappedGreeter;
 import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
@@ -35,12 +38,21 @@
 public class SoapActionTest extends Assert {
     static final String PORT1 = TestUtil.getPortNumber(SoapActionTest.class, 1);
     static final String PORT2 = TestUtil.getPortNumber(SoapActionTest.class, 2);
+    static final String PORT3 = TestUtil.getPortNumber(SoapActionTest.class, 3);
+    static final String PORT4 = TestUtil.getPortNumber(SoapActionTest.class, 4);
+    static final String PORT5 = TestUtil.getPortNumber(SoapActionTest.class, 5);
+    static final String PORT6 = TestUtil.getPortNumber(SoapActionTest.class, 6);
+    static final String PORT7 = TestUtil.getPortNumber(SoapActionTest.class, 7);
     
     static Bus bus;
     static String add11 = "http://localhost:" + PORT1 + "/test11";
     static String add12 = "http://localhost:" + PORT2 + "/test12";
+    static String add13 = "http://localhost:" + PORT3 + "/testWrapped";
+    static String add14 = "http://localhost:" + PORT4 + "/testWrapped12";
+    static String add15 = "http://localhost:" + PORT5 + "/testRPCLit";
+    static String add16 = "http://localhost:" + PORT6 + "/testRPCEncoded";
+    static String add17 = "http://localhost:" + PORT7 + "/testWrappedEncoded";
 
-
     @BeforeClass
     public static void createServers() throws Exception {
         bus = BusFactory.getDefaultBus();
@@ -58,7 +70,40 @@
         config.setVersion(Soap12.getInstance());
         sf.setBindingConfig(config);
         sf.create();
+        
+        sf = new JaxWsServerFactoryBean();
+        sf.setServiceBean(new WrappedSoapActionGreeterImpl());
+        sf.setAddress(add13);
+        sf.setBus(bus);
+        sf.create();
+        
+        sf = new JaxWsServerFactoryBean();
+        sf.setServiceBean(new WrappedSoapActionGreeterImpl());
+        sf.setAddress(add14);
+        sf.setBus(bus);
+        config.setVersion(Soap12.getInstance());
+        sf.setBindingConfig(config);
+        sf.create();
+        
+        sf = new JaxWsServerFactoryBean();
+        sf.setServiceBean(new RPCLitSoapActionGreeterImpl());
+        sf.setAddress(add15);
+        sf.setBus(bus);
+        sf.create();
+        
+        sf = new JaxWsServerFactoryBean();
+        sf.setServiceBean(new RPCEncodedSoapActionGreeterImpl());
+        sf.setAddress(add16);
+        sf.setBus(bus);
+        sf.create();
+        
+        sf = new JaxWsServerFactoryBean();
+        sf.setServiceBean(new WrappedEncodedSoapActionGreeterImpl());
+        sf.setAddress(add17);
+        sf.setBus(bus);
+        sf.create();
     }
+    
     @AfterClass
     public static void shutdown() throws Exception {
         bus.shutdown(true);
@@ -93,4 +138,348 @@
         assertEquals("sayHi", greeter.sayHi("test"));
         assertEquals("sayHi2", greeter.sayHi2("test"));
     }
+    
+    
+    @Test
+    public void testBareSoapActionSpoofing() throws Exception {
+        JaxWsProxyFactoryBean pf = new JaxWsProxyFactoryBean();
+        pf.setServiceClass(Greeter.class);
+        pf.setAddress(add11);
+        pf.setBus(bus);
+        Greeter greeter = (Greeter) pf.create();
+        
+        assertEquals("sayHi", greeter.sayHi("test"));
+        assertEquals("sayHi2", greeter.sayHi2("test"));        
+        
+        // Now test spoofing attack
+        ((BindingProvider)greeter).getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, "true");
+        ((BindingProvider)greeter).getRequestContext().put(
+            BindingProvider.SOAPACTION_URI_PROPERTY, "SAY_HI_2"
+        );
+        try {
+            greeter.sayHi("test");
+            fail("Failure expected on spoofing attack");
+        } catch (Exception ex) {
+            // expected
+        }
+        
+        // Test the other operation
+        ((BindingProvider)greeter).getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, "true");
+        ((BindingProvider)greeter).getRequestContext().put(
+            BindingProvider.SOAPACTION_URI_PROPERTY, "SAY_HI_1"
+        );
+        try {
+            greeter.sayHi2("test");
+            fail("Failure expected on spoofing attack");
+        } catch (Exception ex) {
+            // expected
+        }
+        
+        // Test a SOAP Action that does not exist in the binding
+        ((BindingProvider)greeter).getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, "true");
+        ((BindingProvider)greeter).getRequestContext().put(
+            BindingProvider.SOAPACTION_URI_PROPERTY, "SAY_HI_UNKNOWN"
+        );
+        try {
+            greeter.sayHi("test");
+            fail("Failure expected on spoofing attack");
+        } catch (Exception ex) {
+            // expected
+        }
+    }
+    
+    @Test
+    public void testBareSoap12ActionSpoofing() throws Exception {
+        JaxWsProxyFactoryBean pf = new JaxWsProxyFactoryBean();
+        pf.setServiceClass(Greeter.class);
+        pf.setAddress(add12);
+        SoapBindingConfiguration config = new SoapBindingConfiguration();
+        config.setVersion(Soap12.getInstance());
+        pf.setBindingConfig(config);
+        pf.setBus(bus);
+        Greeter greeter = (Greeter) pf.create();
+        
+        assertEquals("sayHi", greeter.sayHi("test"));
+        assertEquals("sayHi2", greeter.sayHi2("test"));        
+        
+        // Now test spoofing attack
+        ((BindingProvider)greeter).getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, "true");
+        ((BindingProvider)greeter).getRequestContext().put(
+            BindingProvider.SOAPACTION_URI_PROPERTY, "SAY_HI_2"
+        );
+        try {
+            greeter.sayHi("test");
+            fail("Failure expected on spoofing attack");
+        } catch (Exception ex) {
+            // expected
+        }
+        
+        // Test the other operation
+        ((BindingProvider)greeter).getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, "true");
+        ((BindingProvider)greeter).getRequestContext().put(
+            BindingProvider.SOAPACTION_URI_PROPERTY, "SAY_HI_1"
+        );
+        try {
+            greeter.sayHi2("test");
+            fail("Failure expected on spoofing attack");
+        } catch (Exception ex) {
+            // expected
+        }
+        
+        // Test a SOAP Action that does not exist in the binding
+        ((BindingProvider)greeter).getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, "true");
+        ((BindingProvider)greeter).getRequestContext().put(
+            BindingProvider.SOAPACTION_URI_PROPERTY, "SAY_HI_UNKNOWN"
+        );
+        try {
+            greeter.sayHi("test");
+            fail("Failure expected on spoofing attack");
+        } catch (Exception ex) {
+            // expected
+        }
+    }
+    
+    @Test
+    public void testWrappedSoapActionSpoofing() throws Exception {
+        JaxWsProxyFactoryBean pf = new JaxWsProxyFactoryBean();
+        pf.setServiceClass(WrappedGreeter.class);
+        pf.setAddress(add13);
+        pf.setBus(bus);
+        WrappedGreeter greeter = (WrappedGreeter) pf.create();
+        
+        assertEquals("sayHi", greeter.sayHiRequestWrapped("test"));
+        assertEquals("sayHi2", greeter.sayHiRequest2Wrapped("test"));        
+        
+        // Now test spoofing attack
+        ((BindingProvider)greeter).getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, "true");
+        ((BindingProvider)greeter).getRequestContext().put(
+            BindingProvider.SOAPACTION_URI_PROPERTY, "SAY_HI_2"
+        );
+        try {
+            greeter.sayHiRequestWrapped("test");
+            fail("Failure expected on spoofing attack");
+        } catch (Exception ex) {
+            // expected
+        }
+        
+        // Test the other operation
+        ((BindingProvider)greeter).getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, "true");
+        ((BindingProvider)greeter).getRequestContext().put(
+            BindingProvider.SOAPACTION_URI_PROPERTY, "SAY_HI_1"
+        );
+        try {
+            greeter.sayHiRequest2Wrapped("test");
+            fail("Failure expected on spoofing attack");
+        } catch (Exception ex) {
+            // expected
+        }
+        
+        // Test a SOAP Action that does not exist in the binding
+        ((BindingProvider)greeter).getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, "true");
+        ((BindingProvider)greeter).getRequestContext().put(
+            BindingProvider.SOAPACTION_URI_PROPERTY, "SAY_HI_UNKNOWN"
+        );
+        try {
+            greeter.sayHiRequestWrapped("test");
+            fail("Failure expected on spoofing attack");
+        } catch (Exception ex) {
+            // expected
+        }
+    }
+    
+    @Test
+    public void testWrappedSoap12ActionSpoofing() throws Exception {
+        JaxWsProxyFactoryBean pf = new JaxWsProxyFactoryBean();
+        pf.setServiceClass(WrappedGreeter.class);
+        pf.setAddress(add14);
+        SoapBindingConfiguration config = new SoapBindingConfiguration();
+        config.setVersion(Soap12.getInstance());
+        pf.setBindingConfig(config);
+        pf.setBus(bus);
+        WrappedGreeter greeter = (WrappedGreeter) pf.create();
+        
+        assertEquals("sayHi", greeter.sayHiRequestWrapped("test"));
+        assertEquals("sayHi2", greeter.sayHiRequest2Wrapped("test"));        
+        
+        // Now test spoofing attack
+        ((BindingProvider)greeter).getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, "true");
+        ((BindingProvider)greeter).getRequestContext().put(
+            BindingProvider.SOAPACTION_URI_PROPERTY, "SAY_HI_2"
+        );
+        try {
+            greeter.sayHiRequestWrapped("test");
+            fail("Failure expected on spoofing attack");
+        } catch (Exception ex) {
+            // expected
+        }
+        
+        // Test the other operation
+        ((BindingProvider)greeter).getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, "true");
+        ((BindingProvider)greeter).getRequestContext().put(
+            BindingProvider.SOAPACTION_URI_PROPERTY, "SAY_HI_1"
+        );
+        try {
+            greeter.sayHiRequest2Wrapped("test");
+            fail("Failure expected on spoofing attack");
+        } catch (Exception ex) {
+            // expected
+        }
+        
+        // Test a SOAP Action that does not exist in the binding
+        ((BindingProvider)greeter).getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, "true");
+        ((BindingProvider)greeter).getRequestContext().put(
+            BindingProvider.SOAPACTION_URI_PROPERTY, "SAY_HI_UNKNOWN"
+        );
+        try {
+            greeter.sayHiRequestWrapped("test");
+            fail("Failure expected on spoofing attack");
+        } catch (Exception ex) {
+            // expected
+        }
+    }
+    
+    @Test
+    public void testRPCLitSoapActionSpoofing() throws Exception {
+        JaxWsProxyFactoryBean pf = new JaxWsProxyFactoryBean();
+        pf.setServiceClass(WrappedGreeter.class);
+        pf.setAddress(add15);
+        pf.setBus(bus);
+        WrappedGreeter greeter = (WrappedGreeter) pf.create();
+        
+        assertEquals("sayHi", greeter.sayHiRequestWrapped("test"));
+        assertEquals("sayHi2", greeter.sayHiRequest2Wrapped("test"));        
+        
+        // Now test spoofing attack
+        ((BindingProvider)greeter).getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, "true");
+        ((BindingProvider)greeter).getRequestContext().put(
+            BindingProvider.SOAPACTION_URI_PROPERTY, "SAY_HI_2"
+        );
+        try {
+            greeter.sayHiRequestWrapped("test");
+            fail("Failure expected on spoofing attack");
+        } catch (Exception ex) {
+            // expected
+        }
+        
+        // Test the other operation
+        ((BindingProvider)greeter).getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, "true");
+        ((BindingProvider)greeter).getRequestContext().put(
+            BindingProvider.SOAPACTION_URI_PROPERTY, "SAY_HI_1"
+        );
+        try {
+            greeter.sayHiRequest2Wrapped("test");
+            fail("Failure expected on spoofing attack");
+        } catch (Exception ex) {
+            // expected
+        }
+        
+        // Test a SOAP Action that does not exist in the binding
+        ((BindingProvider)greeter).getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, "true");
+        ((BindingProvider)greeter).getRequestContext().put(
+            BindingProvider.SOAPACTION_URI_PROPERTY, "SAY_HI_UNKNOWN"
+        );
+        try {
+            greeter.sayHiRequestWrapped("test");
+            fail("Failure expected on spoofing attack");
+        } catch (Exception ex) {
+            // expected
+        }
+    }
+    
+    @Test
+    public void testRPCEncodedSoapActionSpoofing() throws Exception {
+        JaxWsProxyFactoryBean pf = new JaxWsProxyFactoryBean();
+        pf.setServiceClass(WrappedGreeter.class);
+        pf.setAddress(add16);
+        pf.setBus(bus);
+        WrappedGreeter greeter = (WrappedGreeter) pf.create();
+        
+        assertEquals("sayHi", greeter.sayHiRequestWrapped("test"));
+        assertEquals("sayHi2", greeter.sayHiRequest2Wrapped("test"));        
+        
+        // Now test spoofing attack
+        ((BindingProvider)greeter).getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, "true");
+        ((BindingProvider)greeter).getRequestContext().put(
+            BindingProvider.SOAPACTION_URI_PROPERTY, "SAY_HI_2"
+        );
+        try {
+            greeter.sayHiRequestWrapped("test");
+            fail("Failure expected on spoofing attack");
+        } catch (Exception ex) {
+            // expected
+        }
+        
+        // Test the other operation
+        ((BindingProvider)greeter).getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, "true");
+        ((BindingProvider)greeter).getRequestContext().put(
+            BindingProvider.SOAPACTION_URI_PROPERTY, "SAY_HI_1"
+        );
+        try {
+            greeter.sayHiRequest2Wrapped("test");
+            fail("Failure expected on spoofing attack");
+        } catch (Exception ex) {
+            // expected
+        }
+        
+        // Test a SOAP Action that does not exist in the binding
+        ((BindingProvider)greeter).getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, "true");
+        ((BindingProvider)greeter).getRequestContext().put(
+            BindingProvider.SOAPACTION_URI_PROPERTY, "SAY_HI_UNKNOWN"
+        );
+        try {
+            greeter.sayHiRequestWrapped("test");
+            fail("Failure expected on spoofing attack");
+        } catch (Exception ex) {
+            // expected
+        }
+    }
+    
+    @Test
+    public void testWrappedEncodedSoapActionSpoofing() throws Exception {
+        JaxWsProxyFactoryBean pf = new JaxWsProxyFactoryBean();
+        pf.setServiceClass(WrappedGreeter.class);
+        pf.setAddress(add17);
+        pf.setBus(bus);
+        WrappedGreeter greeter = (WrappedGreeter) pf.create();
+        
+        assertEquals("sayHi", greeter.sayHiRequestWrapped("test"));
+        assertEquals("sayHi2", greeter.sayHiRequest2Wrapped("test"));        
+        
+        // Now test spoofing attack
+        ((BindingProvider)greeter).getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, "true");
+        ((BindingProvider)greeter).getRequestContext().put(
+            BindingProvider.SOAPACTION_URI_PROPERTY, "SAY_HI_2"
+        );
+        try {
+            greeter.sayHiRequestWrapped("test");
+            fail("Failure expected on spoofing attack");
+        } catch (Exception ex) {
+            // expected
+        }
+        
+        // Test the other operation
+        ((BindingProvider)greeter).getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, "true");
+        ((BindingProvider)greeter).getRequestContext().put(
+            BindingProvider.SOAPACTION_URI_PROPERTY, "SAY_HI_1"
+        );
+        try {
+            greeter.sayHiRequest2Wrapped("test");
+            fail("Failure expected on spoofing attack");
+        } catch (Exception ex) {
+            // expected
+        }
+        
+        // Test a SOAP Action that does not exist in the binding
+        ((BindingProvider)greeter).getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, "true");
+        ((BindingProvider)greeter).getRequestContext().put(
+            BindingProvider.SOAPACTION_URI_PROPERTY, "SAY_HI_UNKNOWN"
+        );
+        try {
+            greeter.sayHiRequestWrapped("test");
+            fail("Failure expected on spoofing attack");
+        } catch (Exception ex) {
+            // expected
+        }
+    }
+    
 }
Index: apache-cxf-2.2.12-patch-04/systests/uncategorized/src/test/java/org/apache/cxf/systest/soap/WrappedEncodedSoapActionGreeterImpl.java
===================================================================
diff -u -N
--- apache-cxf-2.2.12-patch-04/systests/uncategorized/src/test/java/org/apache/cxf/systest/soap/WrappedEncodedSoapActionGreeterImpl.java	(revision 0)
+++ apache-cxf-2.2.12-patch-04/systests/uncategorized/src/test/java/org/apache/cxf/systest/soap/WrappedEncodedSoapActionGreeterImpl.java	(revision 17026)
@@ -0,0 +1,40 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.systest.soap;
+
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+import org.apache.hello_world_soap_action.WrappedGreeter;
+
+@WebService(endpointInterface = "org.apache.hello_world_soap_action.WrappedGreeter", 
+            serviceName = "WrappedSOAPService")
+@SOAPBinding(use = SOAPBinding.Use.ENCODED)
+public class WrappedEncodedSoapActionGreeterImpl implements WrappedGreeter {
+
+    public String sayHiRequestWrapped(String in) {
+        return "sayHi";
+    }
+
+    public String sayHiRequest2Wrapped(String in) {
+        return "sayHi2";
+    }
+
+}
Index: apache-cxf-2.2.12-patch-04/systests/uncategorized/src/test/java/org/apache/cxf/systest/soap/WrappedSoapActionGreeterImpl.java
===================================================================
diff -u -N
--- apache-cxf-2.2.12-patch-04/systests/uncategorized/src/test/java/org/apache/cxf/systest/soap/WrappedSoapActionGreeterImpl.java	(revision 0)
+++ apache-cxf-2.2.12-patch-04/systests/uncategorized/src/test/java/org/apache/cxf/systest/soap/WrappedSoapActionGreeterImpl.java	(revision 17026)
@@ -0,0 +1,38 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.systest.soap;
+
+import javax.jws.WebService;
+
+import org.apache.hello_world_soap_action.WrappedGreeter;
+
+@WebService(endpointInterface = "org.apache.hello_world_soap_action.WrappedGreeter", 
+            serviceName = "WrappedSOAPService")
+public class WrappedSoapActionGreeterImpl implements WrappedGreeter {
+
+    public String sayHiRequestWrapped(String in) {
+        return "sayHi";
+    }
+
+    public String sayHiRequest2Wrapped(String in) {
+        return "sayHi2";
+    }
+
+}
Index: apache-cxf-2.2.12-patch-04/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/WSAPureWsdlTest.java
===================================================================
diff -u -N -r13684 -r17026
--- apache-cxf-2.2.12-patch-04/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/WSAPureWsdlTest.java	(.../WSAPureWsdlTest.java)	(revision 13684)
+++ apache-cxf-2.2.12-patch-04/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/WSAPureWsdlTest.java	(.../WSAPureWsdlTest.java)	(revision 17026)
@@ -157,6 +157,7 @@
         disp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, 
                                      "http://localhost:" + PORT + "/jaxws/add");
 
+        /** Removed as a consequence of backporting fix for CVE-2012-3451 while not having CXF-3783
         //manually set the action
         disp.getRequestContext().put(BindingProvider.SOAPACTION_URI_PROPERTY,
                                      expectedOut);
@@ -174,6 +175,7 @@
 
         disp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, 
                                      "http://localhost:" + PORT + "/jaxws/add");
+        **/
         
         //set the operation name so action can be pulled from the wsdl
         disp.getRequestContext().put(MessageContext.WSDL_OPERATION, 
Index: apache-cxf-2.2.12-patch-04/systests/ws-specs/src/test/resources/wsdl_systest_wsspec/add_numbers.wsdl
===================================================================
diff -u -N -r13684 -r17026
--- apache-cxf-2.2.12-patch-04/systests/ws-specs/src/test/resources/wsdl_systest_wsspec/add_numbers.wsdl	(.../add_numbers.wsdl)	(revision 13684)
+++ apache-cxf-2.2.12-patch-04/systests/ws-specs/src/test/resources/wsdl_systest_wsspec/add_numbers.wsdl	(.../add_numbers.wsdl)	(revision 17026)
@@ -164,7 +164,7 @@
 			<!-- 	    </fault> -->
 		</operation>
 		<operation name="addNumbers3">
-			<soap:operation soapAction="" />
+			<soap:operation soapAction="3in" />
 			<input>
 				<soap:body use="literal" />
 			</input>
@@ -206,7 +206,7 @@
 			<!-- 	    </fault> -->
 		</operation>
 		<operation name="addNumbers3">
-			<soap:operation soapAction="" />
+			<soap:operation soapAction="3in" />
 			<input>
 				<soap:body use="literal" />
 			</input>
Index: apache-cxf-2.2.12-patch-04/testutils/src/main/resources/wsdl/hello_world_soap_action.wsdl
===================================================================
diff -u -N -r13684 -r17026
--- apache-cxf-2.2.12-patch-04/testutils/src/main/resources/wsdl/hello_world_soap_action.wsdl	(.../hello_world_soap_action.wsdl)	(revision 13684)
+++ apache-cxf-2.2.12-patch-04/testutils/src/main/resources/wsdl/hello_world_soap_action.wsdl	(.../hello_world_soap_action.wsdl)	(revision 17026)
@@ -26,6 +26,7 @@
   xmlns:jms="http://cxf.apache.org/transports/jms"
   xmlns:tns="http://apache.org/hello_world_soap_action"
   xmlns:x1="http://apache.org/hello_world_soap_action/types"
+  xmlns:x2="http://apache.org/hello_world_soap_action/types/wrapped"
   xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
   targetNamespace="http://apache.org/hello_world_soap_action"
   name="HelloWorld">
@@ -37,6 +38,36 @@
       <element name="text" type="xsd:string" />
       <element name="text2" type="xsd:string" />
     </schema>
+    <xsd:schema targetNamespace="http://apache.org/hello_world_soap_action/types/wrapped">
+            <xsd:element name="sayHiRequestWrapped">
+                <xsd:complexType>
+                    <xsd:sequence>
+                        <xsd:element name="wrappedText" type="xsd:string" />
+                    </xsd:sequence>
+                </xsd:complexType>
+            </xsd:element>
+            <xsd:element name="sayHiResponseWrapped">
+                <xsd:complexType>
+                    <xsd:sequence>
+                        <xsd:element name="wrappedTextResponse" type="xsd:string" />
+                    </xsd:sequence>
+                </xsd:complexType>
+            </xsd:element>
+            <xsd:element name="sayHiRequest2Wrapped">
+                <xsd:complexType>
+                    <xsd:sequence>
+                        <xsd:element name="wrappedText" type="xsd:string" />
+                    </xsd:sequence>
+                </xsd:complexType>
+            </xsd:element>
+            <xsd:element name="sayHiResponse2Wrapped">
+                <xsd:complexType>
+                    <xsd:sequence>
+                        <xsd:element name="wrappedTextResponse" type="xsd:string" />
+                    </xsd:sequence>
+                </xsd:complexType>
+            </xsd:element>
+        </xsd:schema>
   </wsdl:types>
   <wsdl:message name="sayHiRequest">
     <wsdl:part name="in" element="x1:text" />
@@ -50,6 +81,19 @@
   <wsdl:message name="sayHiResponse2">
     <wsdl:part name="out" element="x1:text" />
   </wsdl:message>
+  
+  <wsdl:message name="sayHiRequestWrapped">
+        <wsdl:part element="x2:sayHiRequestWrapped" name="parameters" />
+  </wsdl:message>
+  <wsdl:message name="sayHiResponseWrapped">
+        <wsdl:part element="x2:sayHiResponseWrapped" name="parameters" />
+  </wsdl:message>
+  <wsdl:message name="sayHiRequest2Wrapped">
+        <wsdl:part element="x2:sayHiRequest2Wrapped" name="parameters" />
+  </wsdl:message>
+  <wsdl:message name="sayHiResponse2Wrapped">
+        <wsdl:part element="x2:sayHiResponse2Wrapped" name="parameters" />
+  </wsdl:message>
 
   <wsdl:portType name="Greeter">
     <wsdl:operation name="sayHi">
@@ -63,6 +107,19 @@
     </wsdl:operation>
 
   </wsdl:portType>
+  
+  <wsdl:portType name="WrappedGreeter">
+        <wsdl:operation name="sayHiRequestWrapped">
+            <wsdl:input message="tns:sayHiRequestWrapped" />
+            <wsdl:output message="tns:sayHiResponseWrapped" />
+        </wsdl:operation>
+        
+        <wsdl:operation name="sayHiRequest2Wrapped">
+            <wsdl:input message="tns:sayHiRequest2Wrapped" />
+            <wsdl:output message="tns:sayHiResponse2Wrapped" />
+        </wsdl:operation>
+  </wsdl:portType>
+  
   <wsdl:binding name="Greeter_SOAPBinding" type="tns:Greeter">
     <soap:binding style="document"
       transport="http://schemas.xmlsoap.org/soap/http" />
@@ -86,6 +143,7 @@
     </wsdl:operation>
 
   </wsdl:binding>
+  
   <wsdl:binding name="Greeter_SOAP12Binding" type="tns:Greeter">
     <soap12:binding style="document"
       transport="http://www.w3.org/2003/05/soap/bindings/HTTP/" />
@@ -109,6 +167,53 @@
     </wsdl:operation>
     
   </wsdl:binding>
+  
+  <wsdl:binding name="Greeter_WrappedSOAPBinding" type="tns:WrappedGreeter">
+        <soap:binding style="document"
+            transport="http://schemas.xmlsoap.org/soap/http" />
+        <wsdl:operation name="sayHiRequestWrapped">
+            <soap:operation soapAction="SAY_HI_1" />
+            <wsdl:input>
+                <soap:body use="literal" />
+            </wsdl:input>
+            <wsdl:output>
+                <soap:body use="literal" />
+            </wsdl:output>
+        </wsdl:operation>
+        <wsdl:operation name="sayHiRequest2Wrapped">
+            <soap:operation soapAction="SAY_HI_2" />
+            <wsdl:input>
+                <soap:body use="literal" />
+            </wsdl:input>
+            <wsdl:output>
+                <soap:body use="literal" />
+            </wsdl:output>
+        </wsdl:operation>
+  </wsdl:binding>     
+  
+  <wsdl:binding name="Greeter_WrappedSOAP12Binding" type="tns:WrappedGreeter">
+        <soap12:binding style="document"
+            transport="http://www.w3.org/2003/05/soap/bindings/HTTP/" />
+        <wsdl:operation name="sayHiRequestWrapped">
+            <soap12:operation soapAction="SAY_HI_1" />
+            <wsdl:input>
+                <soap12:body use="literal" />
+            </wsdl:input>
+            <wsdl:output>
+                <soap12:body use="literal" />
+            </wsdl:output>
+        </wsdl:operation>
+        <wsdl:operation name="sayHiRequest2Wrapped">
+            <soap12:operation soapAction="SAY_HI_2" />
+            <wsdl:input>
+                <soap12:body use="literal" />
+            </wsdl:input>
+            <wsdl:output>
+                <soap12:body use="literal" />
+            </wsdl:output>
+        </wsdl:operation>
+  </wsdl:binding>     
+  
   <wsdl:service name="SOAPService">
     <wsdl:port name="SoapPort" binding="tns:Greeter_SOAPBinding">
       <soap:address
@@ -121,4 +226,14 @@
         location="http://localhost:9001/SOAPDocLitService/Soap12Port" />
     </wsdl:port>
   </wsdl:service>
+  <wsdl:service name="WrappedSOAPService">
+      <wsdl:port name="WrappedSoapPort" binding="tns:Greeter_WrappedSOAPBinding">
+            <soap:address location="http://localhost:9001/SOAPDocLitService/WrappedSoapPort" />
+      </wsdl:port>
+  </wsdl:service>
+  <wsdl:service name="WrappedSOAP12Service">
+      <wsdl:port name="WrappedSoap12Port" binding="tns:Greeter_WrappedSOAP12Binding">
+            <soap:address location="http://localhost:9001/SOAPDocLitService/WrappedSoap12Port" />
+      </wsdl:port>
+  </wsdl:service>
 </wsdl:definitions>
