jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nirodha Pramod <>
Subject Issue with SoapSampler.setXmlData()
Date Wed, 01 Feb 2012 17:43:16 GMT

I have a scenario where I read the soap request from a file and I need to
replace some variables in the soap request with the values in a CSV file.
Since Jmeter does not support mapping CSV values to a soap request on a
file I had to use a Beanshell preprocessor also. I have given the script
below. Everything works perfect except that the ---
soapSampler.setXmlData(soapRequest); ---- line at the bottom. I was
debugging the script with a print() line after each line and I found out
that the soap request mapped with the values in the CSV corresponding to
each thread, but the problem is the new soap requst does not get attached
the sampler, before it is sent. It sends the raw request in the file,
instead.  Please have a look, Have I done anything wrong?

import org.apache.jmeter.protocol.http.sampler.SoapSampler;

String paramString = props.getProperty("csvread.variabes");
String []arr = paramString.split(",");
ArrayList params= new ArrayList(Arrays.asList(arr));
vars.putObject("paramsArr", params);

SoapSampler soapSampler = (SoapSampler) sampler;
BufferedReader xmlReader = new BufferedReader(new InputStreamReader(new
StringBuffer xmlData = new StringBuffer();
String line;
while( (line = xmlReader.readLine()) != null) {
xmlData.append(line).append('\n'); }
String soapRequest = xmlData.toString();
ArrayList parameters = vars.getObject("paramsArr");

for(int i=0; i < parameters.size(); i++)
    soapRequest = soapRequest.replaceFirst("#" + parameters.get(i) + "#" ,
vars.get(parameters.get(i)) );
//print("XML set: " + soapRequest);
print("XML set: " + soapSampler.getXMLdata());

*Nirodha Gallage*
Software Engineer, QA.
WSO2 Inc.:
Email:   Mobile: +94716429078

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message