I'm only passingly familiar with XML. I need to parse a response from a SOAP request. From a lot of searching, I've developed the following query to try to extract the status. Ultimately, I'd like to get the status, cntr and cntr_status fields from the response. My query gives no error, but also no results. What noob error am I making?
SELECT *
FROM XMLTABLE (
XMLNAMESPACES('http://schemas.xmlsoap.org/soap/envelope/' as "soapenv",
'http://www.w3.org/2001/XMLSchema' as "xsd",
'http://www.w3.org/2001/XMLSchema-instance' as "xsi",
'http://service.xxx.com/' AS "xxx"),
'/soapenv:Envelope/soapenv:Body/xxx:sendDataResponse/xxx:sendDataReturn/xxx:result'
PASSING XMLTYPE('<?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:Body>' ||
' <sendDataResponse xmlns="http://service.xxx.com">' ||
' <sendDataReturn>' ||
' <result>' ||
' <build>Build 1</build>' ||
' <status>SUCCESS</status>' ||
' <cntr_statuses>' ||
' <cntr_result>' ||
' <cntr>1234567890A</cntr><cntr_status>SUCCESS</cntr_status>' ||
' </cntr_result>' ||
' <cntr_result>' ||
' <cntr>1234567890B</cntr><cntr_status>SUCCESS</cntr_status>' ||
' </cntr_result>' ||
' </cntr_statuses>' ||
' </result>' ||
' </sendDataReturn>' ||
' </sendDataResponse>' ||
' </soapenv:Body>' ||
'</soapenv:Envelope>')
COLUMNS status VARCHAR2(20) PATH 'xxx:status') xmlstuff ;
A sample response from the service is hard-coded into the XMLTYPE function.
I've tried any number of query strings and column paths involving the xxx namespace, all yielding no results.
There could be hundreds of cntr and cntr_status pairs.
Thanks for looking!