cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
crmkeeper
Level: Powered On

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

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

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

crmkeeper
Level: Powered On

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
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (5,156)