[jbossws-commits] JBossWS SVN: r3569 - in branches/jbossws-2.0/jbossws-core/src: main/java/org/jboss/ws/extensions/addressing/jaxws and 3 other directories.
jbossws-commits at lists.jboss.org
jbossws-commits at lists.jboss.org
Wed Jun 13 10:31:02 EDT 2007
Author: heiko.braun at jboss.com
Date: 2007-06-13 10:31:02 -0400 (Wed, 13 Jun 2007)
New Revision: 3569
Added:
branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/action/AddressingHandlerEnableMU.java
branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/action/CustomAddressingHandler.java
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/extensions/addressing/jaxrpc/WSAddressingClientHandler.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/extensions/addressing/jaxrpc/WSAddressingServerHandler.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/extensions/addressing/jaxws/WSAddressingClientHandler.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/extensions/addressing/jaxws/WSAddressingServerHandler.java
branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/SOAPAddressingPropertiesTestCase.java
branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/action/ActionEndpoint.java
branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/action/ActionRpcEndpointImpl.java
branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/action/AddressingActionTestCase.java
branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/replyto/AddressingReplyToTestCase.java
Log:
Fix JBWS-1263
Modified: branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/extensions/addressing/jaxrpc/WSAddressingClientHandler.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/extensions/addressing/jaxrpc/WSAddressingClientHandler.java 2007-06-13 14:29:56 UTC (rev 3568)
+++ branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/extensions/addressing/jaxrpc/WSAddressingClientHandler.java 2007-06-13 14:31:02 UTC (rev 3569)
@@ -36,7 +36,11 @@
import org.jboss.logging.Logger;
import org.jboss.ws.extensions.addressing.soap.SOAPAddressingPropertiesImpl;
+import org.jboss.ws.extensions.addressing.AddressingConstantsImpl;
+import java.util.Set;
+import java.util.HashSet;
+
/**
* A client side handler that reads/writes the addressing properties
* and puts then into the message context.
@@ -49,27 +53,27 @@
// Provide logging
private static Logger log = Logger.getLogger(WSAddressingClientHandler.class);
- // addressing builder & constants
- private AddressingBuilder addrBuilder;
-
- // should the request be normalized according to the specifications
- private boolean normalize;
-
- public WSAddressingClientHandler()
+ private static AddressingBuilder ADDR_BUILDER;
+ private static AddressingConstantsImpl ADDR_CONSTANTS;
+ private static QName[] HEADERS = new QName[2];
+
+ static
{
- addrBuilder = AddressingBuilder.getAddressingBuilder();
- }
+ ADDR_CONSTANTS = new AddressingConstantsImpl();
+ ADDR_BUILDER = AddressingBuilder.getAddressingBuilder();
- public QName[] getHeaders()
+ HEADERS[0] = ADDR_CONSTANTS.getActionQName();
+ HEADERS[1] = ADDR_CONSTANTS.getToQName();
+ }
+
+ public QName[] getHeaders()
{
- return new QName[] {};
+ return HEADERS;
}
public void init(HandlerInfo handlerInfo)
{
super.init(handlerInfo);
- normalize = "true".equals(handlerInfo.getHandlerConfig().get("normalize"));
-
}
public boolean handleRequest(MessageContext msgContext)
@@ -80,31 +84,19 @@
if (addrProps != null)
{
- if (normalize)
- normalizeRequest(msgContext, addrProps);
-
SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
addrProps.writeHeaders(soapMessage);
}
else
{
// supply default addressing properties
- addrProps = (SOAPAddressingPropertiesImpl)addrBuilder.newAddressingProperties();
+ addrProps = (SOAPAddressingPropertiesImpl)ADDR_BUILDER.newAddressingProperties();
msgContext.setProperty(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND, addrProps);
-
- if (normalize)
- normalizeRequest(msgContext, addrProps);
}
return true;
}
- /* supply the default addressing properties in case elements are missing */
- private void normalizeRequest(MessageContext msgContext, SOAPAddressingProperties addrProps)
- {
- // TODO: supply default header
- }
-
public boolean handleResponse(MessageContext msgContext)
{
if(log.isDebugEnabled()) log.debug("handleResponse");
Modified: branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/extensions/addressing/jaxrpc/WSAddressingServerHandler.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/extensions/addressing/jaxrpc/WSAddressingServerHandler.java 2007-06-13 14:29:56 UTC (rev 3568)
+++ branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/extensions/addressing/jaxrpc/WSAddressingServerHandler.java 2007-06-13 14:31:02 UTC (rev 3569)
@@ -22,6 +22,8 @@
package org.jboss.ws.extensions.addressing.jaxrpc;
import java.net.URISyntaxException;
+import java.util.Set;
+import java.util.HashSet;
import javax.xml.namespace.QName;
import javax.xml.rpc.handler.GenericHandler;
@@ -52,27 +54,27 @@
// Provide logging
private static Logger log = Logger.getLogger(WSAddressingServerHandler.class);
- // should the request be validated?
- private boolean validate = true;
-
private static AddressingBuilder ADDR_BUILDER;
private static AddressingConstantsImpl ADDR_CONSTANTS;
+ private static QName[] HEADERS = new QName[2];
+
static
{
ADDR_CONSTANTS = new AddressingConstantsImpl();
ADDR_BUILDER = AddressingBuilder.getAddressingBuilder();
+
+ HEADERS[0] = ADDR_CONSTANTS.getActionQName();
+ HEADERS[1] = ADDR_CONSTANTS.getToQName();
}
public QName[] getHeaders()
{
- return new QName[] {};
+ return HEADERS;
}
public void init(HandlerInfo handlerInfo)
{
super.init(handlerInfo);
- String strValidate = (String)handlerInfo.getHandlerConfig().get("validate");
- validate = "true".equals(strValidate);
}
/**
@@ -87,10 +89,6 @@
SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
addrProps.readHeaders(soapMessage);
msgContext.setProperty(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND, addrProps);
-
- if (validate)
- validateRequest(addrProps);
-
return true;
}
@@ -166,14 +164,4 @@
outProps.writeHeaders(soapMessage);
}
-
- /* check wsa formal constraints */
- private void validateRequest(SOAPAddressingProperties addrProps)
- {
-
- // If wsa:ReplyTo is supplied and the message lacks a [message id] property, the processor MUST fault.
- if (addrProps.getReplyTo() != null && addrProps.getMessageID() == null)
- throw new IllegalArgumentException("wsa:MessageId is required when wsa:ReplyTo is supplied");
-
- }
}
Modified: branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/extensions/addressing/jaxws/WSAddressingClientHandler.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/extensions/addressing/jaxws/WSAddressingClientHandler.java 2007-06-13 14:29:56 UTC (rev 3568)
+++ branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/extensions/addressing/jaxws/WSAddressingClientHandler.java 2007-06-13 14:31:02 UTC (rev 3569)
@@ -21,6 +21,12 @@
*/
package org.jboss.ws.extensions.addressing.jaxws;
+import org.jboss.logging.Logger;
+import org.jboss.ws.extensions.addressing.AddressingConstantsImpl;
+import org.jboss.ws.extensions.addressing.soap.SOAPAddressingPropertiesImpl;
+import org.jboss.wsf.spi.handler.GenericSOAPHandler;
+
+import javax.xml.namespace.QName;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
import javax.xml.ws.addressing.AddressingBuilder;
@@ -31,16 +37,16 @@
import javax.xml.ws.handler.MessageContext;
import javax.xml.ws.handler.MessageContext.Scope;
import javax.xml.ws.handler.soap.SOAPMessageContext;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
-import org.jboss.logging.Logger;
-import org.jboss.ws.extensions.addressing.soap.SOAPAddressingPropertiesImpl;
-import org.jboss.wsf.spi.handler.GenericSOAPHandler;
-
/**
* A client side handler that reads/writes the addressing properties
* and puts then into the message context.
*
* @author Thomas.Diesler at jboss.org
+ * @author Heiko.Braun at jboss.com
* @since 24-Nov-2005
*/
public class WSAddressingClientHandler extends GenericSOAPHandler
@@ -48,16 +54,23 @@
// Provide logging
private static Logger log = Logger.getLogger(WSAddressingClientHandler.class);
- // addressing builder & constants
- private AddressingBuilder addrBuilder;
+ private static AddressingBuilder ADDR_BUILDER;
+ private static AddressingConstantsImpl ADDR_CONSTANTS;
+ private static Set<QName> HEADERS = new HashSet<QName>();
+
+ static
+ {
+ ADDR_CONSTANTS = new AddressingConstantsImpl();
+ ADDR_BUILDER = AddressingBuilder.getAddressingBuilder();
- // should the request be normalized according to the specifications
- private boolean normalize;
+ HEADERS.add( ADDR_CONSTANTS.getActionQName());
+ HEADERS.add( ADDR_CONSTANTS.getToQName());
+ }
- public WSAddressingClientHandler()
- {
- addrBuilder = AddressingBuilder.getAddressingBuilder();
- }
+ public Set getHeaders()
+ {
+ return Collections.unmodifiableSet(HEADERS);
+ }
protected boolean handleOutbound(MessageContext msgContext)
{
@@ -66,21 +79,15 @@
SOAPAddressingProperties addrProps = (SOAPAddressingProperties)msgContext.get(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND);
if (addrProps != null)
{
- if (normalize)
- normalizeRequest(msgContext, addrProps);
-
SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
addrProps.writeHeaders(soapMessage);
}
else
{
// supply default addressing properties
- addrProps = (SOAPAddressingPropertiesImpl)addrBuilder.newAddressingProperties();
+ addrProps = (SOAPAddressingPropertiesImpl)ADDR_BUILDER.newAddressingProperties();
msgContext.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND, addrProps);
msgContext.setScope(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND, Scope.APPLICATION);
-
- if (normalize)
- normalizeRequest(msgContext, addrProps);
}
return true;
@@ -110,9 +117,4 @@
return true;
}
- /* supply the default addressing properties in case elements are missing */
- private void normalizeRequest(MessageContext msgContext, SOAPAddressingProperties addrProps)
- {
- // TODO: supply default header
- }
}
Modified: branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/extensions/addressing/jaxws/WSAddressingServerHandler.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/extensions/addressing/jaxws/WSAddressingServerHandler.java 2007-06-13 14:29:56 UTC (rev 3568)
+++ branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/extensions/addressing/jaxws/WSAddressingServerHandler.java 2007-06-13 14:31:02 UTC (rev 3569)
@@ -21,8 +21,14 @@
*/
package org.jboss.ws.extensions.addressing.jaxws;
-import java.net.URISyntaxException;
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.extensions.addressing.AddressingConstantsImpl;
+import org.jboss.ws.extensions.addressing.metadata.AddressingOpMetaExt;
+import org.jboss.ws.metadata.umdm.OperationMetaData;
+import org.jboss.wsf.spi.handler.GenericSOAPHandler;
+import javax.xml.namespace.QName;
import javax.xml.soap.SOAPMessage;
import javax.xml.ws.addressing.AddressingBuilder;
import javax.xml.ws.addressing.JAXWSAConstants;
@@ -31,19 +37,17 @@
import javax.xml.ws.handler.MessageContext;
import javax.xml.ws.handler.MessageContext.Scope;
import javax.xml.ws.handler.soap.SOAPMessageContext;
+import java.net.URISyntaxException;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
-import org.jboss.logging.Logger;
-import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.extensions.addressing.AddressingConstantsImpl;
-import org.jboss.ws.extensions.addressing.metadata.AddressingOpMetaExt;
-import org.jboss.ws.metadata.umdm.OperationMetaData;
-import org.jboss.wsf.spi.handler.GenericSOAPHandler;
-
/**
* A server side handler that reads/writes the addressing properties
* and puts then into the message context.
*
* @author Thomas.Diesler at jboss.org
+ * @author Heiko.Braun at jboss.com
* @since 24-Nov-2005
*/
public class WSAddressingServerHandler extends GenericSOAPHandler
@@ -53,14 +57,21 @@
private static AddressingBuilder ADDR_BUILDER;
private static AddressingConstantsImpl ADDR_CONSTANTS;
+ private static Set<QName> HEADERS = new HashSet<QName>();
+
static
{
ADDR_CONSTANTS = new AddressingConstantsImpl();
ADDR_BUILDER = AddressingBuilder.getAddressingBuilder();
+
+ HEADERS.add( ADDR_CONSTANTS.getActionQName());
+ HEADERS.add( ADDR_CONSTANTS.getToQName());
}
- // should the request be validated?
- private boolean validate = true;
+ public Set getHeaders()
+ {
+ return Collections.unmodifiableSet(HEADERS);
+ }
protected boolean handleInbound(MessageContext msgContext)
{
@@ -72,9 +83,6 @@
msgContext.put(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND, addrProps);
msgContext.setScope(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND, Scope.APPLICATION);
- if (validate)
- validateRequest(addrProps);
-
return true;
}
Modified: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/SOAPAddressingPropertiesTestCase.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/SOAPAddressingPropertiesTestCase.java 2007-06-13 14:29:56 UTC (rev 3568)
+++ branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/SOAPAddressingPropertiesTestCase.java 2007-06-13 14:31:02 UTC (rev 3569)
@@ -51,6 +51,7 @@
private String reqEnvStr = "<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>"
+ " <env:Header xmlns:wsa='http://www.w3.org/2005/08/addressing'>"
+ + " <wsa:Action>http://fabrikam123.example/SubmitPO</wsa:Action>"
+ " <wsa:To>http://fabrikam123.example/Purchasing</wsa:To>"
+ " <wsa:ReplyTo>"
+ " <wsa:Address>http://business456.example/client1</wsa:Address>"
@@ -58,7 +59,6 @@
+ " <ns1:sessionid xmlns:ns1='http://somens'>someuniqueid</ns1:sessionid>"
+ " </wsa:ReferenceParameters>"
+ " </wsa:ReplyTo>"
- + " <wsa:Action>http://fabrikam123.example/SubmitPO</wsa:Action>"
+ " <wsa:MessageID>uuid:6B29FC40-CA47-1067-B31D-00DD010662DA</wsa:MessageID>"
+ " </env:Header>"
+ " <env:Body/>"
@@ -66,8 +66,8 @@
private String resEnvStr = "<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" +
" <env:Header xmlns:wsa='http://www.w3.org/2005/08/addressing'>" +
+ " <wsa:Action>http://fabrikam123.example/ReplyPO</wsa:Action>" +
" <wsa:To>http://business456.example/client1</wsa:To>" +
- " <wsa:Action>http://fabrikam123.example/ReplyPO</wsa:Action>" +
" <wsa:RelatesTo>uuid:6B29FC40-CA47-1067-B31D-00DD010662DA</wsa:RelatesTo>" +
" <ns1:sessionid wsa:IsReferenceParameter='true' xmlns:ns1='http://somens'>someuniqueid</ns1:sessionid>" +
" </env:Header>" +
Modified: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/action/ActionEndpoint.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/action/ActionEndpoint.java 2007-06-13 14:29:56 UTC (rev 3568)
+++ branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/action/ActionEndpoint.java 2007-06-13 14:31:02 UTC (rev 3569)
@@ -23,6 +23,7 @@
//$Id$
+import javax.jws.WebService;
import java.rmi.Remote;
import java.rmi.RemoteException;
@@ -33,9 +34,10 @@
*
* @since 24-Nov-2005
*/
-public interface ActionEndpoint extends Remote
+ at WebService(targetNamespace = "http://org.jboss.ws/addressing/action")
+public interface ActionEndpoint
{
- String foo(String item) throws RemoteException;
+ String foo(String item);
- String bar(String item) throws RemoteException;
+ String bar(String item);
}
Modified: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/action/ActionRpcEndpointImpl.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/action/ActionRpcEndpointImpl.java 2007-06-13 14:29:56 UTC (rev 3568)
+++ branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/action/ActionRpcEndpointImpl.java 2007-06-13 14:31:02 UTC (rev 3569)
@@ -40,7 +40,11 @@
* @since 24-Nov-2005
*/
@SOAPBinding(style = SOAPBinding.Style.RPC)
- at WebService(name = "ActionEndpoint", targetNamespace = "http://org.jboss.ws/addressing/action", wsdlLocation = "WEB-INF/wsdl/ActionRpcService.wsdl")
+ at WebService(
+ name = "ActionEndpoint",
+ targetNamespace = "http://org.jboss.ws/addressing/action",
+ endpointInterface = "org.jboss.test.ws.jaxws.wsaddressing.action.ActionEndpoint"
+)
@EndpointConfig(configName = "Standard WSAddressing Endpoint")
public class ActionRpcEndpointImpl implements ActionEndpoint
{
Modified: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/action/AddressingActionTestCase.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/action/AddressingActionTestCase.java 2007-06-13 14:29:56 UTC (rev 3568)
+++ branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/action/AddressingActionTestCase.java 2007-06-13 14:31:02 UTC (rev 3569)
@@ -21,16 +21,22 @@
*/
package org.jboss.test.ws.jaxws.wsaddressing.action;
-import javax.xml.rpc.Service;
-
import junit.framework.Test;
-
+import org.jboss.ws.extensions.addressing.jaxws.WSAddressingClientHandler;
import org.jboss.wsf.spi.test.JBossWSTest;
import org.jboss.wsf.spi.test.JBossWSTestSetup;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.handler.Handler;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* Test endpoint using ws-addressing.
- *
+ *
* The wsa:Action should override any other dispatch method
*
* @author Thomas.Diesler at jboss.org
@@ -38,27 +44,57 @@
*/
public class AddressingActionTestCase extends JBossWSTest
{
- private static ActionEndpoint rpcEndpoint;
+ private static ActionEndpoint endpoint;
- public static Test suite()
- {
- return JBossWSTestSetup.newTestSetup(AddressingActionTestCase.class, "jaxws-wsaddressing-action-rpc.war, jaxws-wsaddressing-action-rpc-client.jar");
- }
+ public static Test suite()
+ {
+ return JBossWSTestSetup.newTestSetup(AddressingActionTestCase.class, "jaxws-wsaddressing-action-rpc.war");
+ }
- protected void setUp() throws Exception
- {
- super.setUp();
+ protected void setUp() throws Exception
+ {
+ super.setUp();
- if (rpcEndpoint == null)
- {
- Service rpcService = (Service)getInitialContext("wsarpc-client").lookup("java:comp/env/service/ActionRpcService");
- rpcEndpoint = (ActionEndpoint)rpcService.getPort(ActionEndpoint.class);
- }
- }
+ if (endpoint == null)
+ {
+ String wsdlLocation = "http://"+getServerHost()+":8080/jaxws-wsaddressing-action-rpc?wsdl";
+ URL wsdlURL = new URL(wsdlLocation);
+ QName serviceName = new QName("http://org.jboss.ws/addressing/action", "ActionRpcEndpointImplService");
- public void testRpcEndpoint() throws Exception
- {
- assertEquals("bar:HelloFoo", rpcEndpoint.foo("HelloFoo"));
- assertEquals("bar:HelloBar", rpcEndpoint.bar("HelloBar"));
- }
+ Service service = Service.create(wsdlURL, serviceName);
+ endpoint = service.getPort(ActionEndpoint.class);
+ }
+ }
+
+ public void testRpcEndpoint() throws Exception
+ {
+
+ // Setup a custom chain
+ List<Handler> customHandlerChain = new ArrayList<Handler>();
+ customHandlerChain.add(new CustomAddressingHandler());
+ customHandlerChain.add(new WSAddressingClientHandler());
+ ((BindingProvider)endpoint).getBinding().setHandlerChain(customHandlerChain);
+
+ assertEquals("foo:HelloFoo", endpoint.foo("HelloFoo"));
+ assertEquals("bar:HelloBar", endpoint.bar("HelloBar"));
+ }
+
+ /**
+ * Verify that our addresing impl. correctly processes
+ * wsa headers when mustUnderstand=1 is sent
+ *
+ * @throws Exception
+ */
+ public void testRpcEndpointEnabledMU() throws Exception
+ {
+
+ // Setup a custom chain
+ List<Handler> customHandlerChain = new ArrayList<Handler>();
+ customHandlerChain.add(new AddressingHandlerEnableMU());
+ customHandlerChain.add(new WSAddressingClientHandler());
+ ((BindingProvider)endpoint).getBinding().setHandlerChain(customHandlerChain);
+
+ assertEquals("foo:HelloFoo", endpoint.foo("HelloFoo"));
+ assertEquals("bar:HelloBar", endpoint.bar("HelloBar"));
+ }
}
Added: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/action/AddressingHandlerEnableMU.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/action/AddressingHandlerEnableMU.java (rev 0)
+++ branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/action/AddressingHandlerEnableMU.java 2007-06-13 14:31:02 UTC (rev 3569)
@@ -0,0 +1,70 @@
+/*
+ * 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.wsaddressing.action;
+
+import java.net.URISyntaxException;
+
+import javax.xml.namespace.QName;
+
+import javax.xml.ws.addressing.AddressingBuilder;
+import javax.xml.ws.addressing.JAXWSAConstants;
+import javax.xml.ws.addressing.soap.SOAPAddressingProperties;
+import javax.xml.ws.handler.MessageContext;
+
+import org.jboss.logging.Logger;
+import org.jboss.wsf.spi.handler.GenericHandler;
+
+/**
+ * A client side handler that disables mustUnderstand processing
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 29-Nov-2005
+ */
+public class AddressingHandlerEnableMU extends GenericHandler
+{
+ // Provide logging
+ private static Logger log = Logger.getLogger(CustomAddressingHandler.class);
+
+ public QName[] getHeaders()
+ {
+ return new QName[] {};
+ }
+
+ protected boolean handleOutbound(MessageContext msgContext)
+ {
+ log.info("handleRequest" + this);
+ try
+ {
+ AddressingBuilder builder = AddressingBuilder.getAddressingBuilder();
+ SOAPAddressingProperties outProps = (SOAPAddressingProperties)builder.newAddressingProperties();
+ outProps.setMu(true);
+ outProps.setTo(builder.newURI("http://localhost:8080/jaxrpc-addressing-action-rpc/ActionService"));
+ outProps.setAction(builder.newURI("urn:wsa-action-bar"));
+ msgContext.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND, outProps);
+ }
+ catch (URISyntaxException ex)
+ {
+ throw new IllegalStateException("Cannot handle request", ex);
+ }
+ return true;
+ }
+}
Property changes on: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/action/AddressingHandlerEnableMU.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/action/CustomAddressingHandler.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/action/CustomAddressingHandler.java (rev 0)
+++ branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/action/CustomAddressingHandler.java 2007-06-13 14:31:02 UTC (rev 3569)
@@ -0,0 +1,65 @@
+/*
+ * 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.wsaddressing.action;
+
+import java.net.URISyntaxException;
+
+import javax.xml.namespace.QName;
+
+import javax.xml.ws.addressing.AddressingBuilder;
+import javax.xml.ws.addressing.JAXWSAConstants;
+import javax.xml.ws.addressing.soap.SOAPAddressingProperties;
+import javax.xml.ws.addressing.soap.SOAPAddressingBuilder;
+import javax.xml.ws.handler.MessageContext;
+
+import org.jboss.logging.Logger;
+import org.jboss.wsf.spi.handler.GenericHandler;
+
+/**
+ * A client side handler for the ws-addressing
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 29-Nov-2005
+ */
+public class CustomAddressingHandler extends GenericHandler
+{
+ // Provide logging
+ private static Logger log = Logger.getLogger(CustomAddressingHandler.class);
+
+ protected boolean handleOutbound(MessageContext msgContext)
+ {
+ log.info("handleRequest" + this);
+ try
+ {
+ SOAPAddressingBuilder builder = (SOAPAddressingBuilder)SOAPAddressingBuilder.getAddressingBuilder();
+ SOAPAddressingProperties outProps = (SOAPAddressingProperties)builder.newAddressingProperties();
+ outProps.setTo(builder.newURI("http://localhost:8080/jaxrpc-addressing-action-rpc/ActionService"));
+ outProps.setAction(builder.newURI("urn:wsa-action-bar"));
+ msgContext.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND, outProps);
+ }
+ catch (URISyntaxException ex)
+ {
+ throw new IllegalStateException("Cannot handle request", ex);
+ }
+ return true;
+ }
+}
Property changes on: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/action/CustomAddressingHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/replyto/AddressingReplyToTestCase.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/replyto/AddressingReplyToTestCase.java 2007-06-13 14:29:56 UTC (rev 3568)
+++ branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/replyto/AddressingReplyToTestCase.java 2007-06-13 14:31:02 UTC (rev 3569)
@@ -39,6 +39,8 @@
/**
* Test endpoint using ws-addressing
*
+ * NOTE: This test uses a JAX-RPC client against a JAX-WS endpoint.
+ *
* @author Thomas.Diesler at jboss.org
* @since 24-Nov-2005
*/
More information about the jbossws-commits
mailing list