You're trying to extract the path
s/s/storeContract/storeRequest/contract/contractSeries
but your SOAP response doesn't have any nodes called s
; it has nodes called Envelope, Header and Body in the namespace s
. So you potentially want the path:
/s:Envelope/s:Body/storeContract/storeRequest/contract/contractSeries
which on its own gets an LPX-00601: Invalid token
error because it doesn't know what s:
is. You can supply the namespaces with the third argument:
select extractvalue(XMLType(sap.request_info),
'/s:Envelope/s:Body/storeContract/storeRequest/contract/contractSeries',
'xmlns="xxx/integration" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"'
) as contractseries
from sap;
or the lazy way is to wildcard the namespace and only identify the final node you want:
select extractvalue(XMLType(sap.request_info),'//*:contractSeries') as contractseries
from sap;
But extractvaue
is deprecated so it's better to use XMLQuery - still being lazy:
select XMLQuery('//*:contractSeries/text()'
passing XMLType(sap.request_info)
returning content) as contractseries
from sap;
or with explicit namespaces:
select XMLQuery('
declare default element namespace "xxx/integration";
declare namespace s="http://schemas.xmlsoap.org/soap/envelope/";
/s:Envelope/s:Body/storeContract/storeRequest/contract/contractSeries/text()'
passing XMLType(sap.request_info)
returning content) as contractseries
from sap;
CONTRACTSERIES
------------------------------
ineedthis
db<>fiddle