Forum Discussion

pn8572's avatar
pn8572
Occasional Contributor
13 years ago

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?

2 Replies

  • pn8572's avatar
    pn8572
    Occasional Contributor
    I got the solution for this. I couldn't find any better way. I placed the response files in the local machine and read each file name & when there is a match in the name , then return the corresponding xml response which is available in SoapUI project.

    Now, I have the question, is there any way, I can return the file from the local drive as response itself.