14 years ago
Fetch node value from response xml
I am using the below code to fetch the node value from response xml but it returns a NULL value.
Any idea on how to fix this?
Thanks is advance.
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context );
def responseHolder = groovyUtils.getXmlHolder("CreateContent#Response");
responseHolder.declareNamespace( 'se', 'http://website/contentservice/')
MID=responseHolder.getNodeValue("//se:node1[0]/node2[0]/node3[0]/node4[0]");
log.info(MID)
The response is as below:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<n1 xmlns="http://website/contentservice/">
<n2>
<n3>7iY1pgMjc</n3>
<n4>
<n5>true</n5>
</n4>
<n6>
<n7>20110</n7>
</n6>
</n2>
</n1>
</soap:Body>
</soap:Envelope>
Any idea on how to fix this?
Thanks is advance.
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context );
def responseHolder = groovyUtils.getXmlHolder("CreateContent#Response");
responseHolder.declareNamespace( 'se', 'http://website/contentservice/')
MID=responseHolder.getNodeValue("//se:node1[0]/node2[0]/node3[0]/node4[0]");
log.info(MID)
The response is as below:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<n1 xmlns="http://website/contentservice/">
<n2>
<n3>7iY1pgMjc</n3>
<n4>
<n5>true</n5>
</n4>
<n6>
<n7>20110</n7>
</n6>
</n2>
</n1>
</soap:Body>
</soap:Envelope>