Java 播放 2.0.8 网络服务“服务器无法处理请求。根元素是 missing/invalid”

Java play 2.0.8 web service " server was unable to process request. root element is missing/invalid"

我正在使用此 代码 调用 Web 服务:

承诺结果=WS.url("https://example/InsightService/service.asmx") .setQueryParameter("username", "test") .post("content");

我得到这个作为回应:

"server was unable to process request. root element is invalid"

我试过这个 code:

承诺结果=WS.url("https://example/InsightService/service.asmx") .setQueryParameter("username", "test") .post("");

对于上面的代码,我得到的响应是:

server was unable to process request. root element is missing"

谁能帮我看看这是怎么回事?或者我错过了什么?

谢谢

能否提供更多信息??实际 URL 和您要发送的内容?我告诉你这个是因为错误似乎在你发送的 POST 的内容中。

例如,要检查您的代码是否正确,您可以尝试使用 google Maps REST API:

https://maps.googleapis.com/maps/api/directions/json?origin=Toronto&destination=Montreal

所以实际中的代码如下所示:

Promise result = WS.url("https://maps.googleapis.com/maps/api/directions/json")
.setQueryParameter("origin", "Toronto")
.setQueryParameter("destination", "Montreal").get();