Author: sagara
Date: Thu Aug 30 12:38:46 2012
New Revision: 1378912

URL: http://svn.apache.org/viewvc?rev=1378912&view=rev
Log:
Fixed AXIS2-5408 - don't add "SOAPAction" HTTP header for REST messages. 

Modified:
    
axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPSenderImpl.java
    
axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.java
    
axis/axis2/java/core/trunk/modules/transport/http/test/org/apache/axis2/transport/http/HTTPClient4SenderTest.java
    
axis/axis2/java/core/trunk/modules/transport/http/test/org/apache/axis2/transport/http/HTTPSenderTest.java

Modified: 
axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPSenderImpl.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPSenderImpl.java?rev=1378912&r1=1378911&r2=1378912&view=diff
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPSenderImpl.java
 (original)
+++ 
axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPSenderImpl.java
 Thu Aug 30 12:38:46 2012
@@ -105,7 +105,7 @@ public class HTTPSenderImpl extends HTTP
         String soapAction = messageFormatter
                 .formatSOAPAction(msgContext, format, soapActiionString);
 
-        if (soapAction != null) {
+        if (soapAction != null && !msgContext.isDoingREST()) {
             getMethod.setRequestHeader(HTTPConstants.HEADER_SOAP_ACTION, 
soapAction);
         }
         try {
@@ -201,7 +201,7 @@ public class HTTPSenderImpl extends HTTP
 
         String soapAction = messageFormatter.formatSOAPAction(msgContext, 
format, soapActionString);
 
-        if (soapAction != null) {
+        if (soapAction != null && !msgContext.isDoingREST()) {
             postMethod.setRequestHeader(HTTPConstants.HEADER_SOAP_ACTION, 
soapAction);
         }
 
@@ -258,7 +258,7 @@ public class HTTPSenderImpl extends HTTP
         }
 
         String soapAction = messageFormatter.formatSOAPAction(msgContext, 
format, soapActionString);
-        if (soapAction != null) {
+        if (soapAction != null && !msgContext.isDoingREST()) {
             putMethod.setRequestHeader(HTTPConstants.HEADER_SOAP_ACTION, 
soapAction);
         }
 

Modified: 
axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.java?rev=1378912&r1=1378911&r2=1378912&view=diff
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.java
 (original)
+++ 
axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.java
 Thu Aug 30 12:38:46 2012
@@ -115,7 +115,7 @@ public class HTTPSenderImpl extends HTTP
         String soapAction = messageFormatter
                 .formatSOAPAction(msgContext, format, soapActionString);
 
-        if (soapAction != null) {
+        if (soapAction != null && !msgContext.isDoingREST()) {
             httpGet.setHeader(HTTPConstants.HEADER_SOAP_ACTION, soapAction);
         }
 
@@ -226,7 +226,7 @@ public class HTTPSenderImpl extends HTTP
 
         String soapAction = messageFormatter.formatSOAPAction(msgContext, 
format, soapActionString);
 
-        if (soapAction != null) {
+        if (soapAction != null && !msgContext.isDoingREST()) {
             postMethod.setHeader(HTTPConstants.HEADER_SOAP_ACTION, soapAction);
         }
 
@@ -281,7 +281,7 @@ public class HTTPSenderImpl extends HTTP
         }
 
         String soapAction = messageFormatter.formatSOAPAction(msgContext, 
format, soapActionString);
-        if (soapAction != null) {
+        if (soapAction != null && !msgContext.isDoingREST()) {
             putMethod.setHeader(HTTPConstants.HEADER_SOAP_ACTION, soapAction);
         }
 

Modified: 
axis/axis2/java/core/trunk/modules/transport/http/test/org/apache/axis2/transport/http/HTTPClient4SenderTest.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/http/test/org/apache/axis2/transport/http/HTTPClient4SenderTest.java?rev=1378912&r1=1378911&r2=1378912&view=diff
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/transport/http/test/org/apache/axis2/transport/http/HTTPClient4SenderTest.java
 (original)
+++ 
axis/axis2/java/core/trunk/modules/transport/http/test/org/apache/axis2/transport/http/HTTPClient4SenderTest.java
 Thu Aug 30 12:38:46 2012
@@ -40,8 +40,7 @@ public class HTTPClient4SenderTest exten
                      getHTTPMethod());
         assertEquals("Not the expected content", 
"/getService?part=sample%20data",
                      getStringContent());
-        assertEquals("Not the expected HTTP Header value", "urn:getService",
-                     getHeaders().get("SOAPAction"));
+        assertNull("Not the expected HTTP Header value", 
getHeaders().get("SOAPAction"));
         assertEquals("Not the expected HTTP Header value",
                      
"application/x-www-form-urlencoded;action=\"urn:getService\";",
                      getHeaders().get(HttpHeaders.CONTENT_TYPE));
@@ -61,8 +60,7 @@ public class HTTPClient4SenderTest exten
                      getHTTPMethod());
         assertEquals("Not the expected content", 
getEnvelope().getFirstElement().getFirstElement()
                 .toString(), getStringContent());
-        assertEquals("Not the expected HTTP Header value", "urn:postService",
-                     getHeaders().get("SOAPAction"));
+        assertNull("Not the expected HTTP Header value", 
getHeaders().get("SOAPAction"));
         assertEquals("Not the expected HTTP Header value", "application/xml",
                      getHeaders().get(HttpHeaders.CONTENT_TYPE));
         assertEquals("Not the expected HTTP Header value", "localhost",
@@ -96,8 +94,7 @@ public class HTTPClient4SenderTest exten
                      getHTTPMethod());
         assertEquals("Not the expected content", 
getEnvelope().getFirstElement().getFirstElement()
                 .toString(), getStringContent());
-        assertEquals("Not the expected HTTP Header value", "urn:putService",
-                     getHeaders().get("SOAPAction"));
+        assertNull("Not the expected HTTP Header value", 
getHeaders().get("SOAPAction"));
         assertEquals("Not the expected HTTP Header value", "application/xml",
                      getHeaders().get(HttpHeaders.CONTENT_TYPE));
         assertEquals("Not the expected HTTP Header value", "localhost",
@@ -166,8 +163,7 @@ public class HTTPClient4SenderTest exten
                      getHTTPMethod());
         assertEquals("Not the expected content", 
getEnvelope().getFirstElement().getFirstElement()
                 .toString(), getStringContent());
-        assertEquals("Not the expected HTTP Header value", "urn:noService",
-                     getHeaders().get("SOAPAction"));
+        assertNull("Not the expected HTTP Header value", 
getHeaders().get("SOAPAction"));
         assertEquals("Not the expected HTTP Header value", "application/xml",
                      getHeaders().get(HttpHeaders.CONTENT_TYPE));
         assertEquals("Not the expected HTTP Header value", "localhost",

Modified: 
axis/axis2/java/core/trunk/modules/transport/http/test/org/apache/axis2/transport/http/HTTPSenderTest.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/http/test/org/apache/axis2/transport/http/HTTPSenderTest.java?rev=1378912&r1=1378911&r2=1378912&view=diff
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/transport/http/test/org/apache/axis2/transport/http/HTTPSenderTest.java
 (original)
+++ 
axis/axis2/java/core/trunk/modules/transport/http/test/org/apache/axis2/transport/http/HTTPSenderTest.java
 Thu Aug 30 12:38:46 2012
@@ -89,8 +89,7 @@ public abstract class HTTPSenderTest ext
                 getHTTPMethod());
         assertEquals("Not the expected content", 
"/getService?part=sample%20data",
                 getStringContent());
-        assertEquals("Not the expected HTTP Header value", "urn:getService",
-                getHeaders().get("SOAPAction"));
+        assertNull("Not the expected HTTP Header value", 
getHeaders().get("SOAPAction"));
         assertEquals("Not the expected HTTP Header value",
                 "application/x-www-form-urlencoded;action=\"urn:getService\";",
                 getHeaders().get(HttpHeaders.CONTENT_TYPE));
@@ -115,8 +114,7 @@ public abstract class HTTPSenderTest ext
                 getHTTPMethod());
         assertEquals("Not the expected content", 
getEnvelope().getFirstElement().getFirstElement()
                 .toString(), getStringContent());
-        assertEquals("Not the expected HTTP Header value", "urn:postService",
-                getHeaders().get("SOAPAction"));
+        assertNull("Not the expected HTTP Header value", 
getHeaders().get("SOAPAction"));
         assertEquals("Not the expected HTTP Header value", "application/xml",
                 getHeaders().get(HttpHeaders.CONTENT_TYPE));
         assertEquals("Not the expected HTTP Header value", "localhost:" + port,
@@ -140,6 +138,9 @@ public abstract class HTTPSenderTest ext
                 getHeaders().get(HttpHeaders.USER_AGENT));
     }
 
+
+
+
     /**
      * Test send via put.
      * 
@@ -155,8 +156,7 @@ public abstract class HTTPSenderTest ext
                 getHTTPMethod());
         assertEquals("Not the expected content", 
getEnvelope().getFirstElement().getFirstElement()
                 .toString(), getStringContent());
-        assertEquals("Not the expected HTTP Header value", "urn:putService",
-                getHeaders().get("SOAPAction"));
+        assertNull("Not the expected HTTP Header value", 
getHeaders().get("SOAPAction"));
         assertEquals("Not the expected HTTP Header value", "application/xml",
                 getHeaders().get(HttpHeaders.CONTENT_TYPE));
         assertEquals("Not the expected HTTP Header value", "localhost:" + port,
@@ -243,8 +243,7 @@ public abstract class HTTPSenderTest ext
                 getHTTPMethod());
         assertEquals("Not the expected content", 
getEnvelope().getFirstElement().getFirstElement()
                 .toString(), getStringContent());
-        assertEquals("Not the expected HTTP Header value", "urn:noService",
-                getHeaders().get("SOAPAction"));
+        assertNull("Not the expected HTTP Header value", 
getHeaders().get("SOAPAction"));
         assertEquals("Not the expected HTTP Header value", "application/xml",
                 getHeaders().get(HttpHeaders.CONTENT_TYPE));
         assertEquals("Not the expected HTTP Header value", "localhost:" + port,
@@ -252,6 +251,16 @@ public abstract class HTTPSenderTest ext
         assertEquals("Not the expected HTTP Header value", "Axis2",
                 getHeaders().get(HttpHeaders.USER_AGENT));
 
+        sendViaHTTP(null, "urn:noService", "http://localhost:"; + port + 
"/noService", false);
+        assertEquals("Not the expected content", getEnvelope().toString(), 
getStringContent());
+        assertEquals("Not the expected HTTP Header value", "urn:noService",
+                getHeaders().get("SOAPAction").replace("\"", ""));
+        assertEquals("Not the expected HTTP Header value", "text/xml",
+                getHeaders().get(HttpHeaders.CONTENT_TYPE));
+        assertEquals("Not the expected HTTP Header value", "localhost:" + port,
+                getHeaders().get(HttpHeaders.HOST));
+        assertEquals("Not the expected HTTP Header value", "Axis2",
+                getHeaders().get(HttpHeaders.USER_AGENT));
     }
     public void testHandleResponseHTTPStatusCode200() throws Exception {
         httpSender = getHTTPSender();


Reply via email to