web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / how to get XML element...
Power Automate
Answered

how to get XML element value with Name Space

(0) ShareShare
ReportReport
Posted on by 29

Hi Team,

 

I have one user case to extract the error message from a SOAP web servie response.  The XML is below and my question is how to retrieve the error message from "<ns3:tt_msg_desc>ERROR: Invalid User ID/Password.</ns3:tt_msg_desc>"? I have tried the get XML element attribute and value, but I met problem with the name space in XPATH. Appreciate some one can shed some light. 

 

<?xml version="1.0" encoding="utf-8"?>

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<wsa:To xmlns:wsa="http://www.w3.org/2005/08/addressing" soapenv:actor="" soapenv:mustUnderstand="0">urn:services-qad-com:</wsa:To>
<wsa:Action xmlns:wsa="http://www.w3.org/2005/08/addressing" soapenv:actor="" soapenv:mustUnderstand="0"></wsa:Action>
<wsa:MessageID xmlns:wsa="http://www.w3.org/2005/08/addressing" soapenv:actor="" soapenv:mustUnderstand="0">urn:messages-qad-com:2022-10-09T22:45:17-0500</wsa:MessageID>
<wsa:RelatesTo xmlns:wsa="http://www.w3.org/2005/08/addressing" soapenv:actor="" soapenv:mustUnderstand="0">urn:services-qad-com::QADERP</wsa:RelatesTo>
</soapenv:Header>
<soapenv:Body>
<ns1:maintainDailyLeadPriceResponse xmlns:ns1="urn:schemas-qad-com:xml-services" xmlns="urn:schemas-qad-com:xml-services">
<ns1:result>error</ns1:result>
<ns2:dsSessionContext xmlns:ns2="urn:schemas-qad-com:xml-services:common">
<ns2:ttContext>
<ns2:propertyQualifier>QAD</ns2:propertyQualifier>
<ns2:propertyName>domain</ns2:propertyName>
<ns2:propertyValue>PSCN</ns2:propertyValue>
</ns2:ttContext>
<ns2:ttContext>
<ns2:propertyQualifier>QAD</ns2:propertyQualifier>
<ns2:propertyName>scopeTransaction</ns2:propertyName>
<ns2:propertyValue>false</ns2:propertyValue>
</ns2:ttContext>
<ns2:ttContext>
<ns2:propertyQualifier>QAD</ns2:propertyQualifier>
<ns2:propertyName>version</ns2:propertyName>
<ns2:propertyValue>ERP3_1x</ns2:propertyValue>
</ns2:ttContext>
<ns2:ttContext>
<ns2:propertyQualifier>QAD</ns2:propertyQualifier>
<ns2:propertyName>mnemonicsRaw</ns2:propertyName>
<ns2:propertyValue>false</ns2:propertyValue>
</ns2:ttContext>
<ns2:ttContext>
<ns2:propertyQualifier>QAD</ns2:propertyQualifier>
<ns2:propertyName>username</ns2:propertyName>
<ns2:propertyValue>xxxx</ns2:propertyValue>
</ns2:ttContext>
<ns2:ttContext>
<ns2:propertyQualifier>QAD</ns2:propertyQualifier>
<ns2:propertyName>password</ns2:propertyName>
<ns2:propertyValue>******</ns2:propertyValue>
</ns2:ttContext>
<ns2:ttContext>
<ns2:propertyQualifier>QAD</ns2:propertyQualifier>
<ns2:propertyName>action</ns2:propertyName>
<ns2:propertyValue/>
</ns2:ttContext>
<ns2:ttContext>
<ns2:propertyQualifier>QAD</ns2:propertyQualifier>
<ns2:propertyName>entity</ns2:propertyName>
<ns2:propertyValue/>
</ns2:ttContext>
<ns2:ttContext>
<ns2:propertyQualifier>QAD</ns2:propertyQualifier>
<ns2:propertyName>email</ns2:propertyName>
<ns2:propertyValue/>
</ns2:ttContext>
<ns2:ttContext>
<ns2:propertyQualifier>QAD</ns2:propertyQualifier>
<ns2:propertyName>emailLevel</ns2:propertyName>
<ns2:propertyValue/>
</ns2:ttContext>
</ns2:dsSessionContext>
<ns3:dsExceptions xmlns:ns3="urn:schemas-qad-com:xml-services:common">
<ns3:temp_err_msg>
<ns3:tt_level xsi:nil="true"/>
<ns3:tt_msg_context/>
<ns3:tt_msg_data/>
<ns3:tt_msg_datetime>2022-10-09T22:45:16-0500</ns3:tt_msg_datetime>
<ns3:tt_msg_desc>ERROR: Invalid User ID/Password.</ns3:tt_msg_desc>
<ns3:tt_msg_field/>
<ns3:tt_msg_index>0</ns3:tt_msg_index>
<ns3:tt_msg_keys/>
<ns3:tt_msg_keys/>
<ns3:tt_msg_keys/>
<ns3:tt_msg_keys/>
<ns3:tt_msg_keys/>
<ns3:tt_msg_keys/>
<ns3:tt_msg_nbr>MfgProErrorMessage</ns3:tt_msg_nbr>
<ns3:tt_msg_processed>false</ns3:tt_msg_processed>
<ns3:tt_msg_sev>error</ns3:tt_msg_sev>
</ns3:temp_err_msg>
<ns3:temp_err_msg>
<ns3:tt_level xsi:nil="true"/>
<ns3:tt_msg_context/>
<ns3:tt_msg_data/>
<ns3:tt_msg_datetime>2022-10-09T22:45:16-0500</ns3:tt_msg_datetime>
<ns3:tt_msg_desc>ERROR: Unable to initialize session.</ns3:tt_msg_desc>
<ns3:tt_msg_field/>
<ns3:tt_msg_index>1</ns3:tt_msg_index>
<ns3:tt_msg_keys/>
<ns3:tt_msg_keys/>
<ns3:tt_msg_keys/>
<ns3:tt_msg_keys/>
<ns3:tt_msg_keys/>
<ns3:tt_msg_keys/>
<ns3:tt_msg_nbr>MfgProErrorMessage</ns3:tt_msg_nbr>
<ns3:tt_msg_processed>false</ns3:tt_msg_processed>
<ns3:tt_msg_sev>error</ns3:tt_msg_sev>
</ns3:temp_err_msg>
</ns3:dsExceptions>
</ns1:maintainDailyLeadPriceResponse>
</soapenv:Body>
</soapenv:Envelope>

I have the same question (0)
  • Verified answer
    kinuasa Profile Picture
    795 Most Valuable Professional on at

    Hi,
    I recommend using the local-name function as follows.

     

    //*[local-name()='tt_msg_desc']/text()

     

    Regards,
    kinuasa

     

    Sample Flow:

    XML.ReadFromFile File: $'''C:\\Test\\Sample.xml''' Encoding: XML.FileEncoding.UTF8 XmlDocument=> XmlDocument
    XML.ExecuteXPathQuery.ExecuteXPath XmlDocument: XmlDocument XPathQuery: $'''//*[local-name()=\'tt_msg_desc\']/text()''' XPathResults=> XPathResults
    LOOP FOREACH CurrentItem IN XPathResults
     Display.ShowMessageDialog.ShowMessage Message: CurrentItem Icon: Display.Icon.None Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: True ButtonPressed=> ButtonPressed
    END
  • RickMa Profile Picture
    29 on at

    Thanks for recommendation. The xpath query syntax works, but it is weird that it return me "No element". Do you have any idea about it? 

     

    Microsoft.Flow.RPA.Desktop.Modules.SDK.ActionException: XPath expression returned no element. ---> System.ApplicationException: Error in the application.
    --- End of inner exception stack trace ---
    at Microsoft.Flow.RPA.Desktop.Modules.XML.Actions.Utilities.GetXmlElement(XmlNodeObject xmlNodeObject, String xpathQuery)
    at Microsoft.Flow.RPA.Desktop.Modules.XML.Actions.GetXmlElementValue.Execute(ActionContext context)
    at Microsoft.Flow.RPA.Desktop.Robin.Engine.Execution.ActionRunner.Run(IActionStatement statement, Dictionary`2 inputArguments, Dictionary`2 outputArguments)

  • Verified answer
    VJR Profile Picture
    7,635 on at

    Hi @RickMa 

     

    The solution shared by @kinuasa  did work giving out a List of the values for the XML you shared.

    Could you double check everything.

     

    VJR_0-1665983523065.png

     

  • RickMa Profile Picture
    29 on at

    Hi, 

     

    The reason is that I used xpath query in Get XML element value component which brought me the error message. It did work as it was mentioned in Execute Xpath expression. Thank you all for help. 

  • Shivlay Profile Picture
    32 on at

    Thanks @kinuasa . Helped me get through the same issue 😁

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard