Forum Discussion
- ccdssv1ContributorHi
This will be a simple script that's do what you say:
//xml processing libray
import com.eviware.soapui.support.xml.XmlUtils
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
//replace the <TestStepName> with the actual test name
xmlResponseHolder = groovyUtils.getXmlHolder("<TestStepName>#ResponseAsXML")
xmlBody = new XmlSlurper().parseText(xmlResponseHolder .getXml())
errorCode = xmlBody.aca[0].@errorCode
log.info errorCode
this should do what you ask for - max1965ContributorThanks. I try your code, but did not works.
This is the response:
HTTP/1.1 200 OK
Date: Wed, 06 Feb 2013 15:03:18 GMT
Server: WebLogic Server 8.1 SP2 Fri Dec 5 15:01:51 PST 2003 316284
Content-Length: 84
Content-Type: text/html
<?xml version="1.0" ?>
<ACA errorCode="5000">
<errorMessage></errorMessage>
</ACA>
This is the output from log.info:
Wed Feb 06 16:03:18 CET 2013:INFO:
The errorCode 5000 is not extract from the response message - max1965ContributorI have tried also with ACA, but the errorCode is not extract from the response
- ccdssv1Contributorhmm I'm always confuse with this xpaths when I can't try them
pls try this one: errorCode = xmlBody.@errorCode
anyway there are more ways to access xml response you can finde some info here : http://www.robert-nemet.com/2011/11/gro ... oapui.html - max1965ContributorNow works; thanks
Related Content
Recent Discussions
- 15 years ago