How to combine 2 XML requests
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to combine 2 XML requests
Is it possible to combine 2 XML requests with the same end point?
Execute Request 2 only if response status of Request 1 is "0".
Request 1:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://www.net2.com/mega/view/soap/types">
<soapenv:Header/>
<soapenv:Body>
<typ:SearchRequest limit="1">
<typ:searchParams view="enum-dns.zones.enum.e164enum_net.data" key="number='3133140001' rrid=0"/>
</typ:SearchRequest>
</soapenv:Body>
</soapenv:Envelope>
Request 2:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://www.net2.com/mega/view/soap/types">
<soapenv:Header/>
<soapenv:Body>
<typ:GetRequest view="enum-dns.zones.enum.e164enum_net.data" key="number='3133140001' rrid=0"/>
</soapenv:Body>
</soapenv:Envelope>
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'd use a Groovy step after Request 1 to check the value of interest, if it's there, I'd let the Request 2 step run. If it's not there, I'd 'jump' over request 2 to another step.
The below is some pseudo code to illustrate the Groovy Step to check the value from Request 1.
def requestOneValue = context.expand( '${StepName#Response}' );
if (requestOneValue == "0") {
// Do nothing here and let the test continue onto Request 2
} else {
// We don't have the value, so don't run Request 2.
log.info("Skipping Request 2");
testRunner.gotoStepByName("Name of first step AFTER request 2");
}
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, Groovy would work. In fact, I already created a Groovy script to include these 2 and other steps. I am hoping there is a way to combine the 2 requests in one API without Groovy.
I do not know this context.expand function. I will read up on this.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm really not understanding what you're trying to achieve.
@Mis3 wrote:
Is it possible to combine 2 XML requests with the same end point?
Execute Request 2 only if response status of Request 1 is "0".
You could combine the two payloads to create a single one? Are you expecting the backend to process payload one and then process payload two based on response
Or do you want to combine both payloads into a single test step, and SoapUI only uses the first part; gets a response and then decides to send the second part?
