cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

xPath parsing noob

I don't really have any idea what I am doing, but trying to get a value from this response.

There is only one field in the return, and i see it when I send to email. 

HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <LoginResponse xmlns="http://...../webservices">
      <LoginResult>string</LoginResult>
    </LoginResponse>
  </soap12:Body>
</soap12:Envelope>

I have tried to read most blog post, but I just can't get it to work. I am all over the place with xPath 🙂 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: xPath parsing noob

 

Hi @crmkeeper ,

 

The issue might be because of the Namespaces in your XML. Please try to use the following expression to get the string.

Expression reference:

xpath(xml(outputs('Compose')), '//*[local-name()="Envelope"]/*[local-name()="Body"]/*[local-name()="LoginResponse"]/*[local-name()="LoginResult"]/text()')[0]

Image reference:
14.PNG

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Highlighted
Community Support
Community Support

Re: xPath parsing noob

 

Hi @crmkeeper ,

 

The issue might be because of the Namespaces in your XML. Please try to use the following expression to get the string.

Expression reference:

xpath(xml(outputs('Compose')), '//*[local-name()="Envelope"]/*[local-name()="Body"]/*[local-name()="LoginResponse"]/*[local-name()="LoginResult"]/text()')[0]

Image reference:
14.PNG

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Frequent Visitor

Re: xPath parsing noob

I owe you a beer!!! ❤️

I have no idea how I would be able to understand this without you. Do you mind sharing what I should think about next time i see a similar XML? I am not 100% sure what namespaces are but gessing it is related to the "Soap12:Envelope", and it not just being "Envelope"?

 

Also could you try to explain why you use //* in the beginning? 
Can I use the "local-name" every time even if there is a namespace issue or not? 
I see you added the /text() at the end and that, and others have put things in a String(' '). I am guessing that is the same result? 

The end [0] you are treating it like an array, is that because there could be more than one response? 

 

Thank you again for helping me with this!!:)

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Users online (7,728)