【发布时间】:2021-04-02 07:30:05
【问题描述】:
我升级了一个旧应用程序,该应用程序公开了 6 个具有不同名称空间的不同 SOAP Web 服务。当我们使用通过其生成的 wsdl 获取的端点时,一切似乎都正常工作。
这是一个示例请求
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:pres="http://MY_NAMESPACE.com">
<soapenv:Body>
<pres:UpdateXXXRequest>
</pres:UpdateXXXRequest>
</soapenv:Body>
<soapenv:Envelope>
但是有一些客户端以以下格式发送请求
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:pres="http://MY_NAMESPACE.com">
<soapenv:Body>
<q0:UpdateXXXRequest xmlns:q0="http://schemas.xmlsoap.org/soap/envelope/">
</q0:UpdateXXXRequest>
</soapenv:Body>
<soapenv:Envelope
此请求导致错误 No Endpoint Found 由于名称空间 xmlns:q0="http://schemas.xmlsoap.org/soap/envelope/" 使用有效载荷 UpdateXXXRequest。
根据我的分析,Spring 框架使用 EndpointMapping 来识别相应的方法,然后根据命名空间调用服务(使用主体负载 q0:UpdateXXXRequest xmlns:q0 ="http://schemas.xmlsoap.org/soap/envelope/" 或来自soapenv:Envelop)
在 {http://schemas.xmlsoap.org/soap/envelope/}UpdateRxFillRequest 的情况下,它失败了,因为方法是用自己的命名空间定义的,而 spring 只查找用方法定义的命名空间通过@Payload注解。
如果它从 UpdateXXXRequest 中删除 q0 或使用实际的命名空间,它工作正常,但客户端发送请求时使用 http://schemas.xmlsoap.org/soap/envelope/
每种方法支持 http://schemas.xmlsoap.org/soap/envelope/ 和 http://MY_NAMESPACE.com 的方式是什么。
虽然我有 100 多个端点。
【问题讨论】:
标签: java spring-boot soap spring-ws