Search code examples
xmlgroovyjmeterjsr223

unexpected token while reading xml to string in JSR223 sampler


I'm trying to read a string which has XML and facing an unexpected token issue.

I'm using a JSR223 Sampler in JMeter and trying to read value by using

request_payload=vars.get("${requestPayload}");

I have my xml in variable requestPayload= "<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"> <soap:Header><wsse:Security "

I want to read this value in JSR223 Sampler.

The error message:

Response message: javax.script.ScriptException: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script4.groovy: 1: unexpected token: http @ line 1, column 54. t("<soap:Envelope xmlns:soap="http://www


Solution

  • Don't use ${} syntax in JSR223, Simply

      vars.get("requestPayload");