woolfel 2004/01/30 05:51:01
Modified: src/protocol/http/org/apache/jmeter/protocol/http/sampler
WebServiceSampler.java
Log:
updated webservice sampler to maintain session. to get it to work,
I had to modify HeaderManager, so that I can store the
SOAPHTTPConnection object. I was able to test it using my Echo servlet
and echo back the cookies.
peter lin
Revision Changes Path
1.12 +33 -13
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.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- WebServiceSampler.java 24 Jan 2004 02:13:57 -0000 1.11
+++ WebServiceSampler.java 30 Jan 2004 13:51:01 -0000 1.12
@@ -499,17 +499,30 @@
{
org.w3c.dom.Element rdoc = createDocument();
Envelope msgEnv = Envelope.unmarshall(rdoc);
-
- // send the message
+ // create a new message
Message msg = new Message();
RESULT.sampleStart();
- // if use proxy is set, we create the soaphttpconnection
- // and set the host and port
+ SOAPHTTPConnection spconn = null;
+ // if a blank HeaderManager exists, try to
+ // get the SOAPHTTPConnection. After the first
+ // request, there should be a connection object
+ // stored with the cookie header info.
+ if (this.getHeaderManager() != null &&
+ this.getHeaderManager().getSOAPHeader() != null) {
+ spconn = (SOAPHTTPConnection)this.getHeaderManager().
+ getSOAPHeader();
+ } else {
+ spconn = new SOAPHTTPConnection();
+ }
+ // check the proxy
+ String phost = "";
+ int pport = 0;
+ // if use proxy is set, we try to pick up the
+ // proxy host and port from either the text
+ // fields or from JMeterUtil if they were passed
+ // from command line
if (this.getUseProxy()){
- String phost = "";
- int pport = 0;
- if (this.getProxyHost().length() > 0 &&
- this.getProxyPort() > 0){
+ if (this.getProxyHost().length() > 0 &&
this.getProxyPort() > 0){
phost = this.getProxyHost();
pport = this.getProxyPort();
} else {
@@ -522,12 +535,19 @@
}
// if for some reason the host is blank and the port is
// zero, the sampler will fail silently
- SOAPHTTPConnection spconn = new SOAPHTTPConnection();
- spconn.setProxyHost(phost);
- spconn.setProxyPort(pport);
- msg.setSOAPTransport(spconn);
+ if (phost.length() > 0 && pport > 0){
+ spconn.setProxyHost(phost);
+ spconn.setProxyPort(pport);
+ }
}
+ // by default we maintain the session.
+ spconn.setMaintainSession(true);
+ msg.setSOAPTransport(spconn);
msg.send(this.getUrl(), this.getSoapAction(), msgEnv);
+
+ if (this.getHeaderManager() != null){
+ this.getHeaderManager().setSOAPHeader(spconn);
+ }
SOAPTransport st = msg.getSOAPTransport();
BufferedReader br = st.receive();
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]