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 ga...@apache.org on 2006/03/23 19:17:58 UTC

svn commit: r388226 - /webservices/axis/trunk/java/src/org/apache/axis/transport/http/CommonsHTTPSender.java

Author: gawor
Date: Thu Mar 23 10:17:56 2006
New Revision: 388226

URL: http://svn.apache.org/viewcvs?rev=388226&view=rev
Log:
bugfix AXIS-2361, and partial fix for replies with empty bodies

Modified:
    webservices/axis/trunk/java/src/org/apache/axis/transport/http/CommonsHTTPSender.java

Modified: webservices/axis/trunk/java/src/org/apache/axis/transport/http/CommonsHTTPSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/src/org/apache/axis/transport/http/CommonsHTTPSender.java?rev=388226&r1=388225&r2=388226&view=diff
==============================================================================
--- webservices/axis/trunk/java/src/org/apache/axis/transport/http/CommonsHTTPSender.java (original)
+++ webservices/axis/trunk/java/src/org/apache/axis/transport/http/CommonsHTTPSender.java Thu Mar 23 10:17:56 2006
@@ -194,6 +194,12 @@
             }
 
             int returnCode = httpClient.executeMethod(hostConfiguration, method, null);
+            String statusMessage = method.getStatusText();
+
+            msgContext.setProperty(HTTPConstants.MC_HTTP_STATUS_CODE,
+                                   new Integer(returnCode));
+            msgContext.setProperty(HTTPConstants.MC_HTTP_STATUS_MESSAGE,
+                                   statusMessage);
 
             String contentType = 
                 getHeader(method, HTTPConstants.HEADER_CONTENT_TYPE);
@@ -214,7 +220,6 @@
                 
                 // SOAP Fault should be in here - so fall through
             } else {
-                String statusMessage = method.getStatusText();
                 AxisFault fault = new AxisFault("HTTP",
                                                 "(" + returnCode + ")"
                                                 + statusMessage, null,
@@ -233,6 +238,15 @@
                 }
             }
             
+            if (contentLength != null) {
+                long length = Long.parseLong(contentLength);
+                
+                if (length == 0) {
+                    method.releaseConnection();
+                    return;
+                }
+            }
+
             // wrap the response body stream so that close() also releases 
             // the connection back to the pool.
             InputStream releaseConnectionOnCloseStream = 
@@ -288,12 +302,6 @@
                         handleCookie(HTTPConstants.HEADER_COOKIE2, headers[i].getValue(), msgContext);
                     }
                 }
-            }
-
-            // always release the connection back to the pool if 
-            // it was one way invocation
-            if (msgContext.isPropertyTrue("axis.one.way")) {
-                method.releaseConnection();
             }
             
         } catch (Exception e) {