cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
talldutchguy
New Member

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

3 REPLIES 3
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

Highlighted
talldutchguy
New Member

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()')
wstock Helper I
Helper I

Re: help with Xpath and Soap message

@yashag2255 - I am trying to accomplish something similar, and I've used your suggestion, but I must be missing something, I can't seem to make it work, the output of the compose step is blank.   Here is a sample of the XML that gets returned from in the API response that is going into the Compose step....I need to be able to use the data under <RESOURCES><AIRCRAFT>.

I've tried this so far...but the compose output is just BLANK.

 

 

xpath(xml(body('Operations_-_Aircraft_Info')), '//*[local-name()="Envelope"]/*[local-name()="Body"]/*[local-name()="etaWebServicesResponse"]/*[local-name()="RESOURCES"]/text()')

 

 

Sample API XML response data.  

 

 

<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <SOAP-ENV:Body>
        <ns1:etaWebServicesResponse xmlns:ns1="http://ws.talonsystems.com/Talonws.wsdl" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
            <return xsi:type="xsd:string">
                <RESOURCES>
                    <AIRCRAFT>
                        <AIRCRAFT_ID>XX</AIRCRAFT_ID>
                        <AIRCRAFT>XXXXXX</AIRCRAFT>
                        <SITE_ID/>
                        <SITE/>
                        <DESCRIPTION>XXXXXX</DESCRIPTION>
                        <RESOURCE_TYPE>XXXXX</RESOURCE_TYPE>
                        <COLOR>XXXXXX</COLOR>
                        <AIRCRAFT_CLASS>XXXXX</AIRCRAFT_CLASS>
                        .....
                        .....
                   </AIRCRAFT>
                </RESOURCES>
            </return>
        </ns1:etaWebServicesResponse>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

 

 

 

Helpful resources

Announcements
firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Automate Community!

firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

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!

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (6,269)