JBossWS SVN: r9482 - in stack/native/branches/jbossws-native-2.0.1.SP2_CP05_JBPAPP-1747: src/main/java/org/jboss/ws/core and 6 other directories.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2009-03-04 07:56:38 -0500 (Wed, 04 Mar 2009)
New Revision: 9482
Added:
stack/native/branches/jbossws-native-2.0.1.SP2_CP05_JBPAPP-1747/src/test/java/org/jboss/test/ws/jaxws/samples/wssecurity/SimpleDispatchTestCase.java
Modified:
stack/native/branches/jbossws-native-2.0.1.SP2_CP05_JBPAPP-1747/.classpath
stack/native/branches/jbossws-native-2.0.1.SP2_CP05_JBPAPP-1747/src/main/java/org/jboss/ws/core/ConfigProvider.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP05_JBPAPP-1747/src/main/java/org/jboss/ws/core/StubExt.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP05_JBPAPP-1747/src/main/java/org/jboss/ws/core/client/EndpointInfo.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP05_JBPAPP-1747/src/main/java/org/jboss/ws/core/jaxws/binding/BindingExt.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP05_JBPAPP-1747/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP05_JBPAPP-1747/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP05_JBPAPP-1747/src/main/java/org/jboss/ws/extensions/security/WSSecurityDispatcher.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP05_JBPAPP-1747/src/main/java/org/jboss/ws/metadata/umdm/ClientEndpointMetaData.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP05_JBPAPP-1747/version.properties
Log:
[JBPAPP-1747] Collection of Handler fixes.
Modified: stack/native/branches/jbossws-native-2.0.1.SP2_CP05_JBPAPP-1747/.classpath
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP05_JBPAPP-1747/.classpath 2009-03-04 12:52:02 UTC (rev 9481)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP05_JBPAPP-1747/.classpath 2009-03-04 12:56:38 UTC (rev 9482)
@@ -12,6 +12,7 @@
<classpathentry kind="lib" path="thirdparty/jaxb-impl.jar"/>
<classpathentry kind="lib" path="thirdparty/jaxb-xjc.jar"/>
<classpathentry kind="lib" path="thirdparty/jboss-dependency.jar"/>
+ <classpathentry kind="lib" path="thirdparty/jboss-common-core.jar"/>
<classpathentry kind="lib" path="thirdparty/jboss-j2ee.jar"/>
<classpathentry kind="lib" path="thirdparty/jboss-logging-spi.jar"/>
<classpathentry kind="lib" path="thirdparty/jboss-microcontainer.jar"/>
Modified: stack/native/branches/jbossws-native-2.0.1.SP2_CP05_JBPAPP-1747/src/main/java/org/jboss/ws/core/ConfigProvider.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP05_JBPAPP-1747/src/main/java/org/jboss/ws/core/ConfigProvider.java 2009-03-04 12:52:02 UTC (rev 9481)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP05_JBPAPP-1747/src/main/java/org/jboss/ws/core/ConfigProvider.java 2009-03-04 12:56:38 UTC (rev 9482)
@@ -50,4 +50,14 @@
* Set the port configuration name and file
*/
void setConfigName(String configName, String configFile);
+
+ /**
+ * Get the WS-Security configuration
+ */
+ String getSecurityConfig();
+
+ /**
+ * Set the WS-Security configuration
+ */
+ void setSecurityConfig(String securityConfig);
}
Modified: stack/native/branches/jbossws-native-2.0.1.SP2_CP05_JBPAPP-1747/src/main/java/org/jboss/ws/core/StubExt.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP05_JBPAPP-1747/src/main/java/org/jboss/ws/core/StubExt.java 2009-03-04 12:52:02 UTC (rev 9481)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP05_JBPAPP-1747/src/main/java/org/jboss/ws/core/StubExt.java 2009-03-04 12:56:38 UTC (rev 9482)
@@ -136,14 +136,4 @@
* Creates a new empty AttachmentPart object.
*/
AttachmentPart createAttachmentPart();
-
- /**
- * Get the WS-Security configuration
- */
- String getSecurityConfig();
-
- /**
- * Set the WS-Security configuration
- */
- void setSecurityConfig(String securityConfig);
}
Modified: stack/native/branches/jbossws-native-2.0.1.SP2_CP05_JBPAPP-1747/src/main/java/org/jboss/ws/core/client/EndpointInfo.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP05_JBPAPP-1747/src/main/java/org/jboss/ws/core/client/EndpointInfo.java 2009-03-04 12:52:02 UTC (rev 9481)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP05_JBPAPP-1747/src/main/java/org/jboss/ws/core/client/EndpointInfo.java 2009-03-04 12:56:38 UTC (rev 9482)
@@ -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/jbossws-native-2.0.1.SP2_CP05_JBPAPP-1747/src/main/java/org/jboss/ws/core/jaxws/binding/BindingExt.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP05_JBPAPP-1747/src/main/java/org/jboss/ws/core/jaxws/binding/BindingExt.java 2009-03-04 12:52:02 UTC (rev 9481)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP05_JBPAPP-1747/src/main/java/org/jboss/ws/core/jaxws/binding/BindingExt.java 2009-03-04 12:56:38 UTC (rev 9482)
@@ -21,6 +21,8 @@
*/
package org.jboss.ws.core.jaxws.binding;
+//$Id$
+
import java.util.List;
import javax.xml.ws.Binding;
@@ -28,7 +30,6 @@
import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
-// $Id$
/**
* Extension to JAXWS protocol bindings.
@@ -38,7 +39,9 @@
*/
public interface BindingExt extends Binding
{
+ /** Get the handler chain for a given type */
List<Handler> getHandlerChain(HandlerType handlerType);
-
+
+ /** Set the handler chain for a given type */
void setHandlerChain(List<Handler> handlerChain, HandlerType handlerType);
}
Modified: stack/native/branches/jbossws-native-2.0.1.SP2_CP05_JBPAPP-1747/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP05_JBPAPP-1747/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java 2009-03-04 12:52:02 UTC (rev 9481)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP05_JBPAPP-1747/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java 2009-03-04 12:56:38 UTC (rev 9482)
@@ -56,7 +56,6 @@
import org.jboss.ws.core.jaxws.handler.HandlerChainExecutor;
import org.jboss.ws.core.jaxws.handler.HandlerResolverImpl;
import org.jboss.ws.core.jaxws.handler.MessageContextJAXWS;
-import org.jboss.ws.core.jaxws.handler.PortInfoImpl;
import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.metadata.umdm.ClientEndpointMetaData;
@@ -76,7 +75,7 @@
{
// the associated endpoint meta data
- private final EndpointMetaData epMetaData;
+ private final ClientEndpointMetaData epMetaData;
private EndpointConfigMetaData epConfigMetaData;
// Keep a handle on the resolver so that updateConfig calls may revisit the associated chains
@@ -91,7 +90,7 @@
super(epMetaData);
setTargetEndpointAddress(epMetaData.getEndpointAddress());
- this.epMetaData = epMetaData;
+ this.epMetaData = (ClientEndpointMetaData)epMetaData;
this.epConfigMetaData = epMetaData.getEndpointConfigMetaData();
if (handlerResolver instanceof HandlerResolverImpl)
@@ -113,7 +112,7 @@
{
BindingExt binding = (BindingExt)getBindingProvider().getBinding();
- PortInfo portInfo = getPortInfo(epMetaData);
+ PortInfo portInfo = epMetaData.getPortInfo();
if (handlerResolver != null)
{
@@ -427,12 +426,4 @@
return Boolean.TRUE.equals(bool);
}
- private PortInfo getPortInfo(EndpointMetaData epMetaData)
- {
- QName serviceName = epMetaData.getServiceMetaData().getServiceName();
- QName portName = epMetaData.getPortName();
- String bindingID = epMetaData.getBindingId();
- PortInfo portInfo = new PortInfoImpl(serviceName, portName, bindingID);
- return portInfo;
- }
}
\ No newline at end of file
Modified: stack/native/branches/jbossws-native-2.0.1.SP2_CP05_JBPAPP-1747/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP05_JBPAPP-1747/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java 2009-03-04 12:52:02 UTC (rev 9481)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP05_JBPAPP-1747/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java 2009-03-04 12:56:38 UTC (rev 9482)
@@ -24,12 +24,18 @@
// $Id$
import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import javax.xml.bind.JAXBContext;
+import javax.xml.namespace.QName;
import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFactory;
+import javax.xml.soap.SOAPFault;
import javax.xml.soap.SOAPMessage;
import javax.xml.transform.Source;
import javax.xml.ws.AsyncHandler;
@@ -40,22 +46,39 @@
import javax.xml.ws.Response;
import javax.xml.ws.WebServiceException;
import javax.xml.ws.Service.Mode;
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.PortInfo;
import javax.xml.ws.http.HTTPBinding;
import javax.xml.ws.soap.SOAPFaultException;
import org.jboss.logging.Logger;
import org.jboss.util.NotImplementedException;
+import org.jboss.ws.WSException;
import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.ConfigProvider;
import org.jboss.ws.core.MessageAbstraction;
-import org.jboss.ws.core.ConfigProvider;
+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;
+import org.jboss.ws.core.jaxws.binding.BindingExt;
import org.jboss.ws.core.jaxws.binding.BindingProviderImpl;
+import org.jboss.ws.core.jaxws.handler.HandlerChainExecutor;
+import org.jboss.ws.core.jaxws.handler.HandlerResolverImpl;
+import org.jboss.ws.core.jaxws.handler.MessageContextJAXWS;
import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
+import org.jboss.ws.metadata.config.ConfigurationProvider;
+import org.jboss.ws.metadata.umdm.ClientEndpointMetaData;
+import org.jboss.ws.metadata.umdm.EndpointConfigMetaData;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
-import org.jboss.ws.metadata.config.ConfigurationProvider;
+import org.jboss.ws.metadata.umdm.ServiceMetaData;
+import org.jboss.ws.metadata.wsse.WSSecurityConfigFactory;
+import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
+import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
/**
* The Dispatch interface provides support for the dynamic invocation of a service endpoint operations.
@@ -64,22 +87,26 @@
* @author Thomas.Diesler(a)jboss.com
* @since 04-Jul-2006
*/
-public class DispatchImpl<T> implements Dispatch<T>
+public class DispatchImpl<T> implements Dispatch<T>, ConfigProvider
{
// provide logging
private final Logger log = Logger.getLogger(DispatchImpl.class);
private BindingProvider bindingProvider;
- private EndpointMetaData epMetaData;
+ private HandlerResolverImpl handlerResolver;
+ private ClientEndpointMetaData epMetaData;
private JAXBContext jaxbContext;
private ExecutorService executor;
+ private String securityConfig;
private Class type;
private Mode mode;
+ private Map<HandlerType, HandlerChainExecutor> executorMap = new HashMap<HandlerType, HandlerChainExecutor>();
+
public DispatchImpl(ExecutorService executor, EndpointMetaData epMetaData, Class<T> type, Mode mode)
{
this.bindingProvider = new BindingProviderImpl(epMetaData);
- this.epMetaData = epMetaData;
+ this.epMetaData = (ClientEndpointMetaData)epMetaData;
this.executor = executor;
this.type = type;
this.mode = mode;
@@ -89,7 +116,7 @@
public DispatchImpl(ExecutorService executor, EndpointMetaData epMetaData, JAXBContext jbc, Mode mode)
{
this.bindingProvider = new BindingProviderImpl(epMetaData);
- this.epMetaData = epMetaData;
+ this.epMetaData = (ClientEndpointMetaData)epMetaData;
this.executor = executor;
this.type = Object.class;
this.jaxbContext = jbc;
@@ -111,11 +138,50 @@
return retObj;
}
- private Object invokeInternal(Object obj, Map<String, Object> resContext) throws IOException
+ private Object invokeInternal(Object obj, Map<String, Object> resContext) throws Exception
{
- MessageAbstraction reqMsg = getRequestMessage(obj);
+ Object retObj = null;
+
+ BindingExt binding = (BindingExt)bindingProvider.getBinding();
+
+ String bindingID = binding.getBindingID();
+ if (bindingID.indexOf("soap") > 0)
+ {
+ // Init the handler chain
+ if (handlerResolver == null)
+ {
+ handlerResolver = new HandlerResolverImpl();
+ EndpointConfigMetaData ecmd = epMetaData.getEndpointConfigMetaData();
+ handlerResolver.initHandlerChain(ecmd, HandlerType.PRE, true);
+ handlerResolver.initHandlerChain(ecmd, HandlerType.ENDPOINT, true);
+ handlerResolver.initHandlerChain(ecmd, HandlerType.POST, true);
+
+ PortInfo portInfo = epMetaData.getPortInfo();
+ List<Handler> preChain = handlerResolver.getHandlerChain(portInfo, HandlerType.PRE);
+ List<Handler> epChain = handlerResolver.getHandlerChain(portInfo, HandlerType.ENDPOINT);
+ List<Handler> postChain = handlerResolver.getHandlerChain(portInfo, HandlerType.POST);
+
+ binding.setHandlerChain(preChain, HandlerType.PRE);
+ binding.setHandlerChain(epChain, HandlerType.ENDPOINT);
+ binding.setHandlerChain(postChain, HandlerType.POST);
+ }
+
+ retObj = invokeInternalSOAP(obj);
+ }
+ else
+ {
+ retObj = invokeInternalNonSOAP(obj);
+ }
+ return retObj;
+ }
+
+ private Object invokeInternalSOAP(Object obj) throws Exception
+ {
+ Object retObj = null;
+
+ SOAPMessageImpl reqMsg = (SOAPMessageImpl)getRequestMessage(obj);
String targetAddress = epMetaData.getEndpointAddress();
-
+
// R2744 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field
// with a quoted value equal to the value of the soapAction attribute of
// soapbind:operation, if present in the corresponding WSDL description.
@@ -124,22 +190,104 @@
// with a quoted empty string value, if in the corresponding WSDL description,
// the soapAction attribute of soapbind:operation is either not present, or
// present with an empty string as its value.
- String bindingID = bindingProvider.getBinding().getBindingID();
- if (bindingID.indexOf("soap") > 0)
+ String soapAction = null;
+ Map<String, Object> reqContext = getRequestContext();
+ Boolean useSOAPAction = (Boolean)reqContext.get(BindingProvider.SOAPACTION_USE_PROPERTY);
+ if (Boolean.TRUE.equals(useSOAPAction))
{
- String soapAction = null;
- Map<String, Object> reqContext = getRequestContext();
- Boolean useSOAPAction = (Boolean)reqContext.get(BindingProvider.SOAPACTION_USE_PROPERTY);
- if (Boolean.TRUE.equals(useSOAPAction))
+ soapAction = (String)reqContext.get(BindingProvider.SOAPACTION_URI_PROPERTY);
+ if (soapAction == null)
+ throw new IllegalStateException("Cannot obtain: " + BindingProvider.SOAPACTION_URI_PROPERTY);
+ }
+ MimeHeaders mimeHeaders = reqMsg.getMimeHeaders();
+ mimeHeaders.addHeader("SOAPAction", soapAction != null ? soapAction : "");
+
+ // Get the order of pre/post handlerchains
+ HandlerType[] handlerType = new HandlerType[] { HandlerType.PRE, HandlerType.ENDPOINT, HandlerType.POST };
+ HandlerType[] faultType = new HandlerType[] { HandlerType.PRE, HandlerType.ENDPOINT, HandlerType.POST };
+
+ // Associate a message context with the current thread
+ CommonMessageContext msgContext = new SOAPMessageContextJAXWS();
+ 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);
+
+ QName portName = epMetaData.getPortName();
+ try
+ {
+ // Call the request handlers
+ boolean handlerPass = callRequestHandlerChain(portName, handlerType[0]);
+ handlerPass = handlerPass && callRequestHandlerChain(portName, handlerType[1]);
+ handlerPass = handlerPass && callRequestHandlerChain(portName, handlerType[2]);
+
+ // Handlers might have replaced the message
+ reqMsg = (SOAPMessageImpl)msgContext.getSOAPMessage();
+
+ MessageAbstraction resMsg = null;
+ if (handlerPass)
{
- soapAction = (String)reqContext.get(BindingProvider.SOAPACTION_URI_PROPERTY);
- if (soapAction == null)
- throw new IllegalStateException("Cannot obtain: " + BindingProvider.SOAPACTION_URI_PROPERTY);
+ Map<String, Object> callProps = new HashMap<String, Object>(getRequestContext());
+ if (callProps.containsKey(BindingProvider.ENDPOINT_ADDRESS_PROPERTY)) {
+ targetAddress = (String) callProps.get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
+ }
+ EndpointInfo epInfo = new EndpointInfo(epMetaData, targetAddress, callProps);
+ resMsg = getRemotingConnection().invoke(reqMsg, epInfo, false);
+
+ //Pivot, switch to response ctx and save the response message there
+ msgContext = MessageContextJAXWS.processPivot(msgContext);
+ msgContext.setMessageAbstraction(resMsg);
+
+ // Call the response handler chain, removing the fault type entry will not call handleFault for that chain
+ handlerPass = callResponseHandlerChain(portName, handlerType[2]);
+ faultType[2] = null;
+ handlerPass = handlerPass && callResponseHandlerChain(portName, handlerType[1]);
+ faultType[1] = null;
+ handlerPass = handlerPass && callResponseHandlerChain(portName, handlerType[0]);
+ faultType[0] = null;
}
- MimeHeaders mimeHeaders = reqMsg.getMimeHeaders();
- mimeHeaders.addHeader("SOAPAction", soapAction != null ? soapAction : "");
+
+ if (handlerPass)
+ {
+ retObj = getReturnObject(resMsg);
+ }
}
-
+ catch (Exception ex)
+ {
+ msgContext = MessageContextJAXWS.processPivot(msgContext);
+ if (faultType[2] != null)
+ callFaultHandlerChain(portName, faultType[2], ex);
+ if (faultType[1] != null)
+ callFaultHandlerChain(portName, faultType[1], ex);
+ if (faultType[0] != null)
+ callFaultHandlerChain(portName, faultType[0], ex);
+
+ throw ex;
+ }
+ finally
+ {
+ closeHandlerChain(portName, handlerType[2]);
+ closeHandlerChain(portName, handlerType[1]);
+ closeHandlerChain(portName, handlerType[0]);
+
+ MessageContextAssociation.popMessageContext();
+ }
+ return retObj;
+ }
+
+ private Object invokeInternalNonSOAP(Object obj) throws IOException
+ {
+ MessageAbstraction reqMsg = getRequestMessage(obj);
+ String targetAddress = epMetaData.getEndpointAddress();
+ Map<String, Object> callProps = new HashMap<String, Object>(getRequestContext());
+ if (callProps.containsKey(BindingProvider.ENDPOINT_ADDRESS_PROPERTY)) {
+ targetAddress = (String) callProps.get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
+ }
MessageAbstraction resMsg = getRemotingConnection().invoke(reqMsg, targetAddress, false);
Object retObj = getReturnObject(resMsg);
return retObj;
@@ -260,7 +408,19 @@
{
// jaxws/api/javax_xml_ws/Dispatch/Client.java#invokeTestJAXBNull
if (obj == null)
- throw new SOAPFaultException("Request object cannot be null");
+ {
+ try
+ {
+ SOAPFactory factory = SOAPFactory.newInstance();
+ SOAPFault fault = factory.createFault("Request object cannot be null", new QName("http://org.jboss.ws", "Dispatch"));
+ fault.setFaultActor("client");
+ throw new SOAPFaultException(fault);
+ }
+ catch (SOAPException e)
+ {
+ //
+ }
+ }
String bindingID = bindingProvider.getBinding().getBindingID();
if (EndpointMetaData.SUPPORTED_BINDINGS.contains(bindingID) == false)
@@ -314,7 +474,7 @@
throw new IllegalArgumentException("Async response cannot be null");
if (payload == null)
throw new IllegalArgumentException("Async payload cannot be null");
-
+
this.response = response;
this.handler = handler;
this.payload = payload;
@@ -371,4 +531,85 @@
{
throw new NotImplementedException();
}
+
+ public String getConfigFile()
+ {
+ return epMetaData.getConfigFile();
+ }
+
+ public String getConfigName()
+ {
+ return epMetaData.getConfigName();
+ }
+
+ public void setConfigName(String configName)
+ {
+ epMetaData.setConfigName(configName);
+ }
+
+ public void setConfigName(String configName, String configFile)
+ {
+ epMetaData.setConfigName(configName, configFile);
+ }
+
+ public String getSecurityConfig()
+ {
+ return securityConfig;
+ }
+
+ public void setSecurityConfig(String securityConfig)
+ {
+ this.securityConfig = securityConfig;
+
+ if (securityConfig != null)
+ {
+ ServiceMetaData serviceMetaData = epMetaData.getServiceMetaData();
+ if (serviceMetaData.getSecurityConfiguration() == null)
+ {
+ try
+ {
+ WSSecurityConfigFactory wsseConfFactory = WSSecurityConfigFactory.newInstance();
+ UnifiedVirtualFile vfsRoot = serviceMetaData.getUnifiedMetaData().getRootFile();
+ WSSecurityConfiguration config = wsseConfFactory.createConfiguration(vfsRoot, securityConfig);
+ serviceMetaData.setSecurityConfiguration(config);
+ }
+ catch (IOException ex)
+ {
+ WSException.rethrow("Cannot set security config", ex);
+ }
+ }
+ }
+ }
+
+ private boolean callRequestHandlerChain(QName portName, HandlerType type)
+ {
+ BindingExt binding = (BindingExt)bindingProvider.getBinding();
+ HandlerChainExecutor executor = new HandlerChainExecutor(epMetaData, binding.getHandlerChain(type));
+ executorMap.put(type, executor);
+
+ MessageContext msgContext = (MessageContext)MessageContextAssociation.peekMessageContext();
+ return executor.handleMessage(msgContext);
+ }
+
+ private boolean callResponseHandlerChain(QName portName, HandlerType type)
+ {
+ MessageContext msgContext = (MessageContext)MessageContextAssociation.peekMessageContext();
+ HandlerChainExecutor executor = executorMap.get(type);
+ return (executor != null ? executor.handleMessage(msgContext) : true);
+ }
+
+ private boolean callFaultHandlerChain(QName portName, HandlerType type, Exception ex)
+ {
+ MessageContext msgContext = (MessageContext)MessageContextAssociation.peekMessageContext();
+ HandlerChainExecutor executor = executorMap.get(type);
+ return (executor != null ? executor.handleFault(msgContext, ex) : true);
+ }
+
+ private void closeHandlerChain(QName portName, HandlerType type)
+ {
+ MessageContext msgContext = (MessageContext)MessageContextAssociation.peekMessageContext();
+ HandlerChainExecutor executor = executorMap.get(type);
+ if (executor != null)
+ executor.close(msgContext);
+ }
}
Modified: stack/native/branches/jbossws-native-2.0.1.SP2_CP05_JBPAPP-1747/src/main/java/org/jboss/ws/extensions/security/WSSecurityDispatcher.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP05_JBPAPP-1747/src/main/java/org/jboss/ws/extensions/security/WSSecurityDispatcher.java 2009-03-04 12:52:02 UTC (rev 9481)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP05_JBPAPP-1747/src/main/java/org/jboss/ws/extensions/security/WSSecurityDispatcher.java 2009-03-04 12:56:38 UTC (rev 9482)
@@ -85,13 +85,13 @@
return newList;
}
- private static Config getConfig(WSSecurityConfiguration config, String portName, String operationName)
+ private static Config getConfig(WSSecurityConfiguration config, String portName, String opName)
{
Port port = config.getPorts().get(portName);
if (port == null)
return config.getDefaultConfig();
- Operation operation = port.getOperations().get(operationName);
+ Operation operation = port.getOperations().get(opName);
if (operation == null)
{
Config portConfig = port.getDefaultConfig();
@@ -132,8 +132,14 @@
opMetaData = soapMessage.getOperationMetaData(epMetaData);
}
- String operation = opMetaData.getQName().toString();
- String port = opMetaData.getEndpointMetaData().getPortName().getLocalPart();
+ String operation = null;
+ String port = null;
+ if (opMetaData != null)
+ {
+ operation = opMetaData.getQName().toString();
+ port = opMetaData.getEndpointMetaData().getPortName().getLocalPart();
+ }
+
if (hasRequirements(config, operation, port))
throw convertToFault(new InvalidSecurityHeaderException("This service requires <wsse:Security>, which is missing."));
@@ -161,8 +167,13 @@
opMetaData = soapMessage.getOperationMetaData(epMetaData);
}
- String operation = opMetaData.getQName().toString();
- String port = opMetaData.getEndpointMetaData().getPortName().getLocalPart();
+ String operation = null;
+ String port = null;
+ if (opMetaData != null)
+ {
+ operation = opMetaData.getQName().toString();
+ port = opMetaData.getEndpointMetaData().getPortName().getLocalPart();
+ }
List<OperationDescription<RequireOperation>> operations = buildRequireOperations(config, operation, port);
@@ -288,26 +299,29 @@
WSSecurityConfiguration config = getSecurityConfig(ctx);
SOAPMessageImpl soapMessage = (SOAPMessageImpl)ctx.getSOAPMessage();
+ EndpointMetaData epMetaData = ctx.getEndpointMetaData();
+ String port = epMetaData.getPortName().getLocalPart();
+
+ String opName = null;
OperationMetaData opMetaData = ctx.getOperationMetaData();
- String operation = opMetaData.getQName().toString();
- String port = opMetaData.getEndpointMetaData().getPortName().getLocalPart();
+ if (opMetaData != null)
+ opName = opMetaData.getQName().toString();
- Config operationConfig = getConfig(config, port, operation);
+ Config opConfig = getConfig(config, port, opName);
+ log.debug("WS-Security config: " + opConfig);
- log.debug("WS-Security config: " + operationConfig);
-
// Nothing to process
- if (operationConfig == null)
+ if (opConfig == null)
return;
ArrayList<OperationDescription<EncodingOperation>> operations = new ArrayList<OperationDescription<EncodingOperation>>();
- Timestamp timestamp = operationConfig.getTimestamp();
+ Timestamp timestamp = opConfig.getTimestamp();
if (timestamp != null)
{
operations.add(new OperationDescription<EncodingOperation>(TimestampOperation.class, null, null, timestamp.getTtl(), null));
}
- if (operationConfig.getUsername() != null)
+ if (opConfig.getUsername() != null)
{
Object user = ctx.get(Stub.USERNAME_PROPERTY);
Object pass = ctx.get(Stub.PASSWORD_PROPERTY);
@@ -325,7 +339,7 @@
}
}
- Sign sign = operationConfig.getSign();
+ Sign sign = opConfig.getSign();
if (sign != null)
{
List<Target> targets = convertTargets(sign.getTargets());
@@ -341,7 +355,7 @@
operations.add(new OperationDescription<EncodingOperation>(SignatureOperation.class, targets, sign.getAlias(), null, null));
}
- Encrypt encrypt = operationConfig.getEncrypt();
+ Encrypt encrypt = opConfig.getEncrypt();
if (encrypt != null)
{
List<Target> targets = convertTargets(encrypt.getTargets());
Modified: stack/native/branches/jbossws-native-2.0.1.SP2_CP05_JBPAPP-1747/src/main/java/org/jboss/ws/metadata/umdm/ClientEndpointMetaData.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP05_JBPAPP-1747/src/main/java/org/jboss/ws/metadata/umdm/ClientEndpointMetaData.java 2009-03-04 12:52:02 UTC (rev 9481)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP05_JBPAPP-1747/src/main/java/org/jboss/ws/metadata/umdm/ClientEndpointMetaData.java 2009-03-04 12:56:38 UTC (rev 9482)
@@ -24,7 +24,9 @@
// $Id$
import javax.xml.namespace.QName;
+import javax.xml.ws.handler.PortInfo;
+import org.jboss.ws.core.jaxws.handler.PortInfoImpl;
import org.jboss.ws.metadata.config.ConfigurationProvider;
import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
@@ -64,11 +66,20 @@
this.endpointAddress = endpointAddress;
}
+ public PortInfo getPortInfo()
+ {
+ QName serviceName = getServiceMetaData().getServiceName();
+ QName portName = getPortName();
+ String bindingID = getBindingId();
+ PortInfo portInfo = new PortInfoImpl(serviceName, portName, bindingID);
+ return portInfo;
+ }
+
public EndpointConfigMetaData createEndpointConfigMetaData(String configName, String configFile)
{
return super.createEndpointConfigMetaData(configName, configFile);
}
-
+
public String toString()
{
StringBuilder buffer = new StringBuilder("\nClientEndpointMetaData:");
Copied: stack/native/branches/jbossws-native-2.0.1.SP2_CP05_JBPAPP-1747/src/test/java/org/jboss/test/ws/jaxws/samples/wssecurity/SimpleDispatchTestCase.java (from rev 9479, stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/samples/wssecurity/SimpleDispatchTestCase.java)
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP05_JBPAPP-1747/src/test/java/org/jboss/test/ws/jaxws/samples/wssecurity/SimpleDispatchTestCase.java (rev 0)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP05_JBPAPP-1747/src/test/java/org/jboss/test/ws/jaxws/samples/wssecurity/SimpleDispatchTestCase.java 2009-03-04 12:56:38 UTC (rev 9482)
@@ -0,0 +1,138 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.samples.wssecurity;
+
+import java.io.File;
+import java.io.StringReader;
+import java.net.URL;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.Service;
+import javax.xml.ws.Service.Mode;
+
+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
+ *
+ * http://jira.jboss.org/jira/browse/JBWS-1817
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @author alessio.soldano(a)jboss.com
+ * @since 02-Oct-2007
+ */
+public class SimpleDispatchTestCase extends JBossWSTest
+{
+ private static Dispatch usernameDispatch;
+ private static Dispatch encryptDispatch;
+
+ public static Test suite() throws Exception
+ {
+ return new JBossWSTestSetup(SimpleDispatchTestCase.class, "jaxws-samples-wssecurity-username.war jaxws-samples-wssecurity-encrypt.war");
+ }
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ if (usernameDispatch == null)
+ {
+ URL wsdlURL = new File("resources/jaxws/samples/wssecurity/simple-username/META-INF/wsdl/UsernameService.wsdl").toURL();
+ URL securityURL = new File("resources/jaxws/samples/wssecurity/simple-username/META-INF/jboss-wsse-client.xml").toURL();
+ QName serviceName = new QName("http://org.jboss.ws/samples/wssecurity", "UsernameService");
+ QName portName = new QName("http://org.jboss.ws/samples/wssecurity", "UsernameEndpointPort");
+
+ Service service = Service.create(wsdlURL, serviceName);
+ usernameDispatch = service.createDispatch(portName, Source.class, Mode.PAYLOAD);
+
+ ((ConfigProvider)usernameDispatch).setSecurityConfig(securityURL.toExternalForm());
+ ((ConfigProvider)usernameDispatch).setConfigName("Standard WSSecurity Client");
+ }
+ if (encryptDispatch == null)
+ {
+ URL wsdlURL = new File("wsprovide/resources/jaxws/samples/wssecurity/HelloService.wsdl").toURL();
+ URL securityURL = new File("resources/jaxws/samples/wssecurity/simple-encrypt/META-INF/jboss-wsse-client.xml").toURL();
+ QName serviceName = new QName("http://org.jboss.ws/samples/wssecurity", "HelloService");
+ QName portName = new QName("http://org.jboss.ws/samples/wssecurity", "HelloPort");
+
+ Service service = Service.create(wsdlURL, serviceName);
+ encryptDispatch = service.createDispatch(portName, Source.class, Mode.PAYLOAD);
+
+ ((ConfigProvider)encryptDispatch).setSecurityConfig(securityURL.toExternalForm());
+ ((ConfigProvider)encryptDispatch).setConfigName("Standard WSSecurity Client");
+
+ encryptDispatch.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+ "http://" + getServerHost() + ":8080/jaxws-samples-wssecurity-encrypt");
+ }
+ }
+
+ public void testUsernameTokenNegative() throws Exception
+ {
+ try
+ {
+ String payload = "<ns1:getUsernameToken xmlns:ns1='http://org.jboss.ws/samples/wssecurity'/>";
+ usernameDispatch.invoke(new StreamSource(new StringReader(payload)));
+ fail("Server should respond with [401] - Unauthorized");
+ }
+ catch (Exception ex)
+ {
+ // this should be ok
+ }
+ }
+
+ public void testUsernameToken() throws Exception
+ {
+ Map<String, Object> reqContext = usernameDispatch.getRequestContext();
+ reqContext.put(BindingProvider.USERNAME_PROPERTY, "kermit");
+ reqContext.put(BindingProvider.PASSWORD_PROPERTY, "thefrog");
+
+ String payload = "<ns1:getUsernameToken xmlns:ns1='http://org.jboss.ws/samples/wssecurity'/>";
+ Source retObj = (Source)usernameDispatch.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);
+ }
+
+ public void testEncrypt() throws Exception
+ {
+ String payload = "<ns1:echoUserType xmlns:ns1='http://org.jboss.ws/samples/wssecurity'><user><msg>Kermit</msg></user></ns1:echoUserType>";
+ Source retObj = (Source)encryptDispatch.invoke(new StreamSource(new StringReader(payload)));
+
+ Element docElement = DOMUtils.sourceToElement(retObj);
+ Element retElement = DOMUtils.getFirstChildElement(docElement);
+ String retPayload = DOMWriter.printNode(retElement, false);
+ assertEquals("<return><msg>Kermit</msg></return>", retPayload);
+ }
+}
\ No newline at end of file
Modified: stack/native/branches/jbossws-native-2.0.1.SP2_CP05_JBPAPP-1747/version.properties
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP05_JBPAPP-1747/version.properties 2009-03-04 12:52:02 UTC (rev 9481)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP05_JBPAPP-1747/version.properties 2009-03-04 12:56:38 UTC (rev 9482)
@@ -5,8 +5,8 @@
specification.vendor=JBoss (http://www.jboss.org)
specification.version=jbossws-2.0
-version.id=2.0.1.SP2_CP05
-repository.id=2.0.1.SP2_CP05
+version.id=2.0.1.SP2_CP05_JBPAPP-1747
+repository.id=2.0.1.SP2_CP05_JBPAPP-1747
implementation.title=JBoss Web Services - Native
implementation.url=http://www.jboss.org/products/jbossws
15 years, 2 months
JBossWS SVN: r9481 - in stack/native/trunk: modules/core and 5 other directories.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2009-03-04 07:52:02 -0500 (Wed, 04 Mar 2009)
New Revision: 9481
Removed:
stack/native/trunk/modules/testsuite/test-excludes-jboss424.txt
Modified:
stack/native/trunk/build.xml
stack/native/trunk/modules/core/pom.xml
stack/native/trunk/modules/core/src/main/scripts/antrun-beans-config.xml
stack/native/trunk/modules/management/pom.xml
stack/native/trunk/modules/testsuite/pom.xml
stack/native/trunk/pom.xml
stack/native/trunk/profiles.xml.example
stack/native/trunk/src/main/distro/ant.properties.example
stack/native/trunk/src/main/distro/build-deploy.xml
stack/native/trunk/src/main/distro/build-setup.xml
stack/native/trunk/src/main/distro/build.xml
stack/native/trunk/src/main/scripts/assembly-deploy-artifacts.xml
Log:
[JBWS-2568] Removing 4.2.4 support
Modified: stack/native/trunk/build.xml
===================================================================
--- stack/native/trunk/build.xml 2009-03-04 12:00:54 UTC (rev 9480)
+++ stack/native/trunk/build.xml 2009-03-04 12:52:02 UTC (rev 9481)
@@ -54,9 +54,6 @@
<condition property="jboss423.home" value="${profiles.profile.properties.jboss423.home}">
<isset property="profiles.profile.properties.jboss423.home"/>
</condition>
- <condition property="jboss424.home" value="${profiles.profile.properties.jboss424.home}">
- <isset property="profiles.profile.properties.jboss424.home"/>
- </condition>
<condition property="jboss500.home" value="${profiles.profile.properties.jboss500.home}">
<isset property="profiles.profile.properties.jboss500.home"/>
</condition>
@@ -73,7 +70,6 @@
<!-- Loads the properties from the user profile -->
<xmlproperty file="${basedir}/profiles.xml" keeproot="false"/>
<property name="jboss423.home" value="${profiles.profile.properties.jboss423.home}"/>
- <property name="jboss424.home" value="${profiles.profile.properties.jboss424.home}"/>
<property name="jboss500.home" value="${profiles.profile.properties.jboss500.home}"/>
<property name="jboss501.home" value="${profiles.profile.properties.jboss501.home}"/>
<property name="jboss510.home" value="${profiles.profile.properties.jboss510.home}"/>
@@ -81,7 +77,6 @@
<echo/>
<echo message="jboss423.home=${jboss423.home}"/>
- <echo message="jboss424.home=${jboss424.home}"/>
<echo message="jboss500.home=${jboss500.home}"/>
<echo message="jboss501.home=${jboss501.home}"/>
<echo message="jboss510.home=${jboss510.home}"/>
Modified: stack/native/trunk/modules/core/pom.xml
===================================================================
--- stack/native/trunk/modules/core/pom.xml 2009-03-04 12:00:54 UTC (rev 9480)
+++ stack/native/trunk/modules/core/pom.xml 2009-03-04 12:52:02 UTC (rev 9481)
@@ -201,14 +201,6 @@
</artifactItem>
<artifactItem>
<groupId>org.jboss.ws</groupId>
- <artifactId>jbossws-jboss424x</artifactId>
- <version>${jbossws.jboss424.version}</version>
- <classifier>resources</classifier>
- <type>zip</type>
- <outputDirectory>${project.build.directory}/resources/jbossws-jboss424</outputDirectory>
- </artifactItem>
- <artifactItem>
- <groupId>org.jboss.ws</groupId>
<artifactId>jbossws-jboss500</artifactId>
<version>${jbossws.jboss500.version}</version>
<classifier>resources</classifier>
Modified: stack/native/trunk/modules/core/src/main/scripts/antrun-beans-config.xml
===================================================================
--- stack/native/trunk/modules/core/src/main/scripts/antrun-beans-config.xml 2009-03-04 12:00:54 UTC (rev 9480)
+++ stack/native/trunk/modules/core/src/main/scripts/antrun-beans-config.xml 2009-03-04 12:52:02 UTC (rev 9481)
@@ -39,18 +39,6 @@
</deployment> </footer>
</concat>
- <!-- Concat jbossws-jboss424/jbossws.beans -->
- <echo message="Concat jbossws-jboss424/jbossws.beans"/>
- <concat destfile="${project.build.resources.directory}/jbossws-jboss424/jbossws.beans/META-INF/jboss-beans.xml">
- <header trimleading="yes">
- <deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
- xmlns="urn:jboss:bean-deployer"> </header>
- <fileset file="${project.resources.directory}/jbossws-native-config.xml"/>
- <fileset file="${project.build.resources.directory}/jbossws-jboss424/jbossws-jboss42-config.xml"/>
- <footer trimleading="yes">
- </deployment> </footer>
- </concat>
-
<!-- Concat jbossws-jboss500/jbossws.beans -->
<echo message="Concat jbossws-jboss500/jbossws.beans"/>
<concat destfile="${project.build.resources.directory}/jbossws-jboss500/jbossws.beans/META-INF/jboss-beans.xml">
Modified: stack/native/trunk/modules/management/pom.xml
===================================================================
--- stack/native/trunk/modules/management/pom.xml 2009-03-04 12:00:54 UTC (rev 9480)
+++ stack/native/trunk/modules/management/pom.xml 2009-03-04 12:52:02 UTC (rev 9481)
@@ -37,11 +37,6 @@
</dependency>
<dependency>
<groupId>org.jboss.ws</groupId>
- <artifactId>jbossws-jboss424x</artifactId>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.ws</groupId>
<artifactId>jbossws-jboss500</artifactId>
<scope>runtime</scope>
</dependency>
Modified: stack/native/trunk/modules/testsuite/pom.xml
===================================================================
--- stack/native/trunk/modules/testsuite/pom.xml 2009-03-04 12:00:54 UTC (rev 9480)
+++ stack/native/trunk/modules/testsuite/pom.xml 2009-03-04 12:52:02 UTC (rev 9481)
@@ -320,46 +320,6 @@
</profile>
<!--
- Name: jboss424
- Descr: JBoss-4.2.4 specific options
- -->
- <profile>
- <id>jboss424</id>
- <properties>
- <jboss.version>4.2.4-SNAPSHOT</jboss.version>
- <jbossws.integration.target>jboss424</jbossws.integration.target>
- </properties>
- <dependencies>
- <dependency>
- <groupId>org.jboss.client</groupId>
- <artifactId>jbossall-client</artifactId>
- <version>${jboss.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.ws</groupId>
- <artifactId>jbossws-jboss424x</artifactId>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <!-- http://jira.codehaus.org/browse/MCOMPILER-72 -->
- <testExcludeFile>../test-excludes-jboss424.txt</testExcludeFile>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <argLine>${surefire.jvm.args} -Djava.endorsed.dirs=${jboss424.home}/lib/endorsed</argLine>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
-
- <!--
Name: jboss500
Descr: JBoss-5.0.0 specific options
-->
Deleted: stack/native/trunk/modules/testsuite/test-excludes-jboss424.txt
===================================================================
--- stack/native/trunk/modules/testsuite/test-excludes-jboss424.txt 2009-03-04 12:00:54 UTC (rev 9480)
+++ stack/native/trunk/modules/testsuite/test-excludes-jboss424.txt 2009-03-04 12:52:02 UTC (rev 9481)
@@ -1,30 +0,0 @@
-# EJB3/Injection excludes
-org/jboss/test/ws/jaxws/samples/webserviceref/**
-org/jboss/test/ws/jaxws/webserviceref/**
-org/jboss/test/ws/jaxws/enventry/EnvEntryServletTestCase.*
-
-# Exclude endpoints with AS5 @SecurityDomain
-org/jboss/test/ws/jaxws/samples/securityDomain/SecureEndpointAS5Impl.*
-org/jboss/test/ws/jaxws/samples/news/SecureNewspaperSWAAS5Endpoint.*
-org/jboss/test/ws/jaxws/samples/news/SecureNewspaperMTOMAS5Endpoint.*
-
-# UsernameTokenHTTPSTestCase requires keystore & trustore in jboss-web tomcat configuration
-org/jboss/test/ws/interop/nov2007/wsse/UsernameTokenHTTPSTestCase.*
-
-# [JBWS-981] @WebContext defined virtual hosts only being fixed for JBoss 5
-org/jboss/test/ws/jaxws/jbws981/JBWS981TestCase.*
-
-# [JBWS-2258] Fix EnumTestCase (fixed in AS trunk)
-org/jboss/test/ws/tools/enums/EnumTestCase.*
-
-# [JBWS-2240] PortComponent from jboss.xml descriptor is not parsed
-org/jboss/test/ws/jaxws/jbws2241/**
-
-# [JBWS-2307] Stub properties not propagated through service-ref (fixed in AS 5.x and above)
-org/jboss/test/ws/jaxws/jbws2307/JBWS2307TestCase.*
-
-# [JBWS-2491] Enable JAXWS 2.1 WebServiceContext methods
-org/jboss/test/ws/jaxws/jbws2257/**
-
-# [JBWS-2527] BeanFactory not initialized or already closed (fixed on AS 5.x and above)
-org/jboss/test/ws/jaxws/jbws2527/**
Modified: stack/native/trunk/pom.xml
===================================================================
--- stack/native/trunk/pom.xml 2009-03-04 12:00:54 UTC (rev 9480)
+++ stack/native/trunk/pom.xml 2009-03-04 12:52:02 UTC (rev 9481)
@@ -52,7 +52,6 @@
<jbossws.framework.version>3.1.1-SNAPSHOT</jbossws.framework.version>
<jbossws.spi.version>1.1.1-SNAPSHOT</jbossws.spi.version>
<jbossws.jboss423.version>3.1.0.GA</jbossws.jboss423.version>
- <jbossws.jboss424.version>3.1.0.GA</jbossws.jboss424.version>
<jbossws.jboss500.version>3.1.0.GA</jbossws.jboss500.version>
<jbossws.jboss501.version>3.1.0.GA</jbossws.jboss501.version>
<!-- [JBWS-2505] -->
@@ -124,18 +123,6 @@
</dependency>
<dependency>
<groupId>org.jboss.ws</groupId>
- <artifactId>jbossws-jboss424x</artifactId>
- <version>${jbossws.jboss424.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.ws</groupId>
- <artifactId>jbossws-jboss424x</artifactId>
- <version>${jbossws.jboss424.version}</version>
- <classifier>resources</classifier>
- <type>zip</type>
- </dependency>
- <dependency>
- <groupId>org.jboss.ws</groupId>
<artifactId>jbossws-jboss500</artifactId>
<version>${jbossws.jboss500.version}</version>
</dependency>
@@ -483,18 +470,6 @@
</profile>
<!--
- Name: jboss424
- Descr: JBoss-4.2.4 specific options
- -->
- <profile>
- <id>jboss424</id>
- <properties>
- <jbossws.integration.target>jboss424</jbossws.integration.target>
- <jboss.home>${jboss424.home}</jboss.home>
- </properties>
- </profile>
-
- <!--
Name: jboss500
Descr: JBoss-5.0.0 specific options
-->
Modified: stack/native/trunk/profiles.xml.example
===================================================================
--- stack/native/trunk/profiles.xml.example 2009-03-04 12:00:54 UTC (rev 9480)
+++ stack/native/trunk/profiles.xml.example 2009-03-04 12:52:02 UTC (rev 9481)
@@ -13,7 +13,6 @@
<properties>
<java.jdk15.home>/usr/java/jdk1.5</java.jdk15.home>
<jboss423.home>/home/opalka/svn/jbossas/tags/JBoss_4_2_3_GA/build/output/jboss-4.2.3.GA</jboss423.home>
- <jboss424.home>/home/opalka/svn/jbossas/branches/Branch_4_2/build/output/jboss-4.2.4.GA</jboss424.home>
<jboss500.home>/home/opalka/svn/jbossas/tags/JBoss_5_0_0_GA/build/output/jboss-5.0.0.GA</jboss500.home>
<jboss501.home>/home/opalka/svn/jbossas/branches/Branch_5_0/build/output/jboss-5.0.1.GA</jboss501.home>
<jboss510.home>/home/opalka/svn/jbossas/branches/Branch_5_x/build/output/jboss-5.1.0.Beta1</jboss510.home>
Modified: stack/native/trunk/src/main/distro/ant.properties.example
===================================================================
--- stack/native/trunk/src/main/distro/ant.properties.example 2009-03-04 12:00:54 UTC (rev 9480)
+++ stack/native/trunk/src/main/distro/ant.properties.example 2009-03-04 12:52:02 UTC (rev 9481)
@@ -4,13 +4,12 @@
# Optional JBoss Home
jboss423.home=(a)jboss423.home@
-jboss424.home=(a)jboss424.home@
jboss500.home=(a)jboss500.home@
jboss501.home=(a)jboss501.home@
jboss510.home=(a)jboss510.home@
jboss600.home=(a)jboss600.home@
-# The JBoss server under test. This can be [jboss423|jboss424|jboss500|jboss501|jboss510|jboss600]
+# The JBoss server under test. This can be [jboss423|jboss500|jboss501|jboss510|jboss600]
jbossws.integration.target=jboss500
# The JBoss settings
Modified: stack/native/trunk/src/main/distro/build-deploy.xml
===================================================================
--- stack/native/trunk/src/main/distro/build-deploy.xml 2009-03-04 12:00:54 UTC (rev 9480)
+++ stack/native/trunk/src/main/distro/build-deploy.xml 2009-03-04 12:52:02 UTC (rev 9481)
@@ -49,28 +49,6 @@
</target>
<!-- ================================================================== -->
- <!-- Deployment JBoss424 -->
- <!-- ================================================================== -->
-
- <target name="target-jboss424">
- <property name="jbossws.integration.target" value="jboss424"/>
- <echo message="jbossws.integration.target=${jbossws.integration.target}" file="${target.properties.file}"/>
- </target>
-
- <target name="deploy-jboss424" depends="undeploy-jboss424,deploy-structure-jboss42" description="Deploy jbossws to jboss424">
- <fail message="Not available: ${jboss424.available.file}" unless="jboss424.available"/>
- <copy todir="${jboss424.home}" overwrite="true">
- <fileset dir="${deploy.structure}"/>
- </copy>
- <chmod dir="${jboss424.home}/bin" perm="+x" includes="*.sh"/>
- </target>
-
- <target name="undeploy-jboss424" depends="target-jboss424,init" description="Remove jbossws from jboss424">
- <fail message="Not available: ${jboss424.available.file}" unless="jboss424.available"/>
- <macro-undeploy-jbossws42 targetdir="${jboss424.server.deploy}/jbossws.sar" defaultconf="${jbossws.as4.default.deploy.conf}"/>
- </target>
-
- <!-- ================================================================== -->
<!-- Prepare Deployment Structure JBoss-5.0.x -->
<!-- ================================================================== -->
Modified: stack/native/trunk/src/main/distro/build-setup.xml
===================================================================
--- stack/native/trunk/src/main/distro/build-setup.xml 2009-03-04 12:00:54 UTC (rev 9480)
+++ stack/native/trunk/src/main/distro/build-setup.xml 2009-03-04 12:52:02 UTC (rev 9481)
@@ -27,12 +27,6 @@
<property name="jboss423.server.lib" value="${jboss423.server}/lib"/>
<property name="jboss423.server.deploy" value="${jboss423.server}/deploy"/>
- <property name="jboss424.lib" value="${jboss424.home}/lib"/>
- <property name="jboss424.client" value="${jboss424.home}/client"/>
- <property name="jboss424.server" value="${jboss424.home}/server/${jboss.server.instance}"/>
- <property name="jboss424.server.lib" value="${jboss424.server}/lib"/>
- <property name="jboss424.server.deploy" value="${jboss424.server}/deploy"/>
-
<property name="jboss500.lib" value="${jboss500.home}/lib"/>
<property name="jboss500.client" value="${jboss500.home}/client"/>
<property name="jboss500.server" value="${jboss500.home}/server/${jboss.server.instance}"/>
@@ -62,14 +56,12 @@
<property name="jboss600.server.deployers" value="${jboss600.server}/deployers"/>
<property name="jboss423.available.file" value="${jboss423.client}/jboss-client.jar"/>
- <property name="jboss424.available.file" value="${jboss424.client}/jboss-client.jar"/>
<property name="jboss500.available.file" value="${jboss500.client}/jboss-client.jar"/>
<property name="jboss501.available.file" value="${jboss501.client}/jboss-client.jar"/>
<property name="jboss510.available.file" value="${jboss510.client}/jboss-client.jar"/>
<property name="jboss600.available.file" value="${jboss600.client}/jboss-client.jar"/>
<available property="jboss423.available" file="${jboss423.available.file}"/>
- <available property="jboss424.available" file="${jboss424.available.file}"/>
<available property="jboss500.available" file="${jboss500.available.file}"/>
<available property="jboss501.available" file="${jboss501.available.file}"/>
<available property="jboss510.available" file="${jboss510.available.file}"/>
Modified: stack/native/trunk/src/main/distro/build.xml
===================================================================
--- stack/native/trunk/src/main/distro/build.xml 2009-03-04 12:00:54 UTC (rev 9480)
+++ stack/native/trunk/src/main/distro/build.xml 2009-03-04 12:52:02 UTC (rev 9481)
@@ -49,7 +49,6 @@
<condition property="jbossws.integration.jboss42" value="true">
<or>
<equals arg1="${jbossws.integration.target}" arg2="jboss423"/>
- <equals arg1="${jbossws.integration.target}" arg2="jboss424"/>
</or>
</condition>
<condition property="jbossws.integration.jboss50" value="true">
Modified: stack/native/trunk/src/main/scripts/assembly-deploy-artifacts.xml
===================================================================
--- stack/native/trunk/src/main/scripts/assembly-deploy-artifacts.xml 2009-03-04 12:00:54 UTC (rev 9480)
+++ stack/native/trunk/src/main/scripts/assembly-deploy-artifacts.xml 2009-03-04 12:52:02 UTC (rev 9481)
@@ -91,16 +91,6 @@
</dependencySet>
<dependencySet>
<outputDirectory>lib</outputDirectory>
- <outputFileNameMapping>jbossws-jboss424.${module.extension}</outputFileNameMapping>
- <useStrictFiltering>true</useStrictFiltering>
- <scope>runtime</scope>
- <unpack>false</unpack>
- <includes>
- <include>org.jboss.ws:jbossws-jboss424x:jar</include>
- </includes>
- </dependencySet>
- <dependencySet>
- <outputDirectory>lib</outputDirectory>
<outputFileNameMapping>jbossws-jboss501.${module.extension}</outputFileNameMapping>
<useStrictFiltering>true</useStrictFiltering>
<scope>runtime</scope>
15 years, 2 months
JBossWS SVN: r9480 - stack/native/branches/dlofthouse.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2009-03-04 07:00:54 -0500 (Wed, 04 Mar 2009)
New Revision: 9480
Removed:
stack/native/branches/dlofthouse/JBPAPP-1746/
Log:
Branch no longer required.
15 years, 2 months
JBossWS SVN: r9479 - in stack/native/branches/jbossws-native-2.0.1.SP2_CP: src/main/java/org/jboss/ws/core and 6 other directories.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2009-03-04 06:48:54 -0500 (Wed, 04 Mar 2009)
New Revision: 9479
Added:
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/samples/wssecurity/SimpleDispatchTestCase.java
Modified:
stack/native/branches/jbossws-native-2.0.1.SP2_CP/.classpath
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/ConfigProvider.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/StubExt.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/client/EndpointInfo.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/jaxws/binding/BindingExt.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/extensions/security/WSSecurityDispatcher.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/metadata/umdm/ClientEndpointMetaData.java
Log:
[JBPAPP-1746] Handler Chains missed for Dispatch clients.
Modified: stack/native/branches/jbossws-native-2.0.1.SP2_CP/.classpath
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/.classpath 2009-03-03 18:52:16 UTC (rev 9478)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/.classpath 2009-03-04 11:48:54 UTC (rev 9479)
@@ -12,6 +12,7 @@
<classpathentry kind="lib" path="thirdparty/jaxb-impl.jar"/>
<classpathentry kind="lib" path="thirdparty/jaxb-xjc.jar"/>
<classpathentry kind="lib" path="thirdparty/jboss-dependency.jar"/>
+ <classpathentry kind="lib" path="thirdparty/jboss-common-core.jar"/>
<classpathentry kind="lib" path="thirdparty/jboss-j2ee.jar"/>
<classpathentry kind="lib" path="thirdparty/jboss-logging-spi.jar"/>
<classpathentry kind="lib" path="thirdparty/jboss-microcontainer.jar"/>
Modified: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/ConfigProvider.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/ConfigProvider.java 2009-03-03 18:52:16 UTC (rev 9478)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/ConfigProvider.java 2009-03-04 11:48:54 UTC (rev 9479)
@@ -50,4 +50,14 @@
* Set the port configuration name and file
*/
void setConfigName(String configName, String configFile);
+
+ /**
+ * Get the WS-Security configuration
+ */
+ String getSecurityConfig();
+
+ /**
+ * Set the WS-Security configuration
+ */
+ void setSecurityConfig(String securityConfig);
}
Modified: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/StubExt.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/StubExt.java 2009-03-03 18:52:16 UTC (rev 9478)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/StubExt.java 2009-03-04 11:48:54 UTC (rev 9479)
@@ -136,14 +136,4 @@
* Creates a new empty AttachmentPart object.
*/
AttachmentPart createAttachmentPart();
-
- /**
- * Get the WS-Security configuration
- */
- String getSecurityConfig();
-
- /**
- * Set the WS-Security configuration
- */
- void setSecurityConfig(String securityConfig);
}
Modified: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/client/EndpointInfo.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/client/EndpointInfo.java 2009-03-03 18:52:16 UTC (rev 9478)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/client/EndpointInfo.java 2009-03-04 11:48:54 UTC (rev 9479)
@@ -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/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/jaxws/binding/BindingExt.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/jaxws/binding/BindingExt.java 2009-03-03 18:52:16 UTC (rev 9478)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/jaxws/binding/BindingExt.java 2009-03-04 11:48:54 UTC (rev 9479)
@@ -21,6 +21,8 @@
*/
package org.jboss.ws.core.jaxws.binding;
+//$Id$
+
import java.util.List;
import javax.xml.ws.Binding;
@@ -28,7 +30,6 @@
import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
-// $Id$
/**
* Extension to JAXWS protocol bindings.
@@ -38,7 +39,9 @@
*/
public interface BindingExt extends Binding
{
+ /** Get the handler chain for a given type */
List<Handler> getHandlerChain(HandlerType handlerType);
-
+
+ /** Set the handler chain for a given type */
void setHandlerChain(List<Handler> handlerChain, HandlerType handlerType);
}
Modified: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java 2009-03-03 18:52:16 UTC (rev 9478)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java 2009-03-04 11:48:54 UTC (rev 9479)
@@ -56,7 +56,6 @@
import org.jboss.ws.core.jaxws.handler.HandlerChainExecutor;
import org.jboss.ws.core.jaxws.handler.HandlerResolverImpl;
import org.jboss.ws.core.jaxws.handler.MessageContextJAXWS;
-import org.jboss.ws.core.jaxws.handler.PortInfoImpl;
import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.metadata.umdm.ClientEndpointMetaData;
@@ -76,7 +75,7 @@
{
// the associated endpoint meta data
- private final EndpointMetaData epMetaData;
+ private final ClientEndpointMetaData epMetaData;
private EndpointConfigMetaData epConfigMetaData;
// Keep a handle on the resolver so that updateConfig calls may revisit the associated chains
@@ -91,7 +90,7 @@
super(epMetaData);
setTargetEndpointAddress(epMetaData.getEndpointAddress());
- this.epMetaData = epMetaData;
+ this.epMetaData = (ClientEndpointMetaData)epMetaData;
this.epConfigMetaData = epMetaData.getEndpointConfigMetaData();
if (handlerResolver instanceof HandlerResolverImpl)
@@ -113,7 +112,7 @@
{
BindingExt binding = (BindingExt)getBindingProvider().getBinding();
- PortInfo portInfo = getPortInfo(epMetaData);
+ PortInfo portInfo = epMetaData.getPortInfo();
if (handlerResolver != null)
{
@@ -427,12 +426,4 @@
return Boolean.TRUE.equals(bool);
}
- private PortInfo getPortInfo(EndpointMetaData epMetaData)
- {
- QName serviceName = epMetaData.getServiceMetaData().getServiceName();
- QName portName = epMetaData.getPortName();
- String bindingID = epMetaData.getBindingId();
- PortInfo portInfo = new PortInfoImpl(serviceName, portName, bindingID);
- return portInfo;
- }
}
\ No newline at end of file
Modified: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java 2009-03-03 18:52:16 UTC (rev 9478)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java 2009-03-04 11:48:54 UTC (rev 9479)
@@ -24,12 +24,18 @@
// $Id$
import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import javax.xml.bind.JAXBContext;
+import javax.xml.namespace.QName;
import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFactory;
+import javax.xml.soap.SOAPFault;
import javax.xml.soap.SOAPMessage;
import javax.xml.transform.Source;
import javax.xml.ws.AsyncHandler;
@@ -40,22 +46,39 @@
import javax.xml.ws.Response;
import javax.xml.ws.WebServiceException;
import javax.xml.ws.Service.Mode;
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.PortInfo;
import javax.xml.ws.http.HTTPBinding;
import javax.xml.ws.soap.SOAPFaultException;
import org.jboss.logging.Logger;
import org.jboss.util.NotImplementedException;
+import org.jboss.ws.WSException;
import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.ConfigProvider;
import org.jboss.ws.core.MessageAbstraction;
-import org.jboss.ws.core.ConfigProvider;
+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;
+import org.jboss.ws.core.jaxws.binding.BindingExt;
import org.jboss.ws.core.jaxws.binding.BindingProviderImpl;
+import org.jboss.ws.core.jaxws.handler.HandlerChainExecutor;
+import org.jboss.ws.core.jaxws.handler.HandlerResolverImpl;
+import org.jboss.ws.core.jaxws.handler.MessageContextJAXWS;
import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
+import org.jboss.ws.metadata.config.ConfigurationProvider;
+import org.jboss.ws.metadata.umdm.ClientEndpointMetaData;
+import org.jboss.ws.metadata.umdm.EndpointConfigMetaData;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
-import org.jboss.ws.metadata.config.ConfigurationProvider;
+import org.jboss.ws.metadata.umdm.ServiceMetaData;
+import org.jboss.ws.metadata.wsse.WSSecurityConfigFactory;
+import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
+import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
/**
* The Dispatch interface provides support for the dynamic invocation of a service endpoint operations.
@@ -64,22 +87,26 @@
* @author Thomas.Diesler(a)jboss.com
* @since 04-Jul-2006
*/
-public class DispatchImpl<T> implements Dispatch<T>
+public class DispatchImpl<T> implements Dispatch<T>, ConfigProvider
{
// provide logging
private final Logger log = Logger.getLogger(DispatchImpl.class);
private BindingProvider bindingProvider;
- private EndpointMetaData epMetaData;
+ private HandlerResolverImpl handlerResolver;
+ private ClientEndpointMetaData epMetaData;
private JAXBContext jaxbContext;
private ExecutorService executor;
+ private String securityConfig;
private Class type;
private Mode mode;
+ private Map<HandlerType, HandlerChainExecutor> executorMap = new HashMap<HandlerType, HandlerChainExecutor>();
+
public DispatchImpl(ExecutorService executor, EndpointMetaData epMetaData, Class<T> type, Mode mode)
{
this.bindingProvider = new BindingProviderImpl(epMetaData);
- this.epMetaData = epMetaData;
+ this.epMetaData = (ClientEndpointMetaData)epMetaData;
this.executor = executor;
this.type = type;
this.mode = mode;
@@ -89,7 +116,7 @@
public DispatchImpl(ExecutorService executor, EndpointMetaData epMetaData, JAXBContext jbc, Mode mode)
{
this.bindingProvider = new BindingProviderImpl(epMetaData);
- this.epMetaData = epMetaData;
+ this.epMetaData = (ClientEndpointMetaData)epMetaData;
this.executor = executor;
this.type = Object.class;
this.jaxbContext = jbc;
@@ -111,11 +138,50 @@
return retObj;
}
- private Object invokeInternal(Object obj, Map<String, Object> resContext) throws IOException
+ private Object invokeInternal(Object obj, Map<String, Object> resContext) throws Exception
{
- MessageAbstraction reqMsg = getRequestMessage(obj);
+ Object retObj = null;
+
+ BindingExt binding = (BindingExt)bindingProvider.getBinding();
+
+ String bindingID = binding.getBindingID();
+ if (bindingID.indexOf("soap") > 0)
+ {
+ // Init the handler chain
+ if (handlerResolver == null)
+ {
+ handlerResolver = new HandlerResolverImpl();
+ EndpointConfigMetaData ecmd = epMetaData.getEndpointConfigMetaData();
+ handlerResolver.initHandlerChain(ecmd, HandlerType.PRE, true);
+ handlerResolver.initHandlerChain(ecmd, HandlerType.ENDPOINT, true);
+ handlerResolver.initHandlerChain(ecmd, HandlerType.POST, true);
+
+ PortInfo portInfo = epMetaData.getPortInfo();
+ List<Handler> preChain = handlerResolver.getHandlerChain(portInfo, HandlerType.PRE);
+ List<Handler> epChain = handlerResolver.getHandlerChain(portInfo, HandlerType.ENDPOINT);
+ List<Handler> postChain = handlerResolver.getHandlerChain(portInfo, HandlerType.POST);
+
+ binding.setHandlerChain(preChain, HandlerType.PRE);
+ binding.setHandlerChain(epChain, HandlerType.ENDPOINT);
+ binding.setHandlerChain(postChain, HandlerType.POST);
+ }
+
+ retObj = invokeInternalSOAP(obj);
+ }
+ else
+ {
+ retObj = invokeInternalNonSOAP(obj);
+ }
+ return retObj;
+ }
+
+ private Object invokeInternalSOAP(Object obj) throws Exception
+ {
+ Object retObj = null;
+
+ SOAPMessageImpl reqMsg = (SOAPMessageImpl)getRequestMessage(obj);
String targetAddress = epMetaData.getEndpointAddress();
-
+
// R2744 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field
// with a quoted value equal to the value of the soapAction attribute of
// soapbind:operation, if present in the corresponding WSDL description.
@@ -124,22 +190,104 @@
// with a quoted empty string value, if in the corresponding WSDL description,
// the soapAction attribute of soapbind:operation is either not present, or
// present with an empty string as its value.
- String bindingID = bindingProvider.getBinding().getBindingID();
- if (bindingID.indexOf("soap") > 0)
+ String soapAction = null;
+ Map<String, Object> reqContext = getRequestContext();
+ Boolean useSOAPAction = (Boolean)reqContext.get(BindingProvider.SOAPACTION_USE_PROPERTY);
+ if (Boolean.TRUE.equals(useSOAPAction))
{
- String soapAction = null;
- Map<String, Object> reqContext = getRequestContext();
- Boolean useSOAPAction = (Boolean)reqContext.get(BindingProvider.SOAPACTION_USE_PROPERTY);
- if (Boolean.TRUE.equals(useSOAPAction))
+ soapAction = (String)reqContext.get(BindingProvider.SOAPACTION_URI_PROPERTY);
+ if (soapAction == null)
+ throw new IllegalStateException("Cannot obtain: " + BindingProvider.SOAPACTION_URI_PROPERTY);
+ }
+ MimeHeaders mimeHeaders = reqMsg.getMimeHeaders();
+ mimeHeaders.addHeader("SOAPAction", soapAction != null ? soapAction : "");
+
+ // Get the order of pre/post handlerchains
+ HandlerType[] handlerType = new HandlerType[] { HandlerType.PRE, HandlerType.ENDPOINT, HandlerType.POST };
+ HandlerType[] faultType = new HandlerType[] { HandlerType.PRE, HandlerType.ENDPOINT, HandlerType.POST };
+
+ // Associate a message context with the current thread
+ CommonMessageContext msgContext = new SOAPMessageContextJAXWS();
+ 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);
+
+ QName portName = epMetaData.getPortName();
+ try
+ {
+ // Call the request handlers
+ boolean handlerPass = callRequestHandlerChain(portName, handlerType[0]);
+ handlerPass = handlerPass && callRequestHandlerChain(portName, handlerType[1]);
+ handlerPass = handlerPass && callRequestHandlerChain(portName, handlerType[2]);
+
+ // Handlers might have replaced the message
+ reqMsg = (SOAPMessageImpl)msgContext.getSOAPMessage();
+
+ MessageAbstraction resMsg = null;
+ if (handlerPass)
{
- soapAction = (String)reqContext.get(BindingProvider.SOAPACTION_URI_PROPERTY);
- if (soapAction == null)
- throw new IllegalStateException("Cannot obtain: " + BindingProvider.SOAPACTION_URI_PROPERTY);
+ Map<String, Object> callProps = new HashMap<String, Object>(getRequestContext());
+ if (callProps.containsKey(BindingProvider.ENDPOINT_ADDRESS_PROPERTY)) {
+ targetAddress = (String) callProps.get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
+ }
+ EndpointInfo epInfo = new EndpointInfo(epMetaData, targetAddress, callProps);
+ resMsg = getRemotingConnection().invoke(reqMsg, epInfo, false);
+
+ //Pivot, switch to response ctx and save the response message there
+ msgContext = MessageContextJAXWS.processPivot(msgContext);
+ msgContext.setMessageAbstraction(resMsg);
+
+ // Call the response handler chain, removing the fault type entry will not call handleFault for that chain
+ handlerPass = callResponseHandlerChain(portName, handlerType[2]);
+ faultType[2] = null;
+ handlerPass = handlerPass && callResponseHandlerChain(portName, handlerType[1]);
+ faultType[1] = null;
+ handlerPass = handlerPass && callResponseHandlerChain(portName, handlerType[0]);
+ faultType[0] = null;
}
- MimeHeaders mimeHeaders = reqMsg.getMimeHeaders();
- mimeHeaders.addHeader("SOAPAction", soapAction != null ? soapAction : "");
+
+ if (handlerPass)
+ {
+ retObj = getReturnObject(resMsg);
+ }
}
-
+ catch (Exception ex)
+ {
+ msgContext = MessageContextJAXWS.processPivot(msgContext);
+ if (faultType[2] != null)
+ callFaultHandlerChain(portName, faultType[2], ex);
+ if (faultType[1] != null)
+ callFaultHandlerChain(portName, faultType[1], ex);
+ if (faultType[0] != null)
+ callFaultHandlerChain(portName, faultType[0], ex);
+
+ throw ex;
+ }
+ finally
+ {
+ closeHandlerChain(portName, handlerType[2]);
+ closeHandlerChain(portName, handlerType[1]);
+ closeHandlerChain(portName, handlerType[0]);
+
+ MessageContextAssociation.popMessageContext();
+ }
+ return retObj;
+ }
+
+ private Object invokeInternalNonSOAP(Object obj) throws IOException
+ {
+ MessageAbstraction reqMsg = getRequestMessage(obj);
+ String targetAddress = epMetaData.getEndpointAddress();
+ Map<String, Object> callProps = new HashMap<String, Object>(getRequestContext());
+ if (callProps.containsKey(BindingProvider.ENDPOINT_ADDRESS_PROPERTY)) {
+ targetAddress = (String) callProps.get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
+ }
MessageAbstraction resMsg = getRemotingConnection().invoke(reqMsg, targetAddress, false);
Object retObj = getReturnObject(resMsg);
return retObj;
@@ -260,7 +408,19 @@
{
// jaxws/api/javax_xml_ws/Dispatch/Client.java#invokeTestJAXBNull
if (obj == null)
- throw new SOAPFaultException("Request object cannot be null");
+ {
+ try
+ {
+ SOAPFactory factory = SOAPFactory.newInstance();
+ SOAPFault fault = factory.createFault("Request object cannot be null", new QName("http://org.jboss.ws", "Dispatch"));
+ fault.setFaultActor("client");
+ throw new SOAPFaultException(fault);
+ }
+ catch (SOAPException e)
+ {
+ //
+ }
+ }
String bindingID = bindingProvider.getBinding().getBindingID();
if (EndpointMetaData.SUPPORTED_BINDINGS.contains(bindingID) == false)
@@ -314,7 +474,7 @@
throw new IllegalArgumentException("Async response cannot be null");
if (payload == null)
throw new IllegalArgumentException("Async payload cannot be null");
-
+
this.response = response;
this.handler = handler;
this.payload = payload;
@@ -371,4 +531,85 @@
{
throw new NotImplementedException();
}
+
+ public String getConfigFile()
+ {
+ return epMetaData.getConfigFile();
+ }
+
+ public String getConfigName()
+ {
+ return epMetaData.getConfigName();
+ }
+
+ public void setConfigName(String configName)
+ {
+ epMetaData.setConfigName(configName);
+ }
+
+ public void setConfigName(String configName, String configFile)
+ {
+ epMetaData.setConfigName(configName, configFile);
+ }
+
+ public String getSecurityConfig()
+ {
+ return securityConfig;
+ }
+
+ public void setSecurityConfig(String securityConfig)
+ {
+ this.securityConfig = securityConfig;
+
+ if (securityConfig != null)
+ {
+ ServiceMetaData serviceMetaData = epMetaData.getServiceMetaData();
+ if (serviceMetaData.getSecurityConfiguration() == null)
+ {
+ try
+ {
+ WSSecurityConfigFactory wsseConfFactory = WSSecurityConfigFactory.newInstance();
+ UnifiedVirtualFile vfsRoot = serviceMetaData.getUnifiedMetaData().getRootFile();
+ WSSecurityConfiguration config = wsseConfFactory.createConfiguration(vfsRoot, securityConfig);
+ serviceMetaData.setSecurityConfiguration(config);
+ }
+ catch (IOException ex)
+ {
+ WSException.rethrow("Cannot set security config", ex);
+ }
+ }
+ }
+ }
+
+ private boolean callRequestHandlerChain(QName portName, HandlerType type)
+ {
+ BindingExt binding = (BindingExt)bindingProvider.getBinding();
+ HandlerChainExecutor executor = new HandlerChainExecutor(epMetaData, binding.getHandlerChain(type));
+ executorMap.put(type, executor);
+
+ MessageContext msgContext = (MessageContext)MessageContextAssociation.peekMessageContext();
+ return executor.handleMessage(msgContext);
+ }
+
+ private boolean callResponseHandlerChain(QName portName, HandlerType type)
+ {
+ MessageContext msgContext = (MessageContext)MessageContextAssociation.peekMessageContext();
+ HandlerChainExecutor executor = executorMap.get(type);
+ return (executor != null ? executor.handleMessage(msgContext) : true);
+ }
+
+ private boolean callFaultHandlerChain(QName portName, HandlerType type, Exception ex)
+ {
+ MessageContext msgContext = (MessageContext)MessageContextAssociation.peekMessageContext();
+ HandlerChainExecutor executor = executorMap.get(type);
+ return (executor != null ? executor.handleFault(msgContext, ex) : true);
+ }
+
+ private void closeHandlerChain(QName portName, HandlerType type)
+ {
+ MessageContext msgContext = (MessageContext)MessageContextAssociation.peekMessageContext();
+ HandlerChainExecutor executor = executorMap.get(type);
+ if (executor != null)
+ executor.close(msgContext);
+ }
}
Modified: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/extensions/security/WSSecurityDispatcher.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/extensions/security/WSSecurityDispatcher.java 2009-03-03 18:52:16 UTC (rev 9478)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/extensions/security/WSSecurityDispatcher.java 2009-03-04 11:48:54 UTC (rev 9479)
@@ -85,13 +85,13 @@
return newList;
}
- private static Config getConfig(WSSecurityConfiguration config, String portName, String operationName)
+ private static Config getConfig(WSSecurityConfiguration config, String portName, String opName)
{
Port port = config.getPorts().get(portName);
if (port == null)
return config.getDefaultConfig();
- Operation operation = port.getOperations().get(operationName);
+ Operation operation = port.getOperations().get(opName);
if (operation == null)
{
Config portConfig = port.getDefaultConfig();
@@ -132,8 +132,14 @@
opMetaData = soapMessage.getOperationMetaData(epMetaData);
}
- String operation = opMetaData.getQName().toString();
- String port = opMetaData.getEndpointMetaData().getPortName().getLocalPart();
+ String operation = null;
+ String port = null;
+ if (opMetaData != null)
+ {
+ operation = opMetaData.getQName().toString();
+ port = opMetaData.getEndpointMetaData().getPortName().getLocalPart();
+ }
+
if (hasRequirements(config, operation, port))
throw convertToFault(new InvalidSecurityHeaderException("This service requires <wsse:Security>, which is missing."));
@@ -161,8 +167,13 @@
opMetaData = soapMessage.getOperationMetaData(epMetaData);
}
- String operation = opMetaData.getQName().toString();
- String port = opMetaData.getEndpointMetaData().getPortName().getLocalPart();
+ String operation = null;
+ String port = null;
+ if (opMetaData != null)
+ {
+ operation = opMetaData.getQName().toString();
+ port = opMetaData.getEndpointMetaData().getPortName().getLocalPart();
+ }
List<OperationDescription<RequireOperation>> operations = buildRequireOperations(config, operation, port);
@@ -288,26 +299,29 @@
WSSecurityConfiguration config = getSecurityConfig(ctx);
SOAPMessageImpl soapMessage = (SOAPMessageImpl)ctx.getSOAPMessage();
+ EndpointMetaData epMetaData = ctx.getEndpointMetaData();
+ String port = epMetaData.getPortName().getLocalPart();
+
+ String opName = null;
OperationMetaData opMetaData = ctx.getOperationMetaData();
- String operation = opMetaData.getQName().toString();
- String port = opMetaData.getEndpointMetaData().getPortName().getLocalPart();
+ if (opMetaData != null)
+ opName = opMetaData.getQName().toString();
- Config operationConfig = getConfig(config, port, operation);
+ Config opConfig = getConfig(config, port, opName);
+ log.debug("WS-Security config: " + opConfig);
- log.debug("WS-Security config: " + operationConfig);
-
// Nothing to process
- if (operationConfig == null)
+ if (opConfig == null)
return;
ArrayList<OperationDescription<EncodingOperation>> operations = new ArrayList<OperationDescription<EncodingOperation>>();
- Timestamp timestamp = operationConfig.getTimestamp();
+ Timestamp timestamp = opConfig.getTimestamp();
if (timestamp != null)
{
operations.add(new OperationDescription<EncodingOperation>(TimestampOperation.class, null, null, timestamp.getTtl(), null));
}
- if (operationConfig.getUsername() != null)
+ if (opConfig.getUsername() != null)
{
Object user = ctx.get(Stub.USERNAME_PROPERTY);
Object pass = ctx.get(Stub.PASSWORD_PROPERTY);
@@ -325,7 +339,7 @@
}
}
- Sign sign = operationConfig.getSign();
+ Sign sign = opConfig.getSign();
if (sign != null)
{
List<Target> targets = convertTargets(sign.getTargets());
@@ -341,7 +355,7 @@
operations.add(new OperationDescription<EncodingOperation>(SignatureOperation.class, targets, sign.getAlias(), null, null));
}
- Encrypt encrypt = operationConfig.getEncrypt();
+ Encrypt encrypt = opConfig.getEncrypt();
if (encrypt != null)
{
List<Target> targets = convertTargets(encrypt.getTargets());
Modified: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/metadata/umdm/ClientEndpointMetaData.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/metadata/umdm/ClientEndpointMetaData.java 2009-03-03 18:52:16 UTC (rev 9478)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/metadata/umdm/ClientEndpointMetaData.java 2009-03-04 11:48:54 UTC (rev 9479)
@@ -24,7 +24,9 @@
// $Id$
import javax.xml.namespace.QName;
+import javax.xml.ws.handler.PortInfo;
+import org.jboss.ws.core.jaxws.handler.PortInfoImpl;
import org.jboss.ws.metadata.config.ConfigurationProvider;
import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
@@ -64,11 +66,20 @@
this.endpointAddress = endpointAddress;
}
+ public PortInfo getPortInfo()
+ {
+ QName serviceName = getServiceMetaData().getServiceName();
+ QName portName = getPortName();
+ String bindingID = getBindingId();
+ PortInfo portInfo = new PortInfoImpl(serviceName, portName, bindingID);
+ return portInfo;
+ }
+
public EndpointConfigMetaData createEndpointConfigMetaData(String configName, String configFile)
{
return super.createEndpointConfigMetaData(configName, configFile);
}
-
+
public String toString()
{
StringBuilder buffer = new StringBuilder("\nClientEndpointMetaData:");
Copied: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/samples/wssecurity/SimpleDispatchTestCase.java (from rev 9477, stack/native/branches/dlofthouse/JBPAPP-1746/src/test/java/org/jboss/test/ws/jaxws/samples/wssecurity/SimpleDispatchTestCase.java)
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/samples/wssecurity/SimpleDispatchTestCase.java (rev 0)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/samples/wssecurity/SimpleDispatchTestCase.java 2009-03-04 11:48:54 UTC (rev 9479)
@@ -0,0 +1,138 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.samples.wssecurity;
+
+import java.io.File;
+import java.io.StringReader;
+import java.net.URL;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.Service;
+import javax.xml.ws.Service.Mode;
+
+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
+ *
+ * http://jira.jboss.org/jira/browse/JBWS-1817
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @author alessio.soldano(a)jboss.com
+ * @since 02-Oct-2007
+ */
+public class SimpleDispatchTestCase extends JBossWSTest
+{
+ private static Dispatch usernameDispatch;
+ private static Dispatch encryptDispatch;
+
+ public static Test suite() throws Exception
+ {
+ return new JBossWSTestSetup(SimpleDispatchTestCase.class, "jaxws-samples-wssecurity-username.war jaxws-samples-wssecurity-encrypt.war");
+ }
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ if (usernameDispatch == null)
+ {
+ URL wsdlURL = new File("resources/jaxws/samples/wssecurity/simple-username/META-INF/wsdl/UsernameService.wsdl").toURL();
+ URL securityURL = new File("resources/jaxws/samples/wssecurity/simple-username/META-INF/jboss-wsse-client.xml").toURL();
+ QName serviceName = new QName("http://org.jboss.ws/samples/wssecurity", "UsernameService");
+ QName portName = new QName("http://org.jboss.ws/samples/wssecurity", "UsernameEndpointPort");
+
+ Service service = Service.create(wsdlURL, serviceName);
+ usernameDispatch = service.createDispatch(portName, Source.class, Mode.PAYLOAD);
+
+ ((ConfigProvider)usernameDispatch).setSecurityConfig(securityURL.toExternalForm());
+ ((ConfigProvider)usernameDispatch).setConfigName("Standard WSSecurity Client");
+ }
+ if (encryptDispatch == null)
+ {
+ URL wsdlURL = new File("wsprovide/resources/jaxws/samples/wssecurity/HelloService.wsdl").toURL();
+ URL securityURL = new File("resources/jaxws/samples/wssecurity/simple-encrypt/META-INF/jboss-wsse-client.xml").toURL();
+ QName serviceName = new QName("http://org.jboss.ws/samples/wssecurity", "HelloService");
+ QName portName = new QName("http://org.jboss.ws/samples/wssecurity", "HelloPort");
+
+ Service service = Service.create(wsdlURL, serviceName);
+ encryptDispatch = service.createDispatch(portName, Source.class, Mode.PAYLOAD);
+
+ ((ConfigProvider)encryptDispatch).setSecurityConfig(securityURL.toExternalForm());
+ ((ConfigProvider)encryptDispatch).setConfigName("Standard WSSecurity Client");
+
+ encryptDispatch.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+ "http://" + getServerHost() + ":8080/jaxws-samples-wssecurity-encrypt");
+ }
+ }
+
+ public void testUsernameTokenNegative() throws Exception
+ {
+ try
+ {
+ String payload = "<ns1:getUsernameToken xmlns:ns1='http://org.jboss.ws/samples/wssecurity'/>";
+ usernameDispatch.invoke(new StreamSource(new StringReader(payload)));
+ fail("Server should respond with [401] - Unauthorized");
+ }
+ catch (Exception ex)
+ {
+ // this should be ok
+ }
+ }
+
+ public void testUsernameToken() throws Exception
+ {
+ Map<String, Object> reqContext = usernameDispatch.getRequestContext();
+ reqContext.put(BindingProvider.USERNAME_PROPERTY, "kermit");
+ reqContext.put(BindingProvider.PASSWORD_PROPERTY, "thefrog");
+
+ String payload = "<ns1:getUsernameToken xmlns:ns1='http://org.jboss.ws/samples/wssecurity'/>";
+ Source retObj = (Source)usernameDispatch.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);
+ }
+
+ public void testEncrypt() throws Exception
+ {
+ String payload = "<ns1:echoUserType xmlns:ns1='http://org.jboss.ws/samples/wssecurity'><user><msg>Kermit</msg></user></ns1:echoUserType>";
+ Source retObj = (Source)encryptDispatch.invoke(new StreamSource(new StringReader(payload)));
+
+ Element docElement = DOMUtils.sourceToElement(retObj);
+ Element retElement = DOMUtils.getFirstChildElement(docElement);
+ String retPayload = DOMWriter.printNode(retElement, false);
+ assertEquals("<return><msg>Kermit</msg></return>", retPayload);
+ }
+}
\ No newline at end of file
15 years, 2 months
JBossWS SVN: r9478 - stack/native/branches.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2009-03-03 13:52:16 -0500 (Tue, 03 Mar 2009)
New Revision: 9478
Removed:
stack/native/branches/Branch_2_0_1_SOA_4_2/
Log:
Branch never used.
15 years, 2 months
JBossWS SVN: r9477 - in stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws: extensions/security and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2009-03-03 13:48:01 -0500 (Tue, 03 Mar 2009)
New Revision: 9477
Modified:
stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java
stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/extensions/security/WSSecurityDispatcher.java
Log:
Backport 3
Modified: stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java
===================================================================
--- stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java 2009-03-03 18:39:19 UTC (rev 9476)
+++ stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java 2009-03-03 18:48:01 UTC (rev 9477)
@@ -233,6 +233,9 @@
if (handlerPass)
{
Map<String, Object> callProps = new HashMap<String, Object>(getRequestContext());
+ if (callProps.containsKey(BindingProvider.ENDPOINT_ADDRESS_PROPERTY)) {
+ targetAddress = (String) callProps.get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
+ }
EndpointInfo epInfo = new EndpointInfo(epMetaData, targetAddress, callProps);
resMsg = getRemotingConnection().invoke(reqMsg, epInfo, false);
@@ -281,6 +284,10 @@
{
MessageAbstraction reqMsg = getRequestMessage(obj);
String targetAddress = epMetaData.getEndpointAddress();
+ Map<String, Object> callProps = new HashMap<String, Object>(getRequestContext());
+ if (callProps.containsKey(BindingProvider.ENDPOINT_ADDRESS_PROPERTY)) {
+ targetAddress = (String) callProps.get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
+ }
MessageAbstraction resMsg = getRemotingConnection().invoke(reqMsg, targetAddress, false);
Object retObj = getReturnObject(resMsg);
return retObj;
Modified: stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/extensions/security/WSSecurityDispatcher.java
===================================================================
--- stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/extensions/security/WSSecurityDispatcher.java 2009-03-03 18:39:19 UTC (rev 9476)
+++ stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/extensions/security/WSSecurityDispatcher.java 2009-03-03 18:48:01 UTC (rev 9477)
@@ -167,8 +167,13 @@
opMetaData = soapMessage.getOperationMetaData(epMetaData);
}
- String operation = opMetaData.getQName().toString();
- String port = opMetaData.getEndpointMetaData().getPortName().getLocalPart();
+ String operation = null;
+ String port = null;
+ if (opMetaData != null)
+ {
+ operation = opMetaData.getQName().toString();
+ port = opMetaData.getEndpointMetaData().getPortName().getLocalPart();
+ }
List<OperationDescription<RequireOperation>> operations = buildRequireOperations(config, operation, port);
15 years, 2 months
JBossWS SVN: r9476 - in stack/native/branches/dlofthouse/JBPAPP-1746/src: main/java/org/jboss/ws/extensions/security and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2009-03-03 13:39:19 -0500 (Tue, 03 Mar 2009)
New Revision: 9476
Modified:
stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java
stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/extensions/security/WSSecurityDispatcher.java
stack/native/branches/dlofthouse/JBPAPP-1746/src/test/java/org/jboss/test/ws/jaxws/samples/wssecurity/SimpleDispatchTestCase.java
Log:
Backport 2
Modified: stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java
===================================================================
--- stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java 2009-03-03 16:16:33 UTC (rev 9475)
+++ stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java 2009-03-03 18:39:19 UTC (rev 9476)
@@ -236,6 +236,10 @@
EndpointInfo epInfo = new EndpointInfo(epMetaData, targetAddress, callProps);
resMsg = getRemotingConnection().invoke(reqMsg, epInfo, false);
+ //Pivot, switch to response ctx and save the response message there
+ msgContext = MessageContextJAXWS.processPivot(msgContext);
+ msgContext.setMessageAbstraction(resMsg);
+
// Call the response handler chain, removing the fault type entry will not call handleFault for that chain
handlerPass = callResponseHandlerChain(portName, handlerType[2]);
faultType[2] = null;
@@ -252,6 +256,7 @@
}
catch (Exception ex)
{
+ msgContext = MessageContextJAXWS.processPivot(msgContext);
if (faultType[2] != null)
callFaultHandlerChain(portName, faultType[2], ex);
if (faultType[1] != null)
Modified: stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/extensions/security/WSSecurityDispatcher.java
===================================================================
--- stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/extensions/security/WSSecurityDispatcher.java 2009-03-03 16:16:33 UTC (rev 9475)
+++ stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/extensions/security/WSSecurityDispatcher.java 2009-03-03 18:39:19 UTC (rev 9476)
@@ -132,8 +132,14 @@
opMetaData = soapMessage.getOperationMetaData(epMetaData);
}
- String operation = opMetaData.getQName().toString();
- String port = opMetaData.getEndpointMetaData().getPortName().getLocalPart();
+ String operation = null;
+ String port = null;
+ if (opMetaData != null)
+ {
+ operation = opMetaData.getQName().toString();
+ port = opMetaData.getEndpointMetaData().getPortName().getLocalPart();
+ }
+
if (hasRequirements(config, operation, port))
throw convertToFault(new InvalidSecurityHeaderException("This service requires <wsse:Security>, which is missing."));
Modified: stack/native/branches/dlofthouse/JBPAPP-1746/src/test/java/org/jboss/test/ws/jaxws/samples/wssecurity/SimpleDispatchTestCase.java
===================================================================
--- stack/native/branches/dlofthouse/JBPAPP-1746/src/test/java/org/jboss/test/ws/jaxws/samples/wssecurity/SimpleDispatchTestCase.java 2009-03-03 16:16:33 UTC (rev 9475)
+++ stack/native/branches/dlofthouse/JBPAPP-1746/src/test/java/org/jboss/test/ws/jaxws/samples/wssecurity/SimpleDispatchTestCase.java 2009-03-03 18:39:19 UTC (rev 9476)
@@ -49,21 +49,23 @@
* http://jira.jboss.org/jira/browse/JBWS-1817
*
* @author Thomas.Diesler(a)jboss.com
+ * @author alessio.soldano(a)jboss.com
* @since 02-Oct-2007
*/
public class SimpleDispatchTestCase extends JBossWSTest
{
- private static Dispatch dispatch;
+ private static Dispatch usernameDispatch;
+ private static Dispatch encryptDispatch;
public static Test suite() throws Exception
{
- return new JBossWSTestSetup(SimpleDispatchTestCase.class, "jaxws-samples-wssecurity-username.war");
+ return new JBossWSTestSetup(SimpleDispatchTestCase.class, "jaxws-samples-wssecurity-username.war jaxws-samples-wssecurity-encrypt.war");
}
@Override
protected void setUp() throws Exception
{
- if (dispatch == null)
+ if (usernameDispatch == null)
{
URL wsdlURL = new File("resources/jaxws/samples/wssecurity/simple-username/META-INF/wsdl/UsernameService.wsdl").toURL();
URL securityURL = new File("resources/jaxws/samples/wssecurity/simple-username/META-INF/jboss-wsse-client.xml").toURL();
@@ -71,11 +73,27 @@
QName portName = new QName("http://org.jboss.ws/samples/wssecurity", "UsernameEndpointPort");
Service service = Service.create(wsdlURL, serviceName);
- dispatch = service.createDispatch(portName, Source.class, Mode.PAYLOAD);
+ usernameDispatch = service.createDispatch(portName, Source.class, Mode.PAYLOAD);
- ((ConfigProvider)dispatch).setSecurityConfig(securityURL.toExternalForm());
- ((ConfigProvider)dispatch).setConfigName("Standard WSSecurity Client");
+ ((ConfigProvider)usernameDispatch).setSecurityConfig(securityURL.toExternalForm());
+ ((ConfigProvider)usernameDispatch).setConfigName("Standard WSSecurity Client");
}
+ if (encryptDispatch == null)
+ {
+ URL wsdlURL = new File("wsprovide/resources/jaxws/samples/wssecurity/HelloService.wsdl").toURL();
+ URL securityURL = new File("resources/jaxws/samples/wssecurity/simple-encrypt/META-INF/jboss-wsse-client.xml").toURL();
+ QName serviceName = new QName("http://org.jboss.ws/samples/wssecurity", "HelloService");
+ QName portName = new QName("http://org.jboss.ws/samples/wssecurity", "HelloPort");
+
+ Service service = Service.create(wsdlURL, serviceName);
+ encryptDispatch = service.createDispatch(portName, Source.class, Mode.PAYLOAD);
+
+ ((ConfigProvider)encryptDispatch).setSecurityConfig(securityURL.toExternalForm());
+ ((ConfigProvider)encryptDispatch).setConfigName("Standard WSSecurity Client");
+
+ encryptDispatch.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+ "http://" + getServerHost() + ":8080/jaxws-samples-wssecurity-encrypt");
+ }
}
public void testUsernameTokenNegative() throws Exception
@@ -83,7 +101,7 @@
try
{
String payload = "<ns1:getUsernameToken xmlns:ns1='http://org.jboss.ws/samples/wssecurity'/>";
- dispatch.invoke(new StreamSource(new StringReader(payload)));
+ usernameDispatch.invoke(new StreamSource(new StringReader(payload)));
fail("Server should respond with [401] - Unauthorized");
}
catch (Exception ex)
@@ -94,16 +112,27 @@
public void testUsernameToken() throws Exception
{
- Map<String, Object> reqContext = dispatch.getRequestContext();
+ Map<String, Object> reqContext = usernameDispatch.getRequestContext();
reqContext.put(BindingProvider.USERNAME_PROPERTY, "kermit");
reqContext.put(BindingProvider.PASSWORD_PROPERTY, "thefrog");
String payload = "<ns1:getUsernameToken xmlns:ns1='http://org.jboss.ws/samples/wssecurity'/>";
- Source retObj = (Source)dispatch.invoke(new StreamSource(new StringReader(payload)));
+ Source retObj = (Source)usernameDispatch.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);
}
+
+ public void testEncrypt() throws Exception
+ {
+ String payload = "<ns1:echoUserType xmlns:ns1='http://org.jboss.ws/samples/wssecurity'><user><msg>Kermit</msg></user></ns1:echoUserType>";
+ Source retObj = (Source)encryptDispatch.invoke(new StreamSource(new StringReader(payload)));
+
+ Element docElement = DOMUtils.sourceToElement(retObj);
+ Element retElement = DOMUtils.getFirstChildElement(docElement);
+ String retPayload = DOMWriter.printNode(retElement, false);
+ assertEquals("<return><msg>Kermit</msg></return>", retPayload);
+ }
}
\ No newline at end of file
15 years, 2 months
JBossWS SVN: r9475 - in stack/native/branches/jbossws-native-2.0.1.SP2_CP: src/main/java/org/jboss/ws/core/soap/attachment and 5 other directories.
by jbossws-commits@lists.jboss.org
Author: mageshbk(a)jboss.com
Date: 2009-03-03 11:16:33 -0500 (Tue, 03 Mar 2009)
New Revision: 9475
Added:
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/JBWS2419TestCase.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP11ClientHandler.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP11Endpoint.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP11EndpointBean.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP11ServerHandler.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP12ClientHandler.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP12Endpoint.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP12EndpointBean.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP12ServerHandler.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/jaxws-server-handlers1.xml
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/jaxws-server-handlers2.xml
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2419/
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2419/WEB-INF/
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2419/WEB-INF/web.xml
Modified:
stack/native/branches/jbossws-native-2.0.1.SP2_CP/ant-import-tests/build-jars-jaxws.xml
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/soap/attachment/MultipartRelatedXOPEncoder.java
Log:
[JBPAPP-1732] Port [JBWS-2419 MTOM/XOP message always sets start-info as "text/xml"]
Modified: stack/native/branches/jbossws-native-2.0.1.SP2_CP/ant-import-tests/build-jars-jaxws.xml
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/ant-import-tests/build-jars-jaxws.xml 2009-03-03 16:00:12 UTC (rev 9474)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/ant-import-tests/build-jars-jaxws.xml 2009-03-03 16:16:33 UTC (rev 9475)
@@ -581,6 +581,20 @@
</webinf>
</war>
+ <!-- jaxws-jbws2419 -->
+ <war warfile="${tests.output.dir}/libs/jaxws-jbws2419.war" webxml="${tests.output.dir}/resources/jaxws/jbws2419/WEB-INF/web.xml">
+ <classes dir="${tests.output.dir}/classes">
+ <include name="org/jboss/test/ws/jaxws/jbws2419/SOAP12EndpointBean.class"/>
+ <include name="org/jboss/test/ws/jaxws/jbws2419/SOAP12Endpoint.class"/>
+ <include name="org/jboss/test/ws/jaxws/jbws2419/SOAP12ServerHandler.class"/>
+ <include name="org/jboss/test/ws/jaxws/jbws2419/SOAP11EndpointBean.class"/>
+ <include name="org/jboss/test/ws/jaxws/jbws2419/SOAP11Endpoint.class"/>
+ <include name="org/jboss/test/ws/jaxws/jbws2419/SOAP11ServerHandler.class"/>
+ <include name="org/jboss/test/ws/jaxws/jbws2419/jaxws-server-handlers1.xml"/>
+ <include name="org/jboss/test/ws/jaxws/jbws2419/jaxws-server-handlers2.xml"/>
+ </classes>
+ </war>
+
<!-- jaxws-jbws2437 -->
<jar destfile="${tests.output.dir}/libs/jaxws-jbws2437.jar">
<fileset dir="${tests.output.dir}/classes">
Modified: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/soap/attachment/MultipartRelatedXOPEncoder.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/soap/attachment/MultipartRelatedXOPEncoder.java 2009-03-03 16:00:12 UTC (rev 9474)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/soap/attachment/MultipartRelatedXOPEncoder.java 2009-03-03 16:16:33 UTC (rev 9475)
@@ -27,6 +27,7 @@
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMultipart;
import javax.mail.internet.ParameterList;
+import javax.xml.soap.SOAPConstants;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPException;
@@ -57,10 +58,14 @@
public void encodeMultipartRelatedMessage() throws SOAPException, MessagingException
{
+ SOAPEnvelope soapEnv = soapMessage.getSOAPPart().getEnvelope();
+ boolean isSoap12 = SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE.equals(soapEnv.getElementQName().getNamespaceURI());
+ String soapType = isSoap12 ? MimeConstants.TYPE_SOAP12 : MimeConstants.TYPE_SOAP11;
+
ParameterList p = new ParameterList();
p.set("type", MimeConstants.TYPE_APPLICATION_XOP_XML);
p.set("start", MimeConstants.ROOTPART_CID);
- p.set("start-info", MimeConstants.START_INFO_XOP);
+ p.set("start-info", soapType);
MimeMultipart multipart = new MimeMultipart("related" + p);
MimeBodyPart rootPart = new MimeBodyPart();
@@ -71,12 +76,11 @@
* to marshall the message. In this way the root part can be lazily written to the output
* stream.
*/
- SOAPEnvelope soapEnv = soapMessage.getSOAPPart().getEnvelope();
String envStr = SOAPElementWriter.writeElement((SOAPElementImpl)soapEnv, false);
rootPart.setText(envStr, "UTF-8");
rootPart.setContentID(MimeConstants.ROOTPART_CID);
- rootPart.setHeader(MimeConstants.CONTENT_TYPE, MimeConstants.TYPE_APPLICATION_XOP_XML + "; type=\"text/xml\"");
+ rootPart.setHeader(MimeConstants.CONTENT_TYPE, MimeConstants.TYPE_APPLICATION_XOP_XML + "; type=\"" + soapType + "\"");
rootPart.setHeader(MimeConstants.CONTENT_TRANSFER_ENCODING, MimeConstants.TEXT_8BIT_ENCODING);
multipart.addBodyPart(rootPart);
Added: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/JBWS2419TestCase.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/JBWS2419TestCase.java (rev 0)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/JBWS2419TestCase.java 2009-03-03 16:16:33 UTC (rev 9475)
@@ -0,0 +1,119 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.jbws2419;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.activation.DataHandler;
+import javax.wsdl.Binding;
+import javax.wsdl.Definition;
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPConstants;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Service;
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.soap.SOAPBinding;
+
+import junit.framework.Test;
+
+import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestSetup;
+
+/**
+ * Test SOAP 1.2 and SOAP 1.1 MTOM/XOP request/response content type and start-info
+ *
+ * @author mageshbk(a)jboss.com
+ * @since 20-Feb-2009
+ */
+public class JBWS2419TestCase extends JBossWSTest
+{
+ public final String TARGET_ENDPOINT_ADDRESS = "http://" + getServerHost() + ":8080/jaxws-jbws2419";
+
+ public static Test suite()
+ {
+ return new JBossWSTestSetup(JBWS2419TestCase.class, "jaxws-jbws2419.war");
+ }
+
+ public void testSOAP12ClientAccess() throws Exception
+ {
+ URL wsdlURL = new URL(TARGET_ENDPOINT_ADDRESS + "/soap12?wsdl");
+ QName qname = new QName("http://org.jboss.ws/jaxws/jbws2419", "SOAP12EndpointBeanService");
+ Service service = Service.create(wsdlURL, qname);
+ SOAP12Endpoint port = (SOAP12Endpoint)service.getPort(SOAP12Endpoint.class);
+
+ BindingProvider provider = (BindingProvider)port;
+ List<Handler> handlerChain = new ArrayList<Handler>();
+ handlerChain.addAll(provider.getBinding().getHandlerChain());
+ handlerChain.add(new SOAP12ClientHandler());
+ provider.getBinding().setHandlerChain(handlerChain);
+ ((SOAPBinding)provider.getBinding()).setMTOMEnabled(true);
+
+ DataHandler response = port.namespace(new DataHandler("Jimbo","text/plain"));
+ Object nsURI = getContent(response);
+ assertEquals(SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE, nsURI);
+ }
+
+ public void testSOAP11ClientAccess() throws Exception
+ {
+ URL wsdlURL = new URL(TARGET_ENDPOINT_ADDRESS + "/soap11?wsdl");
+ QName qname = new QName("http://org.jboss.ws/jaxws/jbws2419", "SOAP11EndpointBeanService");
+ Service service = Service.create(wsdlURL, qname);
+ SOAP11Endpoint port = (SOAP11Endpoint)service.getPort(SOAP11Endpoint.class);
+
+ BindingProvider provider = (BindingProvider)port;
+ List<Handler> handlerChain = new ArrayList<Handler>();
+ handlerChain.addAll(provider.getBinding().getHandlerChain());
+ handlerChain.add(new SOAP11ClientHandler());
+ provider.getBinding().setHandlerChain(handlerChain);
+ ((SOAPBinding)provider.getBinding()).setMTOMEnabled(true);
+
+ DataHandler response = port.namespace(new DataHandler("Jimbo","text/plain"));
+ Object nsURI = getContent(response);
+ assertEquals(SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE, nsURI);
+ }
+
+ protected Object getContent(DataHandler dh) throws IOException
+ {
+ Object content = dh.getContent();
+
+ // Metro returns an ByteArrayInputStream
+ if (content instanceof InputStream)
+ {
+ try
+ {
+ BufferedReader br = new BufferedReader(new InputStreamReader((InputStream)content));
+ return br.readLine();
+ }
+ finally
+ {
+ ((InputStream)content).close();
+ }
+ }
+ return content;
+ }
+}
Property changes on: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/JBWS2419TestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP11ClientHandler.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP11ClientHandler.java (rev 0)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP11ClientHandler.java 2009-03-03 16:16:33 UTC (rev 9475)
@@ -0,0 +1,101 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.jbws2419;
+
+import javax.mail.internet.ContentType;
+import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPConstants;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.jaxws.handler.GenericSOAPHandler;
+
+/**
+ * A SOAP 1.1 client side handler
+ *
+ * @author mageshbk(a)jboss.com
+ * @since 20-Feb-2009
+ */
+public class SOAP11ClientHandler extends GenericSOAPHandler
+{
+ private static Logger log = Logger.getLogger(SOAP11ClientHandler.class);
+
+ public boolean handleInbound(MessageContext msgContext)
+ {
+ log.info("handleInbound");
+
+ SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+
+ MimeHeaders mimeHeaders = soapMessage.getMimeHeaders();
+ String[] ct = mimeHeaders.getHeader("Content-Type");
+ ContentType contentType;
+ if (ct != null)
+ {
+ try
+ {
+ contentType = new ContentType(ct[0]);
+ log.info("contentType="+contentType);
+ String startInfo = contentType.getParameter("start-info");
+ if (startInfo.equals(SOAPConstants.SOAP_1_1_CONTENT_TYPE))
+ {
+ return true;
+ }
+ }
+ catch(Exception e)
+ {
+ throw new WebServiceException(e);
+ }
+ }
+ return false;
+ }
+
+ protected boolean handleOutbound(MessageContext msgContext)
+ {
+ log.info("handleOutbound");
+
+ try
+ {
+ SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+ soapMessage.saveChanges();
+
+ MimeHeaders mimeHeaders = soapMessage.getMimeHeaders();
+ String[] ct = mimeHeaders.getHeader("Content-Type");
+ ContentType contentType;
+ if (ct != null)
+ {
+ contentType = new ContentType(ct[0]);
+ log.info("contentType="+contentType);
+ if (contentType.getBaseType().equals(SOAPConstants.SOAP_1_1_CONTENT_TYPE))
+ return true;
+ }
+ return false;
+ }
+ catch (Exception ex)
+ {
+ throw new WebServiceException(ex);
+ }
+ }
+}
Property changes on: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP11ClientHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP11Endpoint.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP11Endpoint.java (rev 0)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP11Endpoint.java 2009-03-03 16:16:33 UTC (rev 9475)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.jbws2419;
+
+import static javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_MTOM_BINDING;
+
+import javax.activation.DataHandler;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+import javax.jws.soap.SOAPBinding.Style;
+import javax.xml.bind.annotation.XmlMimeType;
+import javax.xml.ws.BindingType;
+
+@WebService(name = "SOAP11Endpoint", targetNamespace = "http://org.jboss.ws/jaxws/jbws2419")
+@SOAPBinding(style = Style.RPC)
+@BindingType(SOAP11HTTP_MTOM_BINDING)
+
+public interface SOAP11Endpoint
+{
+ @XmlMimeType("text/plain")
+ public DataHandler namespace(@XmlMimeType("text/plain") DataHandler data);
+}
Property changes on: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP11Endpoint.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP11EndpointBean.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP11EndpointBean.java (rev 0)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP11EndpointBean.java 2009-03-03 16:16:33 UTC (rev 9475)
@@ -0,0 +1,82 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.jbws2419;
+
+import static javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_MTOM_BINDING;
+
+import java.io.IOException;
+
+import javax.activation.DataHandler;
+import javax.annotation.Resource;
+import javax.jws.HandlerChain;
+import javax.jws.WebService;
+import javax.xml.bind.annotation.XmlMimeType;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.BindingType;
+import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+import javax.xml.ws.soap.MTOM;
+
+import org.jboss.logging.Logger;
+
+@WebService(name="SOAP11Endpoint", targetNamespace="http://org.jboss.ws/jaxws/jbws2419",
+ endpointInterface = "org.jboss.test.ws.jaxws.jbws2419.SOAP11Endpoint")
+@BindingType(SOAP11HTTP_MTOM_BINDING)
+@HandlerChain(file = "jaxws-server-handlers1.xml")
+public class SOAP11EndpointBean implements SOAP11Endpoint
+{
+ private static Logger log = Logger.getLogger(SOAP11EndpointBean.class);
+
+ @Resource
+ public WebServiceContext context;
+
+ @XmlMimeType("text/plain")
+ public DataHandler namespace(@XmlMimeType("text/plain") DataHandler data)
+ {
+ try
+ {
+ String name = (String)data.getContent();
+ String type = (String)data.getContentType();
+ log.info("User " + name + " requested namespace with content type ["+ type +"]");
+
+ SOAPMessageContext msgContext = (SOAPMessageContext)context.getMessageContext();
+ SOAPMessage soapMessage = msgContext.getMessage();
+ SOAPEnvelope soapEnvelope = (SOAPEnvelope)soapMessage.getSOAPPart().getEnvelope();
+ String nsURI = soapEnvelope.getNamespaceURI();
+
+ log.info(nsURI);
+
+ return new DataHandler(nsURI, "text/plain");
+ }
+ catch (IOException e)
+ {
+ throw new WebServiceException(e);
+ }
+ catch (SOAPException ex)
+ {
+ throw new WebServiceException(ex);
+ }
+ }
+}
Property changes on: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP11EndpointBean.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP11ServerHandler.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP11ServerHandler.java (rev 0)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP11ServerHandler.java 2009-03-03 16:16:33 UTC (rev 9475)
@@ -0,0 +1,101 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.jbws2419;
+
+import javax.mail.internet.ContentType;
+import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPConstants;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.jaxws.handler.GenericSOAPHandler;
+
+/**
+ * A SOAP 1.1 server side handler
+ *
+ * @author mageshbk(a)jboss.com
+ * @since 20-Feb-2009
+ */
+public class SOAP11ServerHandler extends GenericSOAPHandler
+{
+ private static Logger log = Logger.getLogger(SOAP11ServerHandler.class);
+
+ public boolean handleInbound(MessageContext msgContext)
+ {
+ log.info("handleInbound");
+
+ SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+
+ MimeHeaders mimeHeaders = soapMessage.getMimeHeaders();
+ String[] ct = mimeHeaders.getHeader("Content-Type");
+ ContentType contentType;
+ if (ct != null)
+ {
+ try
+ {
+ contentType = new ContentType(ct[0]);
+ log.info("contentType="+contentType);
+ String startInfo = contentType.getParameter("start-info");
+ if (startInfo.equals(SOAPConstants.SOAP_1_1_CONTENT_TYPE))
+ {
+ return true;
+ }
+ }
+ catch(Exception e)
+ {
+ throw new WebServiceException(e);
+ }
+ }
+ return false;
+ }
+
+ protected boolean handleOutbound(MessageContext msgContext)
+ {
+ log.info("handleOutbound");
+
+ try
+ {
+ SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+ soapMessage.saveChanges();
+
+ MimeHeaders mimeHeaders = soapMessage.getMimeHeaders();
+ String[] ct = mimeHeaders.getHeader("Content-Type");
+ ContentType contentType;
+ if (ct != null)
+ {
+ contentType = new ContentType(ct[0]);
+ log.info("contentType="+contentType);
+ if (contentType.getBaseType().equals(SOAPConstants.SOAP_1_1_CONTENT_TYPE))
+ return true;
+ }
+ return false;
+ }
+ catch (Exception ex)
+ {
+ throw new WebServiceException(ex);
+ }
+ }
+}
Property changes on: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP11ServerHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP12ClientHandler.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP12ClientHandler.java (rev 0)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP12ClientHandler.java 2009-03-03 16:16:33 UTC (rev 9475)
@@ -0,0 +1,101 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.jbws2419;
+
+import javax.mail.internet.ContentType;
+import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPConstants;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.jaxws.handler.GenericSOAPHandler;
+
+/**
+ * A SOAP 1.2 client side handler
+ *
+ * @author mageshbk(a)jboss.com
+ * @since 20-Feb-2009
+ */
+public class SOAP12ClientHandler extends GenericSOAPHandler
+{
+ private static Logger log = Logger.getLogger(SOAP12ClientHandler.class);
+
+ public boolean handleInbound(MessageContext msgContext)
+ {
+ log.info("handleInbound");
+
+ SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+
+ MimeHeaders mimeHeaders = soapMessage.getMimeHeaders();
+ String[] ct = mimeHeaders.getHeader("Content-Type");
+ ContentType contentType;
+ if (ct != null)
+ {
+ try
+ {
+ contentType = new ContentType(ct[0]);
+ log.info("contentType="+contentType);
+ String startInfo = contentType.getParameter("start-info");
+ if (startInfo.equals(SOAPConstants.SOAP_1_2_CONTENT_TYPE))
+ {
+ return true;
+ }
+ }
+ catch(Exception e)
+ {
+ throw new WebServiceException(e);
+ }
+ }
+ return false;
+ }
+
+ protected boolean handleOutbound(MessageContext msgContext)
+ {
+ log.info("handleOutbound");
+
+ try
+ {
+ SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+ soapMessage.saveChanges();
+
+ MimeHeaders mimeHeaders = soapMessage.getMimeHeaders();
+ String[] ct = mimeHeaders.getHeader("Content-Type");
+ ContentType contentType;
+ if (ct != null)
+ {
+ contentType = new ContentType(ct[0]);
+ log.info("contentType="+contentType);
+ if (contentType.getBaseType().equals(SOAPConstants.SOAP_1_2_CONTENT_TYPE))
+ return true;
+ }
+ return false;
+ }
+ catch (Exception ex)
+ {
+ throw new WebServiceException(ex);
+ }
+ }
+}
Property changes on: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP12ClientHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP12Endpoint.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP12Endpoint.java (rev 0)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP12Endpoint.java 2009-03-03 16:16:33 UTC (rev 9475)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.jbws2419;
+
+import static javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_MTOM_BINDING;
+
+import javax.activation.DataHandler;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+import javax.jws.soap.SOAPBinding.Style;
+import javax.xml.bind.annotation.XmlMimeType;
+import javax.xml.ws.BindingType;
+
+@WebService(name = "SOAP12Endpoint", targetNamespace = "http://org.jboss.ws/jaxws/jbws2419")
+@SOAPBinding(style = Style.RPC)
+@BindingType(SOAP12HTTP_MTOM_BINDING)
+
+public interface SOAP12Endpoint
+{
+ @XmlMimeType("text/plain")
+ public DataHandler namespace(@XmlMimeType("text/plain") DataHandler data);
+}
Property changes on: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP12Endpoint.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP12EndpointBean.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP12EndpointBean.java (rev 0)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP12EndpointBean.java 2009-03-03 16:16:33 UTC (rev 9475)
@@ -0,0 +1,82 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.jbws2419;
+
+import static javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_MTOM_BINDING;
+
+import java.io.IOException;
+
+import javax.activation.DataHandler;
+import javax.annotation.Resource;
+import javax.jws.HandlerChain;
+import javax.jws.WebService;
+import javax.xml.bind.annotation.XmlMimeType;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.BindingType;
+import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+import javax.xml.ws.soap.MTOM;
+
+import org.jboss.logging.Logger;
+
+@WebService(name="SOAP12Endpoint", targetNamespace="http://org.jboss.ws/jaxws/jbws2419",
+ endpointInterface = "org.jboss.test.ws.jaxws.jbws2419.SOAP12Endpoint")
+@BindingType(SOAP12HTTP_MTOM_BINDING)
+@HandlerChain(file = "jaxws-server-handlers2.xml")
+public class SOAP12EndpointBean implements SOAP12Endpoint
+{
+ private static Logger log = Logger.getLogger(SOAP12EndpointBean.class);
+
+ @Resource
+ public WebServiceContext context;
+
+ @XmlMimeType("text/plain")
+ public DataHandler namespace(@XmlMimeType("text/plain") DataHandler data)
+ {
+ try
+ {
+ String name = (String)data.getContent();
+ String type = (String)data.getContentType();
+ log.info("User " + name + " requested namespace with content type ["+ type +"]");
+
+ SOAPMessageContext msgContext = (SOAPMessageContext)context.getMessageContext();
+ SOAPMessage soapMessage = msgContext.getMessage();
+ SOAPEnvelope soapEnvelope = (SOAPEnvelope)soapMessage.getSOAPPart().getEnvelope();
+ String nsURI = soapEnvelope.getNamespaceURI();
+
+ log.info(nsURI);
+
+ return new DataHandler(nsURI, "text/plain");
+ }
+ catch (IOException e)
+ {
+ throw new WebServiceException(e);
+ }
+ catch (SOAPException ex)
+ {
+ throw new WebServiceException(ex);
+ }
+ }
+}
Property changes on: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP12EndpointBean.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP12ServerHandler.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP12ServerHandler.java (rev 0)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP12ServerHandler.java 2009-03-03 16:16:33 UTC (rev 9475)
@@ -0,0 +1,106 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.jbws2419;
+
+import javax.mail.internet.ContentType;
+import javax.mail.internet.ParseException;
+import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPConstants;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.jaxws.handler.GenericSOAPHandler;
+
+/**
+ * A SOAP 1.2 server side handler
+ *
+ * @author mageshbk(a)jboss.com
+ * @since 20-Feb-2009
+ */
+public class SOAP12ServerHandler extends GenericSOAPHandler
+{
+ private static Logger log = Logger.getLogger(SOAP12ServerHandler.class);
+
+ public boolean handleInbound(MessageContext msgContext)
+ {
+ log.info("handleInbound");
+
+ SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+
+ MimeHeaders mimeHeaders = soapMessage.getMimeHeaders();
+ String[] ct = mimeHeaders.getHeader("Content-Type");
+ ContentType contentType;
+ if (ct != null)
+ {
+ try
+ {
+ contentType = new ContentType(ct[0]);
+ log.info("contentType="+contentType);
+ String startInfo = contentType.getParameter("start-info");
+ if (startInfo.equals(SOAPConstants.SOAP_1_2_CONTENT_TYPE))
+ {
+ return true;
+ }
+ }
+ catch(Exception e)
+ {
+ throw new WebServiceException(e);
+ }
+ }
+ return false;
+ }
+
+ protected boolean handleOutbound(MessageContext msgContext)
+ {
+ log.info("handleOutbound");
+
+ try
+ {
+ SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+ soapMessage.saveChanges();
+
+ MimeHeaders mimeHeaders = soapMessage.getMimeHeaders();
+ String[] ct = mimeHeaders.getHeader("Content-Type");
+ ContentType contentType;
+ if (ct != null)
+ {
+ contentType = new ContentType(ct[0]);
+ log.info("contentType="+contentType);
+ if (contentType.getBaseType().equals(SOAPConstants.SOAP_1_2_CONTENT_TYPE))
+ return true;
+ }
+ return false;
+ }
+ catch (ParseException e)
+ {
+ throw new WebServiceException(e);
+ }
+ catch (SOAPException ex)
+ {
+ throw new WebServiceException(ex);
+ }
+ }
+}
Property changes on: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/SOAP12ServerHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/jaxws-server-handlers1.xml
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/jaxws-server-handlers1.xml (rev 0)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/jaxws-server-handlers1.xml 2009-03-03 16:16:33 UTC (rev 9475)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<handler-chains xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ns1="http://org.jboss.ws/jaxws/handlerscope"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee javaee_web_services_1_2.xsd">
+
+ <handler-chain>
+ <handler>
+ <handler-name> SOAP11ServerHandler </handler-name>
+ <handler-class> org.jboss.test.ws.jaxws.jbws2419.SOAP11ServerHandler </handler-class>
+ </handler>
+ </handler-chain>
+
+</handler-chains>
\ No newline at end of file
Property changes on: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/jaxws-server-handlers1.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/jaxws-server-handlers2.xml
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/jaxws-server-handlers2.xml (rev 0)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/jaxws-server-handlers2.xml 2009-03-03 16:16:33 UTC (rev 9475)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<handler-chains xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ns1="http://org.jboss.ws/jaxws/handlerscope"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee javaee_web_services_1_2.xsd">
+
+ <handler-chain>
+ <handler>
+ <handler-name> SOAP12ServerHandler </handler-name>
+ <handler-class> org.jboss.test.ws.jaxws.jbws2419.SOAP12ServerHandler </handler-class>
+ </handler>
+ </handler-chain>
+
+</handler-chains>
\ No newline at end of file
Property changes on: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbws2419/jaxws-server-handlers2.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2419/WEB-INF/web.xml
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2419/WEB-INF/web.xml (rev 0)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2419/WEB-INF/web.xml 2009-03-03 16:16:33 UTC (rev 9475)
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+ version="2.4">
+
+ <servlet>
+ <servlet-name>TestSOAP12Service</servlet-name>
+ <servlet-class>org.jboss.test.ws.jaxws.jbws2419.SOAP12EndpointBean</servlet-class>
+ </servlet>
+
+ <servlet>
+ <servlet-name>TestSOAP11Service</servlet-name>
+ <servlet-class>org.jboss.test.ws.jaxws.jbws2419.SOAP11EndpointBean</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>TestSOAP12Service</servlet-name>
+ <url-pattern>/soap12/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>TestSOAP11Service</servlet-name>
+ <url-pattern>/soap11/*</url-pattern>
+ </servlet-mapping>
+
+</web-app>
+
Property changes on: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbws2419/WEB-INF/web.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
15 years, 2 months
JBossWS SVN: r9474 - in stack/native/branches/dlofthouse/JBPAPP-1746: src/main/java/org/jboss/ws/core and 6 other directories.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2009-03-03 11:00:12 -0500 (Tue, 03 Mar 2009)
New Revision: 9474
Added:
stack/native/branches/dlofthouse/JBPAPP-1746/src/test/java/org/jboss/test/ws/jaxws/samples/wssecurity/SimpleDispatchTestCase.java
Modified:
stack/native/branches/dlofthouse/JBPAPP-1746/.classpath
stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/core/ConfigProvider.java
stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/core/StubExt.java
stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/core/client/EndpointInfo.java
stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/core/jaxws/binding/BindingExt.java
stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java
stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java
stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/extensions/security/WSSecurityDispatcher.java
stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/metadata/umdm/ClientEndpointMetaData.java
Log:
Backport 1
Modified: stack/native/branches/dlofthouse/JBPAPP-1746/.classpath
===================================================================
--- stack/native/branches/dlofthouse/JBPAPP-1746/.classpath 2009-03-03 12:41:51 UTC (rev 9473)
+++ stack/native/branches/dlofthouse/JBPAPP-1746/.classpath 2009-03-03 16:00:12 UTC (rev 9474)
@@ -12,6 +12,7 @@
<classpathentry kind="lib" path="thirdparty/jaxb-impl.jar"/>
<classpathentry kind="lib" path="thirdparty/jaxb-xjc.jar"/>
<classpathentry kind="lib" path="thirdparty/jboss-dependency.jar"/>
+ <classpathentry kind="lib" path="thirdparty/jboss-common-core.jar"/>
<classpathentry kind="lib" path="thirdparty/jboss-j2ee.jar"/>
<classpathentry kind="lib" path="thirdparty/jboss-logging-spi.jar"/>
<classpathentry kind="lib" path="thirdparty/jboss-microcontainer.jar"/>
Modified: stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/core/ConfigProvider.java
===================================================================
--- stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/core/ConfigProvider.java 2009-03-03 12:41:51 UTC (rev 9473)
+++ stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/core/ConfigProvider.java 2009-03-03 16:00:12 UTC (rev 9474)
@@ -50,4 +50,14 @@
* Set the port configuration name and file
*/
void setConfigName(String configName, String configFile);
+
+ /**
+ * Get the WS-Security configuration
+ */
+ String getSecurityConfig();
+
+ /**
+ * Set the WS-Security configuration
+ */
+ void setSecurityConfig(String securityConfig);
}
Modified: stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/core/StubExt.java
===================================================================
--- stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/core/StubExt.java 2009-03-03 12:41:51 UTC (rev 9473)
+++ stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/core/StubExt.java 2009-03-03 16:00:12 UTC (rev 9474)
@@ -136,14 +136,4 @@
* Creates a new empty AttachmentPart object.
*/
AttachmentPart createAttachmentPart();
-
- /**
- * Get the WS-Security configuration
- */
- String getSecurityConfig();
-
- /**
- * Set the WS-Security configuration
- */
- void setSecurityConfig(String securityConfig);
}
Modified: stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/core/client/EndpointInfo.java
===================================================================
--- stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/core/client/EndpointInfo.java 2009-03-03 12:41:51 UTC (rev 9473)
+++ stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/core/client/EndpointInfo.java 2009-03-03 16:00:12 UTC (rev 9474)
@@ -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/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/core/jaxws/binding/BindingExt.java
===================================================================
--- stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/core/jaxws/binding/BindingExt.java 2009-03-03 12:41:51 UTC (rev 9473)
+++ stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/core/jaxws/binding/BindingExt.java 2009-03-03 16:00:12 UTC (rev 9474)
@@ -21,6 +21,8 @@
*/
package org.jboss.ws.core.jaxws.binding;
+//$Id$
+
import java.util.List;
import javax.xml.ws.Binding;
@@ -28,7 +30,6 @@
import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
-// $Id$
/**
* Extension to JAXWS protocol bindings.
@@ -38,7 +39,9 @@
*/
public interface BindingExt extends Binding
{
+ /** Get the handler chain for a given type */
List<Handler> getHandlerChain(HandlerType handlerType);
-
+
+ /** Set the handler chain for a given type */
void setHandlerChain(List<Handler> handlerChain, HandlerType handlerType);
}
Modified: stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java
===================================================================
--- stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java 2009-03-03 12:41:51 UTC (rev 9473)
+++ stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java 2009-03-03 16:00:12 UTC (rev 9474)
@@ -56,7 +56,6 @@
import org.jboss.ws.core.jaxws.handler.HandlerChainExecutor;
import org.jboss.ws.core.jaxws.handler.HandlerResolverImpl;
import org.jboss.ws.core.jaxws.handler.MessageContextJAXWS;
-import org.jboss.ws.core.jaxws.handler.PortInfoImpl;
import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.metadata.umdm.ClientEndpointMetaData;
@@ -76,7 +75,7 @@
{
// the associated endpoint meta data
- private final EndpointMetaData epMetaData;
+ private final ClientEndpointMetaData epMetaData;
private EndpointConfigMetaData epConfigMetaData;
// Keep a handle on the resolver so that updateConfig calls may revisit the associated chains
@@ -91,7 +90,7 @@
super(epMetaData);
setTargetEndpointAddress(epMetaData.getEndpointAddress());
- this.epMetaData = epMetaData;
+ this.epMetaData = (ClientEndpointMetaData)epMetaData;
this.epConfigMetaData = epMetaData.getEndpointConfigMetaData();
if (handlerResolver instanceof HandlerResolverImpl)
@@ -113,7 +112,7 @@
{
BindingExt binding = (BindingExt)getBindingProvider().getBinding();
- PortInfo portInfo = getPortInfo(epMetaData);
+ PortInfo portInfo = epMetaData.getPortInfo();
if (handlerResolver != null)
{
@@ -427,12 +426,4 @@
return Boolean.TRUE.equals(bool);
}
- private PortInfo getPortInfo(EndpointMetaData epMetaData)
- {
- QName serviceName = epMetaData.getServiceMetaData().getServiceName();
- QName portName = epMetaData.getPortName();
- String bindingID = epMetaData.getBindingId();
- PortInfo portInfo = new PortInfoImpl(serviceName, portName, bindingID);
- return portInfo;
- }
}
\ No newline at end of file
Modified: stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java
===================================================================
--- stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java 2009-03-03 12:41:51 UTC (rev 9473)
+++ stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java 2009-03-03 16:00:12 UTC (rev 9474)
@@ -24,12 +24,18 @@
// $Id$
import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import javax.xml.bind.JAXBContext;
+import javax.xml.namespace.QName;
import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFactory;
+import javax.xml.soap.SOAPFault;
import javax.xml.soap.SOAPMessage;
import javax.xml.transform.Source;
import javax.xml.ws.AsyncHandler;
@@ -40,22 +46,39 @@
import javax.xml.ws.Response;
import javax.xml.ws.WebServiceException;
import javax.xml.ws.Service.Mode;
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.PortInfo;
import javax.xml.ws.http.HTTPBinding;
import javax.xml.ws.soap.SOAPFaultException;
import org.jboss.logging.Logger;
import org.jboss.util.NotImplementedException;
+import org.jboss.ws.WSException;
import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.ConfigProvider;
import org.jboss.ws.core.MessageAbstraction;
-import org.jboss.ws.core.ConfigProvider;
+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;
+import org.jboss.ws.core.jaxws.binding.BindingExt;
import org.jboss.ws.core.jaxws.binding.BindingProviderImpl;
+import org.jboss.ws.core.jaxws.handler.HandlerChainExecutor;
+import org.jboss.ws.core.jaxws.handler.HandlerResolverImpl;
+import org.jboss.ws.core.jaxws.handler.MessageContextJAXWS;
import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
+import org.jboss.ws.metadata.config.ConfigurationProvider;
+import org.jboss.ws.metadata.umdm.ClientEndpointMetaData;
+import org.jboss.ws.metadata.umdm.EndpointConfigMetaData;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
-import org.jboss.ws.metadata.config.ConfigurationProvider;
+import org.jboss.ws.metadata.umdm.ServiceMetaData;
+import org.jboss.ws.metadata.wsse.WSSecurityConfigFactory;
+import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
+import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
/**
* The Dispatch interface provides support for the dynamic invocation of a service endpoint operations.
@@ -64,22 +87,26 @@
* @author Thomas.Diesler(a)jboss.com
* @since 04-Jul-2006
*/
-public class DispatchImpl<T> implements Dispatch<T>
+public class DispatchImpl<T> implements Dispatch<T>, ConfigProvider
{
// provide logging
private final Logger log = Logger.getLogger(DispatchImpl.class);
private BindingProvider bindingProvider;
- private EndpointMetaData epMetaData;
+ private HandlerResolverImpl handlerResolver;
+ private ClientEndpointMetaData epMetaData;
private JAXBContext jaxbContext;
private ExecutorService executor;
+ private String securityConfig;
private Class type;
private Mode mode;
+ private Map<HandlerType, HandlerChainExecutor> executorMap = new HashMap<HandlerType, HandlerChainExecutor>();
+
public DispatchImpl(ExecutorService executor, EndpointMetaData epMetaData, Class<T> type, Mode mode)
{
this.bindingProvider = new BindingProviderImpl(epMetaData);
- this.epMetaData = epMetaData;
+ this.epMetaData = (ClientEndpointMetaData)epMetaData;
this.executor = executor;
this.type = type;
this.mode = mode;
@@ -89,7 +116,7 @@
public DispatchImpl(ExecutorService executor, EndpointMetaData epMetaData, JAXBContext jbc, Mode mode)
{
this.bindingProvider = new BindingProviderImpl(epMetaData);
- this.epMetaData = epMetaData;
+ this.epMetaData = (ClientEndpointMetaData)epMetaData;
this.executor = executor;
this.type = Object.class;
this.jaxbContext = jbc;
@@ -111,11 +138,50 @@
return retObj;
}
- private Object invokeInternal(Object obj, Map<String, Object> resContext) throws IOException
+ private Object invokeInternal(Object obj, Map<String, Object> resContext) throws Exception
{
- MessageAbstraction reqMsg = getRequestMessage(obj);
+ Object retObj = null;
+
+ BindingExt binding = (BindingExt)bindingProvider.getBinding();
+
+ String bindingID = binding.getBindingID();
+ if (bindingID.indexOf("soap") > 0)
+ {
+ // Init the handler chain
+ if (handlerResolver == null)
+ {
+ handlerResolver = new HandlerResolverImpl();
+ EndpointConfigMetaData ecmd = epMetaData.getEndpointConfigMetaData();
+ handlerResolver.initHandlerChain(ecmd, HandlerType.PRE, true);
+ handlerResolver.initHandlerChain(ecmd, HandlerType.ENDPOINT, true);
+ handlerResolver.initHandlerChain(ecmd, HandlerType.POST, true);
+
+ PortInfo portInfo = epMetaData.getPortInfo();
+ List<Handler> preChain = handlerResolver.getHandlerChain(portInfo, HandlerType.PRE);
+ List<Handler> epChain = handlerResolver.getHandlerChain(portInfo, HandlerType.ENDPOINT);
+ List<Handler> postChain = handlerResolver.getHandlerChain(portInfo, HandlerType.POST);
+
+ binding.setHandlerChain(preChain, HandlerType.PRE);
+ binding.setHandlerChain(epChain, HandlerType.ENDPOINT);
+ binding.setHandlerChain(postChain, HandlerType.POST);
+ }
+
+ retObj = invokeInternalSOAP(obj);
+ }
+ else
+ {
+ retObj = invokeInternalNonSOAP(obj);
+ }
+ return retObj;
+ }
+
+ private Object invokeInternalSOAP(Object obj) throws Exception
+ {
+ Object retObj = null;
+
+ SOAPMessageImpl reqMsg = (SOAPMessageImpl)getRequestMessage(obj);
String targetAddress = epMetaData.getEndpointAddress();
-
+
// R2744 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field
// with a quoted value equal to the value of the soapAction attribute of
// soapbind:operation, if present in the corresponding WSDL description.
@@ -124,22 +190,92 @@
// with a quoted empty string value, if in the corresponding WSDL description,
// the soapAction attribute of soapbind:operation is either not present, or
// present with an empty string as its value.
- String bindingID = bindingProvider.getBinding().getBindingID();
- if (bindingID.indexOf("soap") > 0)
+ String soapAction = null;
+ Map<String, Object> reqContext = getRequestContext();
+ Boolean useSOAPAction = (Boolean)reqContext.get(BindingProvider.SOAPACTION_USE_PROPERTY);
+ if (Boolean.TRUE.equals(useSOAPAction))
{
- String soapAction = null;
- Map<String, Object> reqContext = getRequestContext();
- Boolean useSOAPAction = (Boolean)reqContext.get(BindingProvider.SOAPACTION_USE_PROPERTY);
- if (Boolean.TRUE.equals(useSOAPAction))
+ soapAction = (String)reqContext.get(BindingProvider.SOAPACTION_URI_PROPERTY);
+ if (soapAction == null)
+ throw new IllegalStateException("Cannot obtain: " + BindingProvider.SOAPACTION_URI_PROPERTY);
+ }
+ MimeHeaders mimeHeaders = reqMsg.getMimeHeaders();
+ mimeHeaders.addHeader("SOAPAction", soapAction != null ? soapAction : "");
+
+ // Get the order of pre/post handlerchains
+ HandlerType[] handlerType = new HandlerType[] { HandlerType.PRE, HandlerType.ENDPOINT, HandlerType.POST };
+ HandlerType[] faultType = new HandlerType[] { HandlerType.PRE, HandlerType.ENDPOINT, HandlerType.POST };
+
+ // Associate a message context with the current thread
+ CommonMessageContext msgContext = new SOAPMessageContextJAXWS();
+ 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);
+
+ QName portName = epMetaData.getPortName();
+ try
+ {
+ // Call the request handlers
+ boolean handlerPass = callRequestHandlerChain(portName, handlerType[0]);
+ handlerPass = handlerPass && callRequestHandlerChain(portName, handlerType[1]);
+ handlerPass = handlerPass && callRequestHandlerChain(portName, handlerType[2]);
+
+ // Handlers might have replaced the message
+ reqMsg = (SOAPMessageImpl)msgContext.getSOAPMessage();
+
+ MessageAbstraction resMsg = null;
+ if (handlerPass)
{
- soapAction = (String)reqContext.get(BindingProvider.SOAPACTION_URI_PROPERTY);
- if (soapAction == null)
- throw new IllegalStateException("Cannot obtain: " + BindingProvider.SOAPACTION_URI_PROPERTY);
+ 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]);
+ faultType[2] = null;
+ handlerPass = handlerPass && callResponseHandlerChain(portName, handlerType[1]);
+ faultType[1] = null;
+ handlerPass = handlerPass && callResponseHandlerChain(portName, handlerType[0]);
+ faultType[0] = null;
}
- MimeHeaders mimeHeaders = reqMsg.getMimeHeaders();
- mimeHeaders.addHeader("SOAPAction", soapAction != null ? soapAction : "");
+
+ if (handlerPass)
+ {
+ retObj = getReturnObject(resMsg);
+ }
}
-
+ catch (Exception ex)
+ {
+ if (faultType[2] != null)
+ callFaultHandlerChain(portName, faultType[2], ex);
+ if (faultType[1] != null)
+ callFaultHandlerChain(portName, faultType[1], ex);
+ if (faultType[0] != null)
+ callFaultHandlerChain(portName, faultType[0], ex);
+
+ throw ex;
+ }
+ finally
+ {
+ closeHandlerChain(portName, handlerType[2]);
+ closeHandlerChain(portName, handlerType[1]);
+ closeHandlerChain(portName, handlerType[0]);
+
+ MessageContextAssociation.popMessageContext();
+ }
+ return retObj;
+ }
+
+ private Object invokeInternalNonSOAP(Object obj) throws IOException
+ {
+ MessageAbstraction reqMsg = getRequestMessage(obj);
+ String targetAddress = epMetaData.getEndpointAddress();
MessageAbstraction resMsg = getRemotingConnection().invoke(reqMsg, targetAddress, false);
Object retObj = getReturnObject(resMsg);
return retObj;
@@ -260,7 +396,19 @@
{
// jaxws/api/javax_xml_ws/Dispatch/Client.java#invokeTestJAXBNull
if (obj == null)
- throw new SOAPFaultException("Request object cannot be null");
+ {
+ try
+ {
+ SOAPFactory factory = SOAPFactory.newInstance();
+ SOAPFault fault = factory.createFault("Request object cannot be null", new QName("http://org.jboss.ws", "Dispatch"));
+ fault.setFaultActor("client");
+ throw new SOAPFaultException(fault);
+ }
+ catch (SOAPException e)
+ {
+ //
+ }
+ }
String bindingID = bindingProvider.getBinding().getBindingID();
if (EndpointMetaData.SUPPORTED_BINDINGS.contains(bindingID) == false)
@@ -314,7 +462,7 @@
throw new IllegalArgumentException("Async response cannot be null");
if (payload == null)
throw new IllegalArgumentException("Async payload cannot be null");
-
+
this.response = response;
this.handler = handler;
this.payload = payload;
@@ -371,4 +519,85 @@
{
throw new NotImplementedException();
}
+
+ public String getConfigFile()
+ {
+ return epMetaData.getConfigFile();
+ }
+
+ public String getConfigName()
+ {
+ return epMetaData.getConfigName();
+ }
+
+ public void setConfigName(String configName)
+ {
+ epMetaData.setConfigName(configName);
+ }
+
+ public void setConfigName(String configName, String configFile)
+ {
+ epMetaData.setConfigName(configName, configFile);
+ }
+
+ public String getSecurityConfig()
+ {
+ return securityConfig;
+ }
+
+ public void setSecurityConfig(String securityConfig)
+ {
+ this.securityConfig = securityConfig;
+
+ if (securityConfig != null)
+ {
+ ServiceMetaData serviceMetaData = epMetaData.getServiceMetaData();
+ if (serviceMetaData.getSecurityConfiguration() == null)
+ {
+ try
+ {
+ WSSecurityConfigFactory wsseConfFactory = WSSecurityConfigFactory.newInstance();
+ UnifiedVirtualFile vfsRoot = serviceMetaData.getUnifiedMetaData().getRootFile();
+ WSSecurityConfiguration config = wsseConfFactory.createConfiguration(vfsRoot, securityConfig);
+ serviceMetaData.setSecurityConfiguration(config);
+ }
+ catch (IOException ex)
+ {
+ WSException.rethrow("Cannot set security config", ex);
+ }
+ }
+ }
+ }
+
+ private boolean callRequestHandlerChain(QName portName, HandlerType type)
+ {
+ BindingExt binding = (BindingExt)bindingProvider.getBinding();
+ HandlerChainExecutor executor = new HandlerChainExecutor(epMetaData, binding.getHandlerChain(type));
+ executorMap.put(type, executor);
+
+ MessageContext msgContext = (MessageContext)MessageContextAssociation.peekMessageContext();
+ return executor.handleMessage(msgContext);
+ }
+
+ private boolean callResponseHandlerChain(QName portName, HandlerType type)
+ {
+ MessageContext msgContext = (MessageContext)MessageContextAssociation.peekMessageContext();
+ HandlerChainExecutor executor = executorMap.get(type);
+ return (executor != null ? executor.handleMessage(msgContext) : true);
+ }
+
+ private boolean callFaultHandlerChain(QName portName, HandlerType type, Exception ex)
+ {
+ MessageContext msgContext = (MessageContext)MessageContextAssociation.peekMessageContext();
+ HandlerChainExecutor executor = executorMap.get(type);
+ return (executor != null ? executor.handleFault(msgContext, ex) : true);
+ }
+
+ private void closeHandlerChain(QName portName, HandlerType type)
+ {
+ MessageContext msgContext = (MessageContext)MessageContextAssociation.peekMessageContext();
+ HandlerChainExecutor executor = executorMap.get(type);
+ if (executor != null)
+ executor.close(msgContext);
+ }
}
Modified: stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/extensions/security/WSSecurityDispatcher.java
===================================================================
--- stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/extensions/security/WSSecurityDispatcher.java 2009-03-03 12:41:51 UTC (rev 9473)
+++ stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/extensions/security/WSSecurityDispatcher.java 2009-03-03 16:00:12 UTC (rev 9474)
@@ -85,13 +85,13 @@
return newList;
}
- private static Config getConfig(WSSecurityConfiguration config, String portName, String operationName)
+ private static Config getConfig(WSSecurityConfiguration config, String portName, String opName)
{
Port port = config.getPorts().get(portName);
if (port == null)
return config.getDefaultConfig();
- Operation operation = port.getOperations().get(operationName);
+ Operation operation = port.getOperations().get(opName);
if (operation == null)
{
Config portConfig = port.getDefaultConfig();
@@ -288,26 +288,29 @@
WSSecurityConfiguration config = getSecurityConfig(ctx);
SOAPMessageImpl soapMessage = (SOAPMessageImpl)ctx.getSOAPMessage();
+ EndpointMetaData epMetaData = ctx.getEndpointMetaData();
+ String port = epMetaData.getPortName().getLocalPart();
+
+ String opName = null;
OperationMetaData opMetaData = ctx.getOperationMetaData();
- String operation = opMetaData.getQName().toString();
- String port = opMetaData.getEndpointMetaData().getPortName().getLocalPart();
+ if (opMetaData != null)
+ opName = opMetaData.getQName().toString();
- Config operationConfig = getConfig(config, port, operation);
+ Config opConfig = getConfig(config, port, opName);
+ log.debug("WS-Security config: " + opConfig);
- log.debug("WS-Security config: " + operationConfig);
-
// Nothing to process
- if (operationConfig == null)
+ if (opConfig == null)
return;
ArrayList<OperationDescription<EncodingOperation>> operations = new ArrayList<OperationDescription<EncodingOperation>>();
- Timestamp timestamp = operationConfig.getTimestamp();
+ Timestamp timestamp = opConfig.getTimestamp();
if (timestamp != null)
{
operations.add(new OperationDescription<EncodingOperation>(TimestampOperation.class, null, null, timestamp.getTtl(), null));
}
- if (operationConfig.getUsername() != null)
+ if (opConfig.getUsername() != null)
{
Object user = ctx.get(Stub.USERNAME_PROPERTY);
Object pass = ctx.get(Stub.PASSWORD_PROPERTY);
@@ -325,7 +328,7 @@
}
}
- Sign sign = operationConfig.getSign();
+ Sign sign = opConfig.getSign();
if (sign != null)
{
List<Target> targets = convertTargets(sign.getTargets());
@@ -341,7 +344,7 @@
operations.add(new OperationDescription<EncodingOperation>(SignatureOperation.class, targets, sign.getAlias(), null, null));
}
- Encrypt encrypt = operationConfig.getEncrypt();
+ Encrypt encrypt = opConfig.getEncrypt();
if (encrypt != null)
{
List<Target> targets = convertTargets(encrypt.getTargets());
Modified: stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/metadata/umdm/ClientEndpointMetaData.java
===================================================================
--- stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/metadata/umdm/ClientEndpointMetaData.java 2009-03-03 12:41:51 UTC (rev 9473)
+++ stack/native/branches/dlofthouse/JBPAPP-1746/src/main/java/org/jboss/ws/metadata/umdm/ClientEndpointMetaData.java 2009-03-03 16:00:12 UTC (rev 9474)
@@ -24,7 +24,9 @@
// $Id$
import javax.xml.namespace.QName;
+import javax.xml.ws.handler.PortInfo;
+import org.jboss.ws.core.jaxws.handler.PortInfoImpl;
import org.jboss.ws.metadata.config.ConfigurationProvider;
import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
@@ -64,11 +66,20 @@
this.endpointAddress = endpointAddress;
}
+ public PortInfo getPortInfo()
+ {
+ QName serviceName = getServiceMetaData().getServiceName();
+ QName portName = getPortName();
+ String bindingID = getBindingId();
+ PortInfo portInfo = new PortInfoImpl(serviceName, portName, bindingID);
+ return portInfo;
+ }
+
public EndpointConfigMetaData createEndpointConfigMetaData(String configName, String configFile)
{
return super.createEndpointConfigMetaData(configName, configFile);
}
-
+
public String toString()
{
StringBuilder buffer = new StringBuilder("\nClientEndpointMetaData:");
Copied: stack/native/branches/dlofthouse/JBPAPP-1746/src/test/java/org/jboss/test/ws/jaxws/samples/wssecurity/SimpleDispatchTestCase.java (from rev 4701, stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/wssecurity/SimpleDispatchTestCase.java)
===================================================================
--- stack/native/branches/dlofthouse/JBPAPP-1746/src/test/java/org/jboss/test/ws/jaxws/samples/wssecurity/SimpleDispatchTestCase.java (rev 0)
+++ stack/native/branches/dlofthouse/JBPAPP-1746/src/test/java/org/jboss/test/ws/jaxws/samples/wssecurity/SimpleDispatchTestCase.java 2009-03-03 16:00:12 UTC (rev 9474)
@@ -0,0 +1,109 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.samples.wssecurity;
+
+import java.io.File;
+import java.io.StringReader;
+import java.net.URL;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.Service;
+import javax.xml.ws.Service.Mode;
+
+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
+ *
+ * http://jira.jboss.org/jira/browse/JBWS-1817
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 02-Oct-2007
+ */
+public class SimpleDispatchTestCase extends JBossWSTest
+{
+ private static Dispatch dispatch;
+
+ public static Test suite() throws Exception
+ {
+ return new JBossWSTestSetup(SimpleDispatchTestCase.class, "jaxws-samples-wssecurity-username.war");
+ }
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ if (dispatch == null)
+ {
+ URL wsdlURL = new File("resources/jaxws/samples/wssecurity/simple-username/META-INF/wsdl/UsernameService.wsdl").toURL();
+ URL securityURL = new File("resources/jaxws/samples/wssecurity/simple-username/META-INF/jboss-wsse-client.xml").toURL();
+ QName serviceName = new QName("http://org.jboss.ws/samples/wssecurity", "UsernameService");
+ QName portName = new QName("http://org.jboss.ws/samples/wssecurity", "UsernameEndpointPort");
+
+ Service service = Service.create(wsdlURL, serviceName);
+ dispatch = service.createDispatch(portName, Source.class, Mode.PAYLOAD);
+
+ ((ConfigProvider)dispatch).setSecurityConfig(securityURL.toExternalForm());
+ ((ConfigProvider)dispatch).setConfigName("Standard WSSecurity Client");
+ }
+ }
+
+ public void testUsernameTokenNegative() throws Exception
+ {
+ try
+ {
+ String payload = "<ns1:getUsernameToken xmlns:ns1='http://org.jboss.ws/samples/wssecurity'/>";
+ dispatch.invoke(new StreamSource(new StringReader(payload)));
+ fail("Server should respond with [401] - Unauthorized");
+ }
+ catch (Exception ex)
+ {
+ // this should be ok
+ }
+ }
+
+ public void testUsernameToken() throws Exception
+ {
+ Map<String, Object> reqContext = dispatch.getRequestContext();
+ reqContext.put(BindingProvider.USERNAME_PROPERTY, "kermit");
+ reqContext.put(BindingProvider.PASSWORD_PROPERTY, "thefrog");
+
+ String payload = "<ns1:getUsernameToken xmlns:ns1='http://org.jboss.ws/samples/wssecurity'/>";
+ 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
15 years, 2 months
JBossWS SVN: r9473 - framework/branches.
by jbossws-commits@lists.jboss.org
Author: mageshbk(a)jboss.com
Date: 2009-03-03 07:41:51 -0500 (Tue, 03 Mar 2009)
New Revision: 9473
Removed:
framework/branches/jbossws-framework-2.0.1.GA_CP03_JBPAPP-1730/
Log:
[JBPAPP-1730] Deleting this Branch as the tests are included in the stack itself
15 years, 2 months