向 Spring Boot 中的某个 URL 发送 SOAP 请求

问题描述 投票:0回答:1

我正在尝试从 Spring Boot 应用程序向 SOAP API 发送请求。我生成的请求对象以

<pricing>
等标签开头和结尾。但我不断收到来自 API 的错误,指出版本错误。我真的不知道如何以正确的格式正确生成完整的 XML 请求并发送它。我还应该注意,我已经有了我的 java 对象,但没有 api 的 wsdl。这可能吗。

java xml spring-boot soap
1个回答
0
投票

您的 SOAP 消息必须具有 XML 版本标记、信封和正文。像这样:

<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2003/05/soap-envelope/"
soap:encodingStyle="http://www.w3.org/2003/05/soap-encoding">
<soap:Body>
... here goes your XML message
</soap:Body>
</soap:Envelope>
© www.soinside.com 2019 - 2024. All rights reserved.