Skip to main content

Thanks to KuanChiang Lui‌ to provide this Trick.

Below is the example output response from SOAP web request. The return output in XML format.

 

<?xml version="1.0"
  encoding="utf-8"?>

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
  <AddListResponse
  xmlns="http://schemas.microsoft.com/sharepoint/soap/">
  <AddListResult>string</AddListResult>
  </AddListResponse>
  </soap:Body>

</soap:Envelope>

 

By using the XPath expression, we able to get the value of AddListResult] and saved it into variable for subsequent action.

 

XPath format: //soap:Body/descendant::*dname()='<Node name>']

//soap:Body/descendant::*dname()='AddListResult']

Pic1.png

Try it in "Run Now"

Pic2.png


Other example:

 

XML

XPath

Result

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

  <soap:Body>

    <GetUserPropertyByAccountNameResponse xmlns="http://microsoft.com/webservices/SharePointPortalServer/UserProfileService">

      <GetUserPropertyByAccountNameResult>

        <IsPrivacyChanged>false</IsPrivacyChanged>

        <IsValueChanged>false</IsValueChanged>

        <Name>FirstName</Name>

        <Privacy>Public</Privacy>

        <Values>

          <ValueData>

            <Value xsi:type="xsd:string">MyName</Value>

          </ValueData>

        </Values>

      </GetUserPropertyByAccountNameResult>

    </GetUserPropertyByAccountNameResponse>

  </soap:Body>

</soap:Envelope>

//*olocal-name()='Value']

 

OR

 

//soap:Body/descendant::*/name()='Value']

MyName

<?xml version="1.0" encoding="utf-8"?>

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <soap:Body>

    <GetListItemsResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/">

      <GetListItemsResult>

        <listitems xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:z="#RowsetSchema">

          <rs:data ItemCount="2">

 

            <z:row ows_EventDate="2015-01-05 11:00:00" ows_EndDate="2015-05-22 12:00:00" ows_fRecurrence="1" ows_EventType="1" ows_Title="Backlog Review Test" ows_Location="Meeting Room" />

 

            <z:row ows_EventDate="2015-01-30 16:00:00" ows_EndDate="2015-01-30 17:30:00" ows_fRecurrence="0" ows_EventType="0" ows_Title="Happy Friday" ows_Location="Anywhere" />

 

          </rs:data>

        </listitems>

      </GetListItemsResult>

    </GetListItemsResponse>

  </soap:Body>

</soap:Envelope>

Be the first to reply!

Reply