max1965
13 years agoContributor
manage xml response
From the following XML response:
<LIA errorCode="6000">
<attributes>
<attr name="cliExt">
<value>0802100000</value>
</attr>
<attr name="outBoundProxy">
<value>83.175.6.7</value>
</attr>
<attr name="svcType">
<value>APT</value>
</attr>
<attr name="accessDevice">
<value>AG</value>
</attr>
<attr name="userDevice">
<value>WIFI</value>
</attr>
</attributes>
<errorMessage/>
</LIA>
with the groovy script:
import com.eviware.soapui.support.xml.XmlUtils
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
xmlResponseHolder = groovyUtils.getXmlHolder("LIR APT NAKED#ResponseAsXML")
xmlBody = new XmlSlurper().parseText(xmlResponseHolder.getXml())
errorCode = xmlBody.@errorCode
log.info errorCode
is extract the errorCode value (6000) from the response; how the script must be modified to extract the cliExt value (0802100000) ?
<LIA errorCode="6000">
<attributes>
<attr name="cliExt">
<value>0802100000</value>
</attr>
<attr name="outBoundProxy">
<value>83.175.6.7</value>
</attr>
<attr name="svcType">
<value>APT</value>
</attr>
<attr name="accessDevice">
<value>AG</value>
</attr>
<attr name="userDevice">
<value>WIFI</value>
</attr>
</attributes>
<errorMessage/>
</LIA>
with the groovy script:
import com.eviware.soapui.support.xml.XmlUtils
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
xmlResponseHolder = groovyUtils.getXmlHolder("LIR APT NAKED#ResponseAsXML")
xmlBody = new XmlSlurper().parseText(xmlResponseHolder.getXml())
errorCode = xmlBody.@errorCode
log.info errorCode
is extract the errorCode value (6000) from the response; how the script must be modified to extract the cliExt value (0802100000) ?