cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
talldutchguy
Level: Power Up

help with Xpath and Soap message

Hi,

 

I am trying to parse several details from a SOAP message.

I have looked at many post and i think i need to use xpath.

However, each time i get an error, so i must be formatting my xpath statements incorrect:

 

InvalidTemplate. Unable to process template language expressions in action 'Compose_2' inputs at line '1' and column '2032': 'The template language function 'xpath' parameters are invalid: the 'xpath' parameter must be a supported, well formed XPath expression. Please see https://aka.ms/logicexpressions#xpath for usage details.
 
 
this is the flow:
it is an HTML POST request that revives a SOAP message back.
flow1.PNG
 
 
the result of the HTTP is the following: 
 
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<ipgapi:IPGApiActionResponse xmlns:ipgapi="http://ipg-online.com/ipgapi/schemas/ipgapi" xmlns:a1="http://ipg-online.com/ipgapi/schemas/a1" xmlns:v1="http://ipg-online.com/ipgapi/schemas/v1">
<ipgapi:successfully>true</ipgapi:successfully>
<ipgapi:OrderId>A-60e00f5b-SomeID</ipgapi:OrderId>
<ipgapi:TransactionId>84521877SomeTransact</ipgapi:TransactionId>
<ipgapi:Url>https://test.p-online.com/connect/processing?store=SomeStore</ipgapi:Url>
</ipgapi:IPGApiActionResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
for example i am trying to parse the TransactionID and / or the URL.
I have tried several versions, but i keep getting invalid XPATH
 
xpath(xml(body('Http')), 'string(/SOAP-ENV:Envelope/SOAP-ENV:Body/ipgapi:IPGApiActionResponse/ipgapi:TransactionId)')
xpath(xml(body('Http')), 'string(/*[name()=\"SOAP-ENV:Envelope\"]/*[name()=\"SOAP-ENV:Body\"]\"]/*[name()=\"ipgapi:IPGApiActionResponse\"]\"]/*[name()=\"ipgapi:TransactionId\"])')
testing this in a xpath tester i do get the correct results
 
any insights would be appreciated - thank you in advance 
 
 
 
 
1 ACCEPTED SOLUTION

Accepted Solutions
Dual Super User
Dual Super User

Re: help with Xpath and Soap message

Hi @talldutchguy 

 

 

The issue might be because of the Namespaces in your XML. Can you try out below expression in the Compose action:
 
xpath(xml(body('Http')), '//*[local-name()="Envelope"]/*[local-name()="Body"]/*[local-name()="IPGApiActionResponse"]/*[local-name()="TransactionId"]/text()')
 
Hope this Helps!
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

2 REPLIES 2
Dual Super User
Dual Super User

Re: help with Xpath and Soap message

Hi @talldutchguy 

 

 

The issue might be because of the Namespaces in your XML. Can you try out below expression in the Compose action:
 
xpath(xml(body('Http')), '//*[local-name()="Envelope"]/*[local-name()="Body"]/*[local-name()="IPGApiActionResponse"]/*[local-name()="TransactionId"]/text()')
 
Hope this Helps!
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

talldutchguy
Level: Power Up

Re: help with Xpath and Soap message

Thank you so much! it works, this in the final result

 

 

xpath(xml(body('Http')), '//*[local-name()="Envelope"]/*[local-name()="Body"]/*[local-name()="IPGApiActionResponse"]/*[local-name()="TransactionId"]/text()')

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 (4,886)