Hi
I am working in version 19.3.
I have called a SOAP API which gives me the result like below:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:retrieveCustomerByIDResponse xmlns="http://xmlns.fid-intl.com/bsd/common/bsdDatatypes/1.0" xmlns:ns2="http://xmlns.fid-intl.com/bsd/customer/customerservice/1" xmlns:ns3="http://xmlns.fid-intl.com/bsd/address/address/1.0" xmlns:ns4="http://xmlns.fid-intl.com/bsd/customer/customer/1.0" xmlns:ns5="http://xmlns.fid-intl.com/bsd/account/account/1.0" xmlns:ns6="http://xmlns.fid-intl.com/bsd/common/filDatatypes/1.0" xmlns:ns7="http://xmlns.fid-intl.com/bsd/adviser/adviser/1.0" xmlns:ns8="http://xmlns.fid-intl.com/bsd/product/product/1.0" xmlns:ns9="http://xmlns.fid-intl.com/bsd/address/address/2.0" xmlns:ns10="http://xmlns.fid-intl.com/bsd/common/filDatatypes/1.4" xmlns:ns11="http://xmlns.fid-intl.com/bsd/party/party/2.0" xmlns:ns12="http://xmlns.fid-intl.com/bsd/mandate/mandate/2/2.0" xmlns:ns13="http://xmlns.fid-intl.com/bsd/customer/customer/2.0" xmlns:ns14="http://xmlns.fid-intl.com/bsd/account/account/2.0" xmlns:ns15="http://xmlns.fid-intl.com/bsd/fee/fee/1.0" xmlns:ns16="http://xmlns.fid-intl.com/bsd/financialplanning/financialplanning/1.0" xmlns:ns17="http://xmlns.fid-intl.com/bsd/product/product/1.3" xmlns:ns18="http://xmlns.fid-intl.com/bsd/reregistration/reregistration/1.0" xmlns:ns19="http://xmlns.fid-intl.com/bsd/investment/investment/1.0" xmlns:ns20="http://xmlns.fid-intl.com/bsd/charge/charge/1.0" xmlns:ns21="http://xmlns.fid-intl.com/bsd/payment/payment/1.0" xmlns:ns22="http://xmlns.fid-intl.com/bsd/mandate/mandate/1.0" xmlns:ns23="http://xmlns.fid-intl.com/bsd/instruction/instruction/1.0" xmlns:ns24="http://xmlns.fid-intl.com/bsd/holdingvaluation/holdingvaluation/1.0" xmlns:ns25="http://xmlns.fid-intl.com/bsd/party/party/1.0" xmlns:ns26="http://xmlns.fid-intl.com/bsd/charge/charge/1.1" xmlns:ns27="http://xmlns.fid-intl.com/bsd/document/document/1.0"><ns2:customerServiceBaseContext><callerReference>IP-Test-01</callerReference><ns6:channel>UKWeb</ns6:channel></ns2:customerServiceBaseContext><ns2:success>true</ns2:success><ns2:customerInformation><ns4:privateIndividualDetails><ns4:registeredAddress xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns3:Address"><ns3:line1>123</ns3:line1><ns3:line2>Roaming Road</ns3:line2><ns3:line3>UK</ns3:line3><ns4:registeredAddress><ns4:contactNumbers><ns4:telephoneNumber>01732777914</ns4:telephoneNumber><ns4:smsSupported>NO</ns4:smsSupported><ns4:contactNumberType>HOME</ns4:contactNumberType></ns4:contactNumbers><ns4:emailAddress>abc@gmail.com</ns4:emailAddress><ns4:title>Mr</ns4:title><ns4:initials>B</ns4:initials><ns4:firstName>Ab</ns4:firstName><ns4:surname>Abc</ns4:surname><ns4:dateofBirth>1977-07-03</ns4:dateofBirth><ns4:gender>Male</ns4:gender><ns4:checking><ns4:CheckProvider>XYGROUP</ns4:CheckProvider><ns4:Verified>YES</ns4:Verified><ns4:status>VERIFIED</ns4:status><ns4:authenticationId>fjgh</ns4:authenticationId><ns4:channel>EI</ns4:channel></ns4:checking></ns2:customerInformation></ns2:retrieveCustomerByIDResponse></soap:Body></soap:Envelope>
Now I want to fetch each of the details from this like line1, line2, emailAddress, checkProvider and channel within checking tag.
Can anyone please suggest how do I use xpathsnippet() in this case [As it is visible, there are namespaces(ns) in it.]
Thanks in advance!!
Discussion posts and replies are publicly visible
I ran this soap envelope through a couple different validation tools. I don't think it's valid syntax.
I expect you'll get better xpath results against a valid block of XML.
Hi Robert Shankin
Thank you for replying!!
This is a sample SOAP body, but an exact replica of my original response from the API.
Without necessarily posting it here, you could run the exact SOAP response in its entirety through an XML formatter just to rule that out as the source of the error.
Hi Komal -
I see what you're saying - as also mentioned - there are formatting and validation tools out there that you can use to verify that you're receiving valid XML.Regardless of the source, invalid xml breaks parsers, full stop.
I'd also suggest looking at an external source for more information on xpathsnippet(). Appian uses the standard syntax for xpath, so you aren't as likely to receive information on Community about xpath. I like checking W3Schools to find specific syntax options and examples: https://www.w3schools.com/xml/xml_xpath.asp
Thanks Robert Shankin Peter Lewis for your suggestions!!
I am able to find a solution to my problem using the function xmltojson() which is part of the plugin XML Parser.