ORACLE解析SOAP报文异常:
ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00210: expected '<' instead of '?'
报文样例:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<m:REC_SO_OUTPUT xmlns:m="http://ws.youyou.com/OrdersSer/aliBody">
<h:SERVICE_NAME>aaa</h:SERVICE_NAME>
报错sql:
select extractvalue(xmltype(resp_msg),'/SOAP-ENV:Envelope/SOAP-ENV:Body/m:REC_SO_OUTPUT /h:SERVICE_NAME/text()') from tab_msg;
正确打开方式:
extract(xmltype(resp_msg),'/SOAP-ENV:Envelope/SOAP-ENV:Body/m:REC_SO_OUTPUT /h:SERVICE_NAME/text()',
'xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:m="http://ws.youyou.com/OrdersSer/aliBody"')
这种方式会有中文乱码,加.getStringVal()解决:
extract(xmltype(resp_msg),'/SOAP-ENV:Envelope/SOAP-ENV:Body/m:REC_SO_OUTPUT /h:SERVICE_NAME/text()',
'xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:m="http://ws.youyou.com/OrdersSer/aliBody"').getStringVal()