我尝试使用XMLTABLE将ResponseMSG放入表中,但在解析SAOP响应时PATH出现了问题。错误是:SQL状态10506,代码-16005
XPath表达式引用了具有静态上下文的未定义名称soap
我不确定这里出了什么问题。XML中没有命名空间,所以我认为路径
***/soap:信封/soap:正文/发送文件响应/发送文件结果***是正确的。
我正在使用的SQL:
SELECT a.*
FROM XMLTABLE(
'$doc/soap:Envelope/soap:Body/SendFileResponse/SendFileResult' PASSING
XMLPARSE(DOCUMENT systools.HTTPPOSTCLOB('https://someurl.asmx?op=SendFile',
'<httpHeader>
<header name ="content-type" value ="text/xml"/>
</httpHeader>',
GET_CLOB_FROM_FILE('/folder/file1.txt')))
as "doc"
COLUMNS
Value VARCHAR(128) PATH '/soap:Envelope/soap:Body/SendFileResponse/SendFileResult') as a with all;
HTTPPOSTCLOB的响应是:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<SendFileResponse xmlns="http://e-customs.com/">
<SendFileResult>A file with the name file1.txt has already been uploaded.</SendFileResult>
</SendFileResponse>
</soap:Body>
</soap:Envelope>
包含xml的file.txt如下所示:
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<SendFile xmlns="http://test-url.com/">
<EM>
<Security>
<CompanyName>aaa</CompanyName>
<UserId>bbb</UserId>
<CompanyPassword>ccc</CompanyPassword>
<UserPassword>ddd</UserPassword>
</Security>
<Action>atNew</Action>
<File>
<Filename>string</Filename>
<FileSize>12</FileSize>
<FileContent>some content</FileContent>
<FileType>ftCDS2Level</FileType>
<ExtraInfo1>string</ExtraInfo1>
<ExtraInfo2>string</ExtraInfo2>
<ExtraInfo3>string</ExtraInfo3>
<ExtraInfo4>string</ExtraInfo4>
<ExtSysId>string</ExtSysId>
</File>
</EM>
</SendFile>
</soap12:Body>
</soap12:Envelope>
1条答案
按热度按时间798qvoo81#
我能够通过在SELECT中添加其余的命名空间来解决这个问题...
现在它返回我需要的东西。