Author: jim.ma
Date: 2010-02-27 05:36:18 -0500 (Sat, 27 Feb 2010)
New Revision: 11697
Added:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2927/
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2927/JBWS2927TestCase.java
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2927/
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2927/request-message.xml
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/addressing/jaxws/WSAddressingClientHandler.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/addressing/soap/SOAPAddressingPropertiesImpl.java
Log:
[JBWS-2927]:WSAddressingClientHandler gets wsa action as optional element
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/addressing/jaxws/WSAddressingClientHandler.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/addressing/jaxws/WSAddressingClientHandler.java 2010-02-26
15:53:01 UTC (rev 11696)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/addressing/jaxws/WSAddressingClientHandler.java 2010-02-27
10:36:18 UTC (rev 11697)
@@ -137,6 +137,7 @@
{
SOAPAddressingBuilder builder =
(SOAPAddressingBuilder)SOAPAddressingBuilder.getAddressingBuilder();
SOAPAddressingProperties addrProps =
(SOAPAddressingProperties)builder.newAddressingProperties();
+ soapMessage.setProperty("isClientInbound", "true");
addrProps.readHeaders(soapMessage);
msgContext.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES, addrProps);
msgContext.setScope(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES,
Scope.APPLICATION);
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/addressing/soap/SOAPAddressingPropertiesImpl.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/addressing/soap/SOAPAddressingPropertiesImpl.java 2010-02-26
15:53:01 UTC (rev 11696)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/addressing/soap/SOAPAddressingPropertiesImpl.java 2010-02-27
10:36:18 UTC (rev 11697)
@@ -149,8 +149,19 @@
// wsa:Action
// This REQUIRED element of type xs:anyURI conveys the [action] property.
// The [children] of this element convey the value of this property.
- String action = getRequiredHeaderContent(soapHeader, ADDR.getActionQName());
- setAction(builder.newURI(action));
+ if (message.getProperty("isClientInbound") != null)
+ {
+ String action = getOptionalHeaderContent(soapHeader,
ADDR.getActionQName());
+ if (action != null)
+ {
+ setAction(builder.newURI(action));
+ }
+ }
+ else
+ {
+ String action = getRequiredHeaderContent(soapHeader,
ADDR.getActionQName());
+ setAction(builder.newURI(action));
+ }
// Read wsa:MessageID
// This OPTIONAL element (whose content is of type xs:anyURI) conveys the [message id]
property.
Added:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2927/JBWS2927TestCase.java
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2927/JBWS2927TestCase.java
(rev 0)
+++
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2927/JBWS2927TestCase.java 2010-02-27
10:36:18 UTC (rev 11697)
@@ -0,0 +1,63 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.jbws2927;
+
+import java.net.URL;
+
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.addressing.JAXWSAConstants;
+
+import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
+import org.jboss.ws.extensions.addressing.jaxws.WSAddressingClientHandler;
+import org.jboss.ws.extensions.addressing.soap.SOAPAddressingPropertiesImpl;
+
+import org.jboss.wsf.test.JBossWSTest;
+
+/**
+ * A JBWS2927TestCase.
+ *
+ * @author <a href="ema(a)redhat.com">Jim Ma</a>
+ */
+public class JBWS2927TestCase extends JBossWSTest
+{
+ public void testHandleInboundMessage() throws Exception
+ {
+ WSAddressingClientHandler wsHandler = new WSAddressingClientHandler();
+ SOAPMessageContextJAXWS context = new SOAPMessageContextJAXWS();
+ context.put(MessageContext.MESSAGE_OUTBOUND_PROPERTY, new Boolean(false));
+ context.put(BindingProvider.SOAPACTION_URI_PROPERTY, "inputAction");
+ context.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES, new
SOAPAddressingPropertiesImpl());
+ context.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND, new
SOAPAddressingPropertiesImpl());
+ MessageFactory factory = MessageFactory.newInstance();
+
+ URL reqMessage =
getResourceFile("jaxws/jbws2927/request-message.xml").toURL();
+ MessageFactory msgFactory = MessageFactory.newInstance();
+
+ SOAPMessage soapMsg = msgFactory.createMessage(null, reqMessage.openStream());
+ context.setMessage(soapMsg);
+
+ wsHandler.handleMessage(context);
+ }
+}
Added:
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2927/request-message.xml
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2927/request-message.xml
(rev 0)
+++
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2927/request-message.xml 2010-02-27
10:36:18 UTC (rev 11697)
@@ -0,0 +1,6 @@
+<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:jbw="http://ws.jboss.org/jbws2927">
+ <soapenv:Header/>
+ <soapenv:Body>
+
<jbw:addNumbersResponse><return>20</return><arg0>ClientEnabledServerNotEnabled</arg0></jbw:addNumbersResponse>
+ </soapenv:Body>
+</soapenv:Envelope>