Author: sebb
Date: Tue Apr 29 13:51:48 2008
New Revision: 652103

URL: http://svn.apache.org/viewvc?rev=652103&view=rev
Log:
Bug 44852 SOAP/ XML-RPC Request does not show Request details in View Results 
Tree

Modified:
    
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/SoapSampler.java

Modified: 
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/SoapSampler.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/SoapSampler.java?rev=652103&r1=652102&r2=652103&view=diff
==============================================================================
--- 
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/SoapSampler.java
 (original)
+++ 
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/SoapSampler.java
 Tue Apr 29 13:51:48 2008
@@ -23,6 +23,7 @@
 import org.apache.commons.httpclient.methods.RequestEntity;
 import org.apache.jmeter.protocol.http.control.Header;
 import org.apache.jmeter.protocol.http.control.HeaderManager;
+import org.apache.jmeter.protocol.http.util.HTTPConstants;
 import org.apache.jorphan.logging.LoggingManager;
 import org.apache.jorphan.util.JOrphanUtils;
 import org.apache.log.Logger;
@@ -148,9 +149,14 @@
      * @param post
      * @throws IOException if an I/O exception occurs
      */
-    protected void sendPostData(PostMethod post, final int length) {
+    private String sendPostData(PostMethod post, final int length) {
+        // Buffer to hold the post body, except file content
+        StringBuffer postedBody = new StringBuffer(1000);
         final String xmlFile = getXmlFile();
-        if (xmlFile != null && getXmlFile().length() > 0) {
+        if (xmlFile != null && xmlFile.length() > 0) {
+            // We just add placeholder text for file content
+            postedBody.append("Filename: ").append(xmlFile).append("\n");
+            postedBody.append("<actual file content, not shown here>");
             post.setRequestEntity(new RequestEntity() {
                 public boolean isRepeatable() {
                     return true;
@@ -187,6 +193,7 @@
                 }
             });
         } else {
+            postedBody.append(getXmlData());
             post.setRequestEntity(new RequestEntity() {
                 public boolean isRepeatable() {
                     return true;
@@ -207,23 +214,23 @@
                 }
             });
         }
+        return postedBody.toString();
     }
 
     protected HTTPSampleResult sample(URL url, String method, boolean 
areFollowingRedirect, int frameDepth) {
 
         String urlStr = url.toString();
 
-        log.debug("Start : sample" + urlStr);
-        log.debug("method" + method);
+        log.debug("Start : sample " + urlStr);
 
         PostMethod httpMethod;
         httpMethod = new PostMethod(urlStr);
 
         HTTPSampleResult res = new HTTPSampleResult();
-        res.setMonitor(isMonitor());
+        res.setMonitor(false);
 
         res.setSampleLabel(urlStr); // May be replaced later
-        res.setHTTPMethod(method);
+        res.setHTTPMethod(HTTPConstants.POST);
         res.sampleStart(); // Count the retries as well in the time
         HttpClient client = null;
         InputStream instream = null;
@@ -231,9 +238,8 @@
             int content_len = setPostHeaders(httpMethod);
             client = setupConnection(url, httpMethod, res);
 
-            res.setQueryString(getQueryString());
-            sendPostData(httpMethod,content_len);
-
+            res.setQueryString(sendPostData(httpMethod,content_len));
+            res.setRequestHeaders(getConnectionHeaders(httpMethod));
             int statusCode = client.executeMethod(httpMethod);
 
             // Request sent. Now get the response:
@@ -306,9 +312,7 @@
             res = resultProcessing(areFollowingRedirect, frameDepth, res);
 
             log.debug("End : sample");
-            if (httpMethod != null) {
-                httpMethod.releaseConnection();
-            }
+            httpMethod.releaseConnection();
             return res;
         } catch (IllegalArgumentException e)// e.g. some kinds of invalid URL
         {
@@ -323,9 +327,7 @@
             return err;
         } finally {
             JOrphanUtils.closeQuietly(instream);
-            if (httpMethod != null) {
-                httpMethod.releaseConnection();
-            }
+            httpMethod.releaseConnection();
         }
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to