I use jmeter 2.8.
I have sent request using HTTP Request Sampler. I have sent 10 http requests. I have parsed the response using XPath Extractor and stored value in variable.
I have replaced that value in the next http request using Beanshell Preprocessor.
I have used following code:
import org.apache.jmeter.protocol.http.sampler.WebServiceSampler;
WebServiceSampler wsSampler = (WebServiceSampler) sampler;
String requestWithCertif = wsSampler.getXmlData().replaceFirst("#variable to replace#", vars.get("${replacevalue}"));
wsSampler.setXmlData(requestWithCertif);
But the following error has been occurred.
I have followed this link for how parse the response:
ERROR - jmeter.util.BeanShellInterpreter: Error invoking bsh method: eval Sourced file: inline evaluation of: ``import org.apache.jmeter.protocol.http.sampler.WebServiceSampler; WebServiceSamp . . . '' : Typed variable declaration
I hope the error seems to be variable declaration about this line
String requestWithCertif = wsSampler.getXmlData().replaceFirst("#variable to replace#", vars.get("${replacevalue}"));
can someone explain me how to use variable declaration in this beanshell script?
![enter image description here][2]