woolfel     2004/01/08 19:57:16

  Modified:    src/protocol/http/org/apache/jmeter/protocol/http/sampler
                        WebServiceSampler.java
  Log:
  added support for proxy. it needs to be tested. thanks to peter reid
  for discovering and reporting the bug.
  
  PR:
  Obtained from:
  Submitted by: 
  Reviewed by:  
  CVS: ----------------------------------------------------------------------
  CVS: PR:
  CVS:   If this change addresses a PR in the problem report tracking
  CVS:   database, then enter the PR number(s) here.
  CVS: Obtained from:
  CVS:   If this change has been taken from another system, such as NCSA,
  CVS:   then name the system in this line, otherwise delete it.
  CVS: Submitted by:
  CVS:   If this code has been contributed to Apache by someone else; i.e.,
  CVS:   they sent us a patch or a new module, then include their name/email
  CVS:   address here. If this is your work then delete this line.
  CVS: Reviewed by:
  CVS:   If we are doing pre-commit code reviews and someone else has
  CVS:   reviewed your changes, include their name(s) here.
  CVS:   If you have not had it reviewed then delete this line.
  
  Revision  Changes    Path
  1.7       +61 -1     
jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/sampler/WebServiceSampler.java
  
  Index: WebServiceSampler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/sampler/WebServiceSampler.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- WebServiceSampler.java    19 Dec 2003 15:23:22 -0000      1.6
  +++ WebServiceSampler.java    9 Jan 2004 03:57:16 -0000       1.7
  @@ -73,6 +73,7 @@
   import org.apache.soap.*;
   import org.apache.soap.messaging.*;
   import org.apache.soap.transport.*;
  +import org.apache.soap.transport.http.SOAPHTTPConnection;
   import javax.xml.parsers.*;
   import org.w3c.dom.Document;
   import org.xml.sax.*;
  @@ -97,6 +98,9 @@
       public static final String MEMORY_CACHE = "WebServiceSampler.memory_cache";
       public static final String READ_RESPONSE =
           "WebServiceSampler.read_response";
  +    public static final String USE_PROXY = "WebServiceSampler.use_proxy";
  +    public static final String PROXY_HOST = "WebServiceSampler.proxy_host";
  +    public static final String PROXY_PORT = "WebServiceSampler.proxy_port";
   
       /**
        * The SOAPAction is required by MS
  @@ -307,6 +311,54 @@
           return this.getPropertyAsBoolean(READ_RESPONSE);
       }
   
  +     /**
  +      * Set whether or not to use a proxy
  +      * @param proxy
  +      */
  +     public void setUseProxy(boolean proxy){
  +             setProperty(USE_PROXY, String.valueOf(proxy));
  +     }
  +
  +     /**
  +      * Return whether or not to use proxy
  +      * @return
  +      */     
  +     public boolean getUseProxy(){
  +             return this.getPropertyAsBoolean(USE_PROXY);
  +     }
  +
  +     /**
  +      * Set the proxy hostname
  +      * @param host
  +      */     
  +     public void setProxyHost(String host){
  +             setProperty(PROXY_HOST, host);
  +     }
  +
  +     /**
  +      * Return the proxy hostname
  +      * @return
  +      */     
  +     public String getProxyHost(){
  +             return this.getPropertyAsString(PROXY_HOST);
  +     }
  +
  +     /**
  +      * Set the proxy port
  +      * @param port
  +      */     
  +     public void setProxyPort(String port){
  +             setProperty(PROXY_PORT, port);
  +     }
  +
  +     /**
  +      * Return the proxy port
  +      * @return
  +      */     
  +     public int getProxyPort(){
  +             return this.getPropertyAsInt(PROXY_PORT);
  +     }
  +     
       /**
        * This method uses Apache soap util to create the proper DOM elements.
        * @return Element
  @@ -406,6 +458,14 @@
               // send the message
               Message msg = new Message();
               RESULT.sampleStart();
  +            // if use proxy is set, we create the soaphttpconnection
  +            // and set the host and port
  +                     if (this.getUseProxy()){
  +                             SOAPHTTPConnection spconn = new SOAPHTTPConnection();
  +                             spconn.setProxyHost(this.getProxyHost());
  +                             spconn.setProxyPort(this.getProxyPort());
  +                             msg.setSOAPTransport(spconn);
  +                     }
               msg.send(this.getUrl(), this.getSoapAction(), msgEnv);
   
               SOAPTransport st = msg.getSOAPTransport();
  
  
  

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

Reply via email to