jboutcher    2002/12/01 19:07:43

  Modified:    src/protocol/http/org/apache/jmeter/protocol/http/sampler
                        SoapSampler.java
  Log:
  fix for bug 14145 - thank you jordi
  
  Revision  Changes    Path
  1.2       +25 -11    
jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/sampler/SoapSampler.java
  
  Index: SoapSampler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/sampler/SoapSampler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SoapSampler.java  11 Aug 2002 19:24:52 -0000      1.1
  +++ SoapSampler.java  2 Dec 2002 03:07:43 -0000       1.2
  @@ -7,26 +7,43 @@
   
   
   /**
  - * @author Administrator
  + * Sampler to handle SOAP Requests
    *
  - * To change this generated comment edit the template variable "typecomment":
  - * Window>Preferences>Java>Templates.
  + *
  + * @author Jordi Salvat i Alabart
  + * @version $Id$
    */
  -public class SoapSampler extends HTTPSampler 
  +public class SoapSampler extends HTTPSampler
   {
        public static final String XML_DATA = "HTTPSamper.xml_data";
  -     
  +
        public void setXmlData(String data)
        {
                setProperty(XML_DATA,data);
        }
  -     
  +
        public String getXmlData()
        {
                return getPropertyAsString(XML_DATA);
        }
   
  -             /****************************************
  +     /****************************************
  +      * Set the HTTP request headers in preparation to open the connection
  +      * and sending the POST data:
  +      *
  +      *@param connection       <code>URLConnection</code> to set headers on
  +      *@exception IOException  if an I/O exception occurs
  +      ***************************************/
  +     public void setHeaders(URLConnection connection)
  +                     throws IOException
  +     {
  +             ((HttpURLConnection)connection).setRequestMethod("POST");
  +             connection.setRequestProperty("Content-length", "" + 
getXmlData().length());
  +             connection.setRequestProperty("Content-type", "text/xml");
  +             connection.setDoOutput(true);
  +     }
  +
  +     /****************************************
         * Send POST data from <code>Entry</code> to the open connection.
         *
         *@param connection       <code>URLConnection</code> of where POST data should
  @@ -37,12 +54,9 @@
        public void sendPostData(URLConnection connection)
                         throws IOException
        {
  -             ((HttpURLConnection)connection).setRequestMethod("POST");
  -             connection.setRequestProperty("Content-length", "" + 
getXmlData().length());
  -             connection.setRequestProperty("Content-type", "text/xml");
  -             connection.setDoOutput(true);
                PrintWriter out = new PrintWriter(connection.getOutputStream());
                out.print(getXmlData());
                out.close();
        }
   }
  +
  
  
  

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

Reply via email to