0
votes

In a JMeter (v2.13) test plan I have a SOAP/XML-RPC sampler. The SOAP request itself is loaded from a random file.

Sample request

<mySoapRequest>
  <value>555</value>
</mySoapRequest>

This works fine.

I would now like to replace this fixed value with a variable which is defined in JMeter, i.e.

<mySoapRequest>
  <value>${someValue}</value>
</mySoapRequest>

It seems as if JMeter does not resolve this variable. The actual SOAP request sent to the service does not contain 555 but ${someValue}. Is there any workaround so that I could use variables in the file?

1

1 Answers

1
votes

That can be done using FileToString and eval functions.

For this XML,

<mySoapRequest>
  <value>${someValue}</value>
</mySoapRequest>

In the SOAP/XML RPC request Data section, use the functions as shown below to get the value replaced at run time.

${__eval(${__FileToString(C:\users\me\desktop\soap.xml)})}

__FileToString - The FileToString function can be used to read an entire file. Each time it is called it reads the entire file.

__eval - The eval function returns the result of evaluating a string expression.