Forum Discussion

RobWithers's avatar
RobWithers
Occasional Contributor
12 years ago

How to assert an element in a SOAP response list?

I am getting a soap response, which includes the following fragment. How can I specify an assertion for a particular element of the list, without a guarantee of the order the response list is in? So, for instance, let us say the RAF_Intro element is sometimes the 2nd element and sometimes the 5th element. Thanks!

<lookupPageContentHeadersOutput>
<contentList>
<content>
<contentSID>111</contentSID>
<contentId>RAF_Mail</contentId>
<contentStatus>DEPLOYED</contentStatus>
</content>
<content>
<contentSID>110</contentSID>
<contentId>RAF_Intro</contentId>
<contentStatus>DEPLOYED</contentStatus>
</content>
<content>
<contentSID>109</contentSID>
<contentId>RAF_Email</contentId>
<contentStatus>DEPLOYED</contentStatus>
</content>
<content>
<contentSID>112</contentSID>
<contentId>RAF_Disclosures</contentId>
<contentStatus>DEPLOYED</contentStatus>
</content>
</contentList>
</lookupPageContentHeadersOutput>

1 Reply

  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi!

    Try adding an XPath assertion using something like this:

    [..] lookupPageContentHeadersOutput/contentList/content/contentId/text()

    and as Expected Results enter

    RAF_Intro



    --
    Regards

    Erik
    SmartBear Sweden