如果我有一些使用 SOAP 的 API,我如何知道这些方法是否需要 GET、POST 或其他?
此外,如果我对需要 POST 的 SOAP Web 服务使用 GET,会产生什么后果(甚至不确定它是否有效)?或者反之亦然?
谢谢,我仍在努力深入了解如何使用网络服务。我使用简单的 API 进行了一些工作,但在使用返回用于下载文件的 Web 服务时确实遇到了问题。再次感谢。
最佳答案
HTTP GET requests generally do not have a content part SOAP 消息如何传输到服务器。这就是使用 POST 的原因。
具体来自RFC 2616 Section 4.3 。强调我的。
A message-body MUST NOT be included in a request if the specification of the request method (section 5.1.1) does not allow sending an entity-body in requests. A server SHOULD read and forward a message-body on any request; if the request method does not include defined semantics for an entity-body, then the message-body SHOULD be ignored when handling the request.
编辑:
从 SOAP 1.2 开始,可以使用 HTTP GET 方法并获取 SOAP 响应。我建议阅读SOAP 1.2 primer Section 4.1了解哪些 HTTP 方法适用于哪些情况的详细信息。
关于java - 一般 SOAP Web 服务问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9203370/