pn8572
13 years agoOccasional Contributor
How to check the response dynamically in SoapUi
Hi,
I have the following request.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.xyz.yh.ru/checking/">
<soapenv:Header/>
<soapenv:Body>
<ns:VerificationRequest version="2">
<ns:name>david</ns:name>
<ns:ID>4545</ns:ID>
<ns:ID>1111</ns:ID>
<ns:ID>9875</ns:ID>
</ns:VerificationRequest>
</soapenv:Body>
</soapenv:Envelope>
I've the groovy script to extract the ID from the above request. I have many response XML available under the verification MockService. Say example 1234.xml, 1111.xml & 343443.xml. As per my input request, the one matching is 1111.xml & I want 1111.xml as my response.
The groovy script as follows.
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context);
def holder = groovyUtils.getXmlHolder(mockRequest.requestContent);
for (node in holder["//ns:ID"]) {
log.info "$node";
}
log:
4545
1111
9875
------
The question is - how do I match the $node value to the available responses?
Do I need to use multiple groovy scripts? If yes, how do I do that?
I have the following request.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.xyz.yh.ru/checking/">
<soapenv:Header/>
<soapenv:Body>
<ns:VerificationRequest version="2">
<ns:name>david</ns:name>
<ns:ID>4545</ns:ID>
<ns:ID>1111</ns:ID>
<ns:ID>9875</ns:ID>
</ns:VerificationRequest>
</soapenv:Body>
</soapenv:Envelope>
I've the groovy script to extract the ID from the above request. I have many response XML available under the verification MockService. Say example 1234.xml, 1111.xml & 343443.xml. As per my input request, the one matching is 1111.xml & I want 1111.xml as my response.
The groovy script as follows.
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context);
def holder = groovyUtils.getXmlHolder(mockRequest.requestContent);
for (node in holder["//ns:ID"]) {
log.info "$node";
}
log:
4545
1111
9875
------
The question is - how do I match the $node value to the available responses?
Do I need to use multiple groovy scripts? If yes, how do I do that?