cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Advocate I
Advocate I

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
Community Support
Community Support

 

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
Community Support
Community Support

 

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

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
PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Top Solution Authors
Users online (4,539)