Iterating and Parsing SOAP Response Elements
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2018 08:53 AM
I am trying to parse through a SOAP response from an outbound web service. As such, since I am operating from a scoped application, I am unable to return a nodelist of elements. My goal is to grab the PIID and modNumber from the soap response below:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<getListResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<getListAwardResponse>
<listOfAwardSummaries>
<awardSummary>
<awardID>
<awardContractID>
<agencyID>1111</agencyID>
<PIID>987AND623</PIID>
<modNumber>0</modNumber>
<transactionNumber>0</transactionNumber>
</awardContractID>
<referencedIDVID>
<agencyID>1111</agencyID>
<PIID>432A</PIID>
<modNumber>0</modNumber>
</referencedIDVID>
</awardID>
</awardSummary>
<awardSummary>
<awardID>
<awardContractID>
<agencyID>1620</agencyID>
<PIID>987ABC992</PIID>
<modNumber>0</modNumber>
<transactionNumber>0</transactionNumber>
</awardContractID>
<referencedIDVID>
<agencyID>1620</agencyID>
<PIID>964Z</PIID>
<modNumber>0</modNumber>
</referencedIDVID>
</awardID>
</awardSummary>
</listOfAwardSummaries>
</getListAwardResponse>
</getListResponse>
</soapenv:Body>
</soapenv:Envelope>

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2018 09:56 PM
There is an api for scoped app, look at XMLDocument2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2018 07:03 AM
I am aware XMLDocument2. However, it is a scaled down version of XMLDocument that allows for returning all the 'awardSummary' nodes in the example above. My expected response could have one to many 'awardSummary' nodes. In other words how to I get a list of nodes with the same element tag name?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2018 07:07 AM
I need to grab all the 'awardSummary' nodes, reading out the PIID and the modNumber.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2018 07:02 AM
The code in this thread seems to work for me so far: https://community.servicenow.com/community?id=community_question&sys_id=ea36c7a1db1cdbc01dcaf3231f96... I'm not using it in a scoped app though.