SOAP Fault 的详细信息元素内的结束信封标记是否有效?
Is an ending Envelope tag inside the detail element of a SOAP Fault valid?
我们正在将一个应用程序从 Oracle Weblogic Portal 10.3.6 迁移到 Jetty。在此过程中,jaxws-rt 已升级到版本 2.2.8。以前我们使用的是嵌入了 Weblogic 的版本,我认为它基于版本 2.1.6 或 2.1.7。
我们现在 运行 遇到的问题是当 JAX-WS 尝试解析来自我们正在使用的服务总线的一些 SOAP 故障时的 NullPointerExceptions。解析失败的原因是 SOAP Fault 包含包裹在错误详细信息元素中的整个原始响应消息,使 SOAP 消息带有两个信封标记。当解析器到达第一个 soap:envelope 的末尾并尝试获取父节点时,它只是 returns null。它 returns 为空,因为检查了 'parentNode instanceof SOAPDocument',并且 returns 为真,即使 parentNode 是请求元素。
根据 http://schemas.xmlsoap.org/soap/envelope/ 的定义,detail 元素可以包含任何内容。
尽管它说 detail 元素可以包含任何内容,但是否有一个信封包裹在另一个有效的 SOAP 信封中,或者 jaxws-rt 实现是否有误?
这是无法解析的 SOAP 错误示例:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soap:Body xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Fault>
<faultcode>soapenv:Server</faultcode>
<faultstring>BEA-380001: Internal Server Error</faultstring>
<faultactor>dummy-code</faultactor>
<detail>
<mock>
<request>
<soap:Envelope>
<S:Header xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
</S:Header>
<S:Body xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
</S:Body>
</soap:Envelope>
</request>
<response>
<ns4:responseState xmlns:ns2="urn:srv.sag.enterprise.fs.edb.com:domain:element:v13_1" xmlns:ns4="urn:enterprise.fs.edb.com:domain:common:v1" xmlns:ns3="urn:srv.sag.enterprise.fs.edb.com:ws:element:v13_1" xmlns:ns9="urn:srv.agr.enterprise.fs.edb.com:domain:engagement:v14:2" xmlns:ns5="urn:srv.agr.enterprise.fs.edb.com:domain:engagement:v14:3" xmlns:ns6="urn:srv.agr.enterprise.fs.edb.com:domain:alertcodes:v1" xmlns:ns7="urn:srv.agr.enterprise.fs.edb.com:ws:engagement:v14_3" xmlns:ns8="urn:corews.enterprise.fs.edb.com:domain:common:v1">
<wsc:ErrorCode xmlns:wsc="http://mock.url/">68</wsc:ErrorCode>
<wsc:Severity xmlns:wsc="http://mock.url">2</wsc:Severity>
<wsc:ComponentId xmlns:wsc="http://mock.url">852</wsc:ComponentId>
<wsc:StrErrorCode xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsc="http://mock.url"/>
<wsc:Message xmlns:wsc="http://mock.url">Test message</wsc:Message>
<wsc:NativeError xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsc="http://mock.url"/>
<wsc:LogSequence xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsc="http://mock.url"/>
<wsc:errorItem key="LogRef" value="1425988364991" xmlns:wsc="http://mock.url"/>
</ns4:responseState>
</response>
</mock>
</detail>
</soap:Fault>
</soap:Body>
</soapenv:Envelope>
感谢您的帮助!
我不认为问题出在嵌套的 Body 上。这根本不是 <Fault>
- 它是一个响应主体。您只能有 <Body>
或 <Fault>
,不能同时有,或者在这种情况下,<Body>
中的 <Fault>
使它成为一个可能不是 non-fault 的 SOAP 响应模式符合 WSDL 的成功 (non-fault) 响应。
把 <Fault>
作为 <Envelope>
的 child <Header>
and/or 的兄弟姐妹,你应该会好得多,schema-wise。
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soap:Body xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Fault> <!-- This is the problem - Fault is nested below Body -->
<faultcode>soapenv:Server</faultcode>
我们正在将一个应用程序从 Oracle Weblogic Portal 10.3.6 迁移到 Jetty。在此过程中,jaxws-rt 已升级到版本 2.2.8。以前我们使用的是嵌入了 Weblogic 的版本,我认为它基于版本 2.1.6 或 2.1.7。
我们现在 运行 遇到的问题是当 JAX-WS 尝试解析来自我们正在使用的服务总线的一些 SOAP 故障时的 NullPointerExceptions。解析失败的原因是 SOAP Fault 包含包裹在错误详细信息元素中的整个原始响应消息,使 SOAP 消息带有两个信封标记。当解析器到达第一个 soap:envelope 的末尾并尝试获取父节点时,它只是 returns null。它 returns 为空,因为检查了 'parentNode instanceof SOAPDocument',并且 returns 为真,即使 parentNode 是请求元素。
根据 http://schemas.xmlsoap.org/soap/envelope/ 的定义,detail 元素可以包含任何内容。
尽管它说 detail 元素可以包含任何内容,但是否有一个信封包裹在另一个有效的 SOAP 信封中,或者 jaxws-rt 实现是否有误?
这是无法解析的 SOAP 错误示例:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soap:Body xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Fault>
<faultcode>soapenv:Server</faultcode>
<faultstring>BEA-380001: Internal Server Error</faultstring>
<faultactor>dummy-code</faultactor>
<detail>
<mock>
<request>
<soap:Envelope>
<S:Header xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
</S:Header>
<S:Body xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
</S:Body>
</soap:Envelope>
</request>
<response>
<ns4:responseState xmlns:ns2="urn:srv.sag.enterprise.fs.edb.com:domain:element:v13_1" xmlns:ns4="urn:enterprise.fs.edb.com:domain:common:v1" xmlns:ns3="urn:srv.sag.enterprise.fs.edb.com:ws:element:v13_1" xmlns:ns9="urn:srv.agr.enterprise.fs.edb.com:domain:engagement:v14:2" xmlns:ns5="urn:srv.agr.enterprise.fs.edb.com:domain:engagement:v14:3" xmlns:ns6="urn:srv.agr.enterprise.fs.edb.com:domain:alertcodes:v1" xmlns:ns7="urn:srv.agr.enterprise.fs.edb.com:ws:engagement:v14_3" xmlns:ns8="urn:corews.enterprise.fs.edb.com:domain:common:v1">
<wsc:ErrorCode xmlns:wsc="http://mock.url/">68</wsc:ErrorCode>
<wsc:Severity xmlns:wsc="http://mock.url">2</wsc:Severity>
<wsc:ComponentId xmlns:wsc="http://mock.url">852</wsc:ComponentId>
<wsc:StrErrorCode xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsc="http://mock.url"/>
<wsc:Message xmlns:wsc="http://mock.url">Test message</wsc:Message>
<wsc:NativeError xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsc="http://mock.url"/>
<wsc:LogSequence xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsc="http://mock.url"/>
<wsc:errorItem key="LogRef" value="1425988364991" xmlns:wsc="http://mock.url"/>
</ns4:responseState>
</response>
</mock>
</detail>
</soap:Fault>
</soap:Body>
</soapenv:Envelope>
感谢您的帮助!
我不认为问题出在嵌套的 Body 上。这根本不是 <Fault>
- 它是一个响应主体。您只能有 <Body>
或 <Fault>
,不能同时有,或者在这种情况下,<Body>
中的 <Fault>
使它成为一个可能不是 non-fault 的 SOAP 响应模式符合 WSDL 的成功 (non-fault) 响应。
把 <Fault>
作为 <Envelope>
的 child <Header>
and/or 的兄弟姐妹,你应该会好得多,schema-wise。
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soap:Body xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Fault> <!-- This is the problem - Fault is nested below Body -->
<faultcode>soapenv:Server</faultcode>