I'm having difficulties extracting values from a web service SOAP response (below) . As best as I can tell the Oracle XML parser does not like undeclared namespaces? Specifically in our service response the summaryInfo element has an undeclared namespace (see xmlns="" beside the <summaryInfo> element ). When I remove this from the response the Oracle parser is able to extract it's element value correctly.
SQL> select * from V$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
PL/SQL Release 11.1.0.7.0 - Production
CORE 11.1.0.7.0 Production
TNS for Linux: Version 11.1.0.7.0 - Production
NLSRTL Version 11.1.0.7.0 - Production
Service Response
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<getSummaryInfoResponse xmlns="http://abc.com/">
<summaryInfo xmlns="">
<totalPayments>148</totalPayments>
<lastPaymentDate>04/19/2010</lastPaymentDate>
<currentBalance>37</currentBalance>
<lastPaymentAmount>37</lastPaymentAmount>
</summaryInfo>
</getSummaryInfoResponse>
</S:Body>
</S:Envelope>
So in Oracle this will NOT return the totalPayments node:
SELECT EXTRACTVALUE (VALUE (t),
'/*/totalPayments',
'xmlns="http://abc.com/" xmlns=""'
) "totalPayments",
VALUE (t).getstringval () "payload"
FROM DUAL c,
TABLE
(XMLSEQUENCE
(EXTRACT
(XMLTYPE.createxml
('
<getSummaryInfoResponse xmlns="http://abc.com/" elementFormDefault="qualified">
<summaryInfo xmlns="">
<totalPayments>148</totalPayments>
<lastPaymentDate>04/19/2010</lastPaymentDate>
<currentBalance>37</currentBalance>
<lastPaymentAmount>37</lastPaymentAmount>
</summaryInfo>
</getSummaryInfoResponse>'
),
'//summaryInfo',
'xmlns="http://abc.com/" xmlns=""'
)
)
) t
However, when removing xmlns="" it will correctly return the totalyPayments node value of 148.
What am I missing in my syntax?
Edited by: rnanton on Jun 14, 2010 10:53 AM