cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject svn commit: r606145 - in /incubator/cxf/trunk: rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/ rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ systests/src/test/java/org/apache/cxf/systest/ws/addr_fromjava/
Date Fri, 21 Dec 2007 09:30:23 GMT
Author: mmao
Date: Fri Dec 21 01:30:23 2007
New Revision: 606145

URL: http://svn.apache.org/viewvc?rev=606145&view=rev
Log:
* SOAPAction from the jaxws context should affect the soap:header as well
* Add an empty soap header if the head is empty
* Update the systest


Modified:
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java
    incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_fromjava/WSAFromJavaTest.java

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java?rev=606145&r1=606144&r2=606145&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java
Fri Dec 21 01:30:23 2007
@@ -102,6 +102,9 @@
             if (message.hasHeaders()) {
                 replaceHeaders(soapMessage, message);
             }
+            if (soapMessage.getSOAPHeader() == null) {
+                soapMessage.getSOAPPart().getEnvelope().addHeader();
+            }
             
             XMLStreamReader xmlReader = message.getContent(XMLStreamReader.class);
             StaxUtils.readDocElements(soapMessage.getSOAPBody(), xmlReader, true);
@@ -109,7 +112,7 @@
             xmlReader = StaxUtils.createXMLStreamReader(bodySource);
             xmlReader.nextTag();
             xmlReader.nextTag(); // move past body tag
-            message.setContent(XMLStreamReader.class, xmlReader);
+            message.setContent(XMLStreamReader.class, xmlReader);           
         } catch (SOAPException soape) {
             throw new SoapFault(new org.apache.cxf.common.i18n.Message(
                     "SOAPHANDLERINTERCEPTOR_EXCEPTION", BUNDLE), soape,

Modified: incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java?rev=606145&r1=606144&r2=606145&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java
(original)
+++ incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java
Fri Dec 21 01:30:23 2007
@@ -32,6 +32,7 @@
 import javax.xml.namespace.QName;
 import javax.xml.ws.WebFault;
 
+import org.apache.cxf.binding.soap.SoapBindingConstants;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.endpoint.Endpoint;
@@ -467,7 +468,10 @@
     protected String getActionUri(Message message) {
         OperationInfo op = message.getExchange().get(OperationInfo.class);
 
-        String actionUri = null;
+        String actionUri = (String) message.get(SoapBindingConstants.SOAP_ACTION);
+        if (actionUri != null) {
+            return actionUri;
+        }
         String opNamespace = getActionBaseUri(op);
         
         if (ContextUtils.isRequestor(message)) {

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_fromjava/WSAFromJavaTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_fromjava/WSAFromJavaTest.java?rev=606145&r1=606144&r2=606145&view=diff
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_fromjava/WSAFromJavaTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_fromjava/WSAFromJavaTest.java
Fri Dec 21 01:30:23 2007
@@ -52,15 +52,10 @@
 
         AddNumberImpl port = getPort();
 
-        BindingProvider bp = (BindingProvider)port;
-        java.util.Map<String, Object> requestContext = bp.getRequestContext();
-        requestContext.put(BindingProvider.SOAPACTION_URI_PROPERTY, "cxf");
-
         assertEquals(3, port.addNumbers(1, 2));
 
         String expectedOut = "http://cxf.apache.org/input";
         assertTrue(output.toString().indexOf(expectedOut) != -1);
-        assertTrue(output.toString().indexOf("SOAPAction=[\"cxf\"]") != -1);
         
         String expectedIn = "http://cxf.apache.org/output";
         assertTrue(input.toString().indexOf(expectedIn) != -1);
@@ -123,6 +118,27 @@
 
         assertTrue(output.toString().indexOf("http://cxf.apache.org/input") != -1);
         assertTrue(input.toString().indexOf("http://cxf.apache.org/fault3") != -1);
+    }
+
+    @Test
+    public void testAddNumbersJaxWsContext() throws Exception {
+        ByteArrayOutputStream input = setupInLogging();
+        ByteArrayOutputStream output = setupOutLogging();
+
+        AddNumberImpl port = getPort();
+
+        BindingProvider bp = (BindingProvider)port;
+        java.util.Map<String, Object> requestContext = bp.getRequestContext();
+        requestContext.put(BindingProvider.SOAPACTION_URI_PROPERTY, "cxf");
+
+        assertEquals(3, port.addNumbers(1, 2));
+
+        String expectedOut = "cxf</Action>";
+        assertTrue(output.toString().indexOf(expectedOut) != -1);
+        assertTrue(output.toString().indexOf("SOAPAction=[\"cxf\"]") != -1);
+        
+        String expectedIn = "http://cxf.apache.org/output";
+        assertTrue(input.toString().indexOf(expectedIn) != -1);
     }
 
     private AddNumberImpl getPort() {



Mime
View raw message