【问题标题】:Rest full web service executed twice for one call in java在java中为一次调用执行两次Restful Web服务
【发布时间】:2016-08-25 09:05:22
【问题描述】:

我正在使用 Jersey 客户端 API 1.19 调用 Restful Web 服务调用。就像在客户端一样,我已经调用了一次 Web 服务,但被调用的 Web 服务又执行了两次。

在客户端调用或从服务端发送时是否需要设置任何属性

如果没有,还有其他方法可以跟踪问题

正如我经历过 WCF method called twice 但它没有帮助我

我的代码如下

 Client client = Client.create();

    WebResource webResource = client.resource(baseuri);
           webResource.method(POST);
    ClientResponse response = webResource.accept("application/xml")
            .type("application/xml").post(ClientResponse.class);

【问题讨论】:

    标签: web-services rest java-6 jersey-client


    【解决方案1】:

    这里我得到了两个响应

    因为我用过
    webResource.method("POST");

    即当我设置方法 webResource 时,服务被 webResource 调用,甚至被 clientResponse 调用。

    最终我得到了两个响应,所以在删除上面的代码之后,服务只为 clientResponse 调用而不是 webResponse 调用

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-04-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多