带有 http URI 的 SOAP 命名空间

SOAP Namespace with http URI

在升级第 3 方 SOAP API 期间,供应商已将其响应更改为 return

<env:Envelope xmlns:env='https://schemas.xmlsoap.org/soap/envelope/'>...

而不是以前

<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>... 

注意从 http 到 https 的变化。

这是否有效?

背景:我们的 Java 客户端代码尝试通过调用 com.sun.xml.messaging.saaj.soap.MessageImpl.getSOAPBody().hasFault() (saaj-impl-1.3.jar) 检查 SOAPFault失败是因为 JavaEE 标准将 URI_NS_SOAP_ENVELOPE 指定为 http URI。当 API 的 https 响应是 returned 时,URI 不匹配并且

Jan 16, 2017 3:47:05 PM com.sun.xml.messaging.saaj.soap.SOAPPartImpl lookForEnvelope
SEVERE: SAAJ0513: Unable to create envelope from given source because the namespace was not recognized

已 return编辑。

作为解决方法,是否可以覆盖 SAAJ 库行为以强制使用 http SOAP URI?

谢谢。

根据 SOAP 1.1 specification:

The SOAP envelope has the namespace identifier "http://schemas.xmlsoap.org/soap/envelope/"

因此该消息不是有效的 SOAP 消息。由于 SAAJ 设计为遵循 SOAP 规范,因此它将无法处理该消息。