org.w3c.dom.Element rdoc = createDocument();
if (rdoc == null)
throw new SOAPException("Could not create document", null);
Envelope msgEnv = Envelope.unmarshall(rdoc);
// create a new message
Message msg = new Message();
result.sampleStart();
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();
}
spconn.setTimeout(getTimeoutAsInt());
// set the auth. thanks to KiYun Roe for contributing the patch
// I cleaned up the patch slightly. 5-26-05
if (getAuthManager() != null) {
if (getAuthManager().getAuthForURL(getUrl()) != null) {
AuthManager authmanager = getAuthManager();
Authorization auth = authmanager.getAuthForURL(getUrl());
spconn.setUserName(auth.getUser());
spconn.setPassword(auth.getPass());
} else {
log.warn("the URL for the auth was null." + " Username and password not set");
}
}
// 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()) {
if (this.getProxyHost().length() > 0 && this.getProxyPort() > 0) {
phost = this.getProxyHost();
pport = this.getProxyPort();
} else {
if (System.getProperty("http.proxyHost") != null || System.getProperty("http.proxyPort") != null) {
phost = System.getProperty("http.proxyHost");
pport = Integer.parseInt(System.getProperty("http.proxyPort"));
}
}
// if for some reason the host is blank and the port is
// zero, the sampler will fail silently
if (phost.length() > 0 && pport > 0) {
spconn.setProxyHost(phost);
spconn.setProxyPort(pport);
if (PROXY_USER.length()>0 && PROXY_PASS.length()>0){
spconn.setProxyUserName(PROXY_USER);
spconn.setProxyPassword(PROXY_PASS);
}
}
}
// 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();
result.setDataType(SampleResult.TEXT);
BufferedReader br = null;
// check to see if SOAPTransport is not nul and receive is
// also not null. hopefully this will improve the error
// reporting. 5/13/05 peter lin