cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
Dual Super User III
Dual Super User III

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
Highlighted
Dual Super User III
Dual Super User III

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

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()')
Highlighted

@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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Users online (11,719)