You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ve...@apache.org on 2009/01/27 18:27:19 UTC

svn commit: r738158 - in /webservices/axis2/trunk/java/modules/saaj: src/org/apache/axis2/saaj/SOAPConnectionImpl.java test/org/apache/axis2/saaj/integration/IntegrationTest.java

Author: veithen
Date: Tue Jan 27 17:27:19 2009
New Revision: 738158

URL: http://svn.apache.org/viewvc?rev=738158&view=rev
Log:
AXIS2-1014: Fixed SOAPConnectionImpl to take into account the SOAPAction MIME header. Also allow other headers to be added to the request.

Modified:
    webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPConnectionImpl.java
    webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/IntegrationTest.java

Modified: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPConnectionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPConnectionImpl.java?rev=738158&r1=738157&r2=738158&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPConnectionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPConnectionImpl.java Tue Jan 27 17:27:19 2009
@@ -39,12 +39,14 @@
 import org.apache.axis2.saaj.util.IDGenerator;
 import org.apache.axis2.saaj.util.SAAJUtil;
 import org.apache.axis2.saaj.util.UnderstandAllHeadersHandler;
+import org.apache.axis2.transport.http.HTTPConstants;
 import org.apache.axis2.wsdl.WSDLConstants;
 
 import javax.activation.DataHandler;
 import javax.xml.namespace.QName;
 import javax.xml.soap.AttachmentPart;
 import javax.xml.soap.MessageFactory;
+import javax.xml.soap.MimeHeader;
 import javax.xml.soap.MimeHeaders;
 import javax.xml.soap.SOAPBody;
 import javax.xml.soap.SOAPConnection;
@@ -59,8 +61,10 @@
 import java.net.HttpURLConnection;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 import java.util.StringTokenizer;
 
 
@@ -149,6 +153,26 @@
             }
         }
         
+        Map<String,String> httpHeaders = null;
+        for (Iterator it = request.getMimeHeaders().getAllHeaders(); it.hasNext(); ) {
+            MimeHeader header = (MimeHeader)it.next();
+            String name = header.getName().toLowerCase();
+            if (name.equals("soapaction")) {
+                requestMsgCtx.setSoapAction(header.getValue());
+            } else if (name.equals("content-type")) {
+                // Don't set the Content-Type explicitly since it will be computed by the
+                // message builder.
+            } else {
+                if (httpHeaders == null) {
+                    httpHeaders = new HashMap<String,String>();
+                }
+                httpHeaders.put(header.getName(), header.getValue());
+            }
+        }
+        if (httpHeaders != null) {
+            requestMsgCtx.setProperty(HTTPConstants.HTTP_HEADERS, httpHeaders);
+        }
+        
         MessageContext responseMsgCtx;
         try {
             requestMsgCtx.setEnvelope(envelope);

Modified: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/IntegrationTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/IntegrationTest.java?rev=738158&r1=738157&r2=738158&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/IntegrationTest.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/IntegrationTest.java Tue Jan 27 17:27:19 2009
@@ -334,7 +334,7 @@
         sCon.close();
     }    
 
-    @Validated @Test @Ignore("AXIS2-1014")
+    @Validated @Test
     public void testCallWithSOAPAction() throws Exception {
         MessageFactory mf = MessageFactory.newInstance();
         SOAPMessage request = mf.createMessage();