Author: thomas.diesler(a)jboss.com
Date: 2007-10-09 06:03:27 -0400 (Tue, 09 Oct 2007)
New Revision: 4700
Modified:
stack/native/branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/client/EndpointInfo.java
stack/native/branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java
stack/native/branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/wssecurity/SimpleDispatchTestCase.java
Log:
[JBWS-1817] WS-Security with JAX-WS Dispatch
Modified:
stack/native/branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/client/EndpointInfo.java
===================================================================
---
stack/native/branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/client/EndpointInfo.java 2007-10-09
08:23:00 UTC (rev 4699)
+++
stack/native/branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/client/EndpointInfo.java 2007-10-09
10:03:27 UTC (rev 4700)
@@ -38,6 +38,7 @@
{
private String targetAddress;
private Map<String, Object> properties;
+
public EndpointInfo(EndpointMetaData epMetaData, String targetAddress, Map<String,
Object> callProps)
{
this.targetAddress = targetAddress;
Modified:
stack/native/branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java
===================================================================
---
stack/native/branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java 2007-10-09
08:23:00 UTC (rev 4699)
+++
stack/native/branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java 2007-10-09
10:03:27 UTC (rev 4700)
@@ -59,6 +59,7 @@
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.ConfigProvider;
import org.jboss.ws.core.MessageAbstraction;
+import org.jboss.ws.core.client.EndpointInfo;
import org.jboss.ws.core.client.HTTPRemotingConnection;
import org.jboss.ws.core.client.RemotingConnection;
import org.jboss.ws.core.client.SOAPRemotingConnection;
@@ -209,12 +210,12 @@
MessageContextAssociation.pushMessageContext(msgContext);
msgContext.setEndpointMetaData(epMetaData);
msgContext.setSOAPMessage(reqMsg);
+ msgContext.putAll(reqContext);
// The contents of the request context are used to initialize the message context
(see section 9.4.1)
// prior to invoking any handlers (see chapter 9) for the outbound message. Each
property within the
// request context is copied to the message context with a scope of HANDLER.
msgContext.put(MessageContextJAXWS.MESSAGE_OUTBOUND_PROPERTY, Boolean.TRUE);
- msgContext.putAll(reqContext);
QName portName = epMetaData.getPortName();
try
@@ -230,7 +231,9 @@
MessageAbstraction resMsg = null;
if (handlerPass)
{
- resMsg = getRemotingConnection().invoke(reqMsg, targetAddress, false);
+ Map<String, Object> callProps = new HashMap<String,
Object>(getRequestContext());
+ EndpointInfo epInfo = new EndpointInfo(epMetaData, targetAddress,
callProps);
+ resMsg = getRemotingConnection().invoke(reqMsg, epInfo, false);
// Call the response handler chain, removing the fault type entry will not
call handleFault for that chain
handlerPass = callResponseHandlerChain(portName, handlerType[2]);
Modified:
stack/native/branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/wssecurity/SimpleDispatchTestCase.java
===================================================================
---
stack/native/branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/wssecurity/SimpleDispatchTestCase.java 2007-10-09
08:23:00 UTC (rev 4699)
+++
stack/native/branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/wssecurity/SimpleDispatchTestCase.java 2007-10-09
10:03:27 UTC (rev 4700)
@@ -37,8 +37,11 @@
import junit.framework.Test;
import org.jboss.ws.core.ConfigProvider;
+import org.jboss.wsf.common.DOMUtils;
+import org.jboss.wsf.common.DOMWriter;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestSetup;
+import org.w3c.dom.Element;
/**
* WS-Security with JAX-WS Dispatch
@@ -96,6 +99,11 @@
reqContext.put(BindingProvider.PASSWORD_PROPERTY, "thefrog");
String payload = "<ns1:getUsernameToken
xmlns:ns1='http://org.jboss.ws/samples/wssecurity'/>";
- dispatch.invoke(new StreamSource(new StringReader(payload)));
+ Source retObj = (Source)dispatch.invoke(new StreamSource(new
StringReader(payload)));
+
+ Element docElement = DOMUtils.sourceToElement(retObj);
+ Element retElement = DOMUtils.getFirstChildElement(docElement);
+ String retPayload = DOMWriter.printNode(retElement, false);
+ assertEquals("<return>kermit</return>", retPayload);
}
}
\ No newline at end of file
Show replies by date