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/06/01 17:58:31 UTC
svn commit: r950131 - in /cxf/branches/2.2.x-fixes: ./
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/w...
Author: dkulp
Date: Tue Jun 1 15:58:30 2010
New Revision: 950131
URL: http://svn.apache.org/viewvc?rev=950131&view=rev
Log:
Merged revisions 949381 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r949381 | dkulp | 2010-05-29 07:38:35 -0400 (Sat, 29 May 2010) | 3 lines
[CXF-2832] Validate the incoming Action
Make sure the unwrapped operation and messages propogate teh extensors
to the unwrapped version
........
Modified:
cxf/branches/2.2.x-fixes/ (props changed)
cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/service/model/AbstractPropertiesHolder.java
cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/service/model/OperationInfo.java
cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/service/model/UnwrappedOperationInfo.java
cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java
cxf/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java
cxf/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java
cxf/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java
cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_fromjava/WSAFromJavaTest.java
cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/WSAPureWsdlTest.java
cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/resources/wsdl_systest_wsspec/add_numbers.wsdl
Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/service/model/AbstractPropertiesHolder.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/service/model/AbstractPropertiesHolder.java?rev=950131&r1=950130&r2=950131&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/service/model/AbstractPropertiesHolder.java (original)
+++ cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/service/model/AbstractPropertiesHolder.java Tue Jun 1 15:58:30 2010
@@ -29,24 +29,87 @@ 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;
+ 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) {
+ 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;
+ }
+ return propertyMap.get().remove(name);
+ }
public <T> T getProperty(String name, Class<T> cls) {
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);
@@ -55,6 +118,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));
}
@@ -66,6 +133,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) {
@@ -77,6 +148,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) {
@@ -95,6 +170,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;
@@ -107,6 +185,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;
@@ -121,19 +203,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>();
}
@@ -141,6 +236,10 @@ public abstract class AbstractProperties
}
public void setExtensionAttributes(Map<QName, Object> attrs) {
+ if (delegate != null) {
+ delegate.setExtensionAttributes(attrs);
+ return;
+ }
extensionAttributes = attrs;
}
@@ -154,6 +253,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/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/service/model/OperationInfo.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/service/model/OperationInfo.java?rev=950131&r1=950130&r2=950131&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/service/model/OperationInfo.java (original)
+++ cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/service/model/OperationInfo.java Tue Jun 1 15:58:30 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/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/service/model/UnwrappedOperationInfo.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/service/model/UnwrappedOperationInfo.java?rev=950131&r1=950130&r2=950131&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/service/model/UnwrappedOperationInfo.java (original)
+++ cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/service/model/UnwrappedOperationInfo.java Tue Jun 1 15:58:30 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/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java?rev=950131&r1=950130&r2=950131&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java (original)
+++ cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java Tue Jun 1 15:58:30 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/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java?rev=950131&r1=950130&r2=950131&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java (original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java Tue Jun 1 15:58:30 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:
@@ -158,6 +159,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/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java?rev=950131&r1=950130&r2=950131&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java (original)
+++ cxf/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java Tue Jun 1 15:58:30 2010
@@ -74,12 +74,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
@@ -730,7 +730,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)
@@ -782,7 +785,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/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java?rev=950131&r1=950130&r2=950131&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java (original)
+++ cxf/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java Tue Jun 1 15:58:30 2010
@@ -35,6 +35,8 @@ import javax.xml.ws.WebFault;
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.Endpoint;
@@ -510,7 +512,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)));
}
}
@@ -590,9 +592,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();
@@ -600,24 +602,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) {
@@ -805,16 +821,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");
@@ -823,19 +850,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/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java?rev=950131&r1=950130&r2=950131&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java (original)
+++ cxf/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java Tue Jun 1 15:58:30 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/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_fromjava/WSAFromJavaTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_fromjava/WSAFromJavaTest.java?rev=950131&r1=950130&r2=950131&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_fromjava/WSAFromJavaTest.java (original)
+++ cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_fromjava/WSAFromJavaTest.java Tue Jun 1 15:58:30 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/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/WSAPureWsdlTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/WSAPureWsdlTest.java?rev=950131&r1=950130&r2=950131&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/WSAPureWsdlTest.java (original)
+++ cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/WSAPureWsdlTest.java Tue Jun 1 15:58:30 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/branches/2.2.x-fixes/systests/ws-specs/src/test/resources/wsdl_systest_wsspec/add_numbers.wsdl
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/resources/wsdl_systest_wsspec/add_numbers.wsdl?rev=950131&r1=950130&r2=950131&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/resources/wsdl_systest_wsspec/add_numbers.wsdl (original)
+++ cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/resources/wsdl_systest_wsspec/add_numbers.wsdl Tue Jun 1 15:58:30 2010
@@ -122,7 +122,7 @@
<!-- </fault> -->
</operation>
<operation name="addNumbers3">
- <soap:operation soapAction="" />
+ <soap:operation soapAction="3in" />
<input>
<soap:body use="literal" />
</input>