tags:

views:

37

answers:

1

I have a response that contains the following:

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"&gt;
   <env:Header/>
   <env:Body>
      <project:loginResponse xmlns:project="http://project.somewhere.com/"&gt;
         <return>34715527grsbN3C</return>
      </project:loginResponse>
   </env:Body>
</env:Envelope>

I need to get the value in for a session ID but I get error probably because return is a reserved word. I have tried to escape it but that just treats the line as comments.

groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
holder = groovyUtils.getXmlHolder("login - Request 1#Response" )
return = holder.getNodeValue( "//return" )
assert return != null
assert return.length() > 0
returnNode = groovyUtils.getXmlHolder(loginResponse)
sessID = returnNode.getNodeValue("//return")
log.info(sessID)
assert sessID !=null
context["sessID"] = sessID
A: 

WHat happens if you use variable names that are not reserved words?

ret = holder.getNodeValue( "//return" )
assert ret != null
assert ret.length() > 0
tim_yates