【问题标题】:Setting timeout to consume web service in java implementation class在 java 实现类中设置超时以使用 Web 服务
【发布时间】:2014-06-18 18:13:08
【问题描述】:

我有一个 JAX-WS Web 服务客户端。我尝试像这样设置超时属性:

Map<String, Object> requestContext = bp.getRequestContext();
requestContext.put(BindingProviderProperties.REQUEST_TIMEOUT, 20);
//I also tried using 
//"javax.xml.ws.client.receiveTimeout" in the place of REQUEST_TIMEOUT 
//It behaved the same way.
requestContext.put(BindingProviderProperties.CONNECT_TIMEOUT, 10000); 

更多详情请看问题How do I set the timeout for a JAX-WS webservice client?

但是,我没有看到超时发生。它应该给出一个读取超时,因为我们触发的服务没有在 20 毫秒内提供响应。我们还尝试使 REQUEST_TIMEOUT 值为负,但它给出了相同的响应。由此我确认请求上下文中设置的值没有指定服务超时。

有谁知道为什么这个设置不起作用以及我应该怎么做?

【问题讨论】:

    标签: java web-services


    【解决方案1】:

    可以通过向服务 URL 添加“responseTimeout”参数来增加超时值。 例如:http://localhost.int.com/service/TestQuery.svc?responseTimeout=10000

    【讨论】:

      猜你喜欢
      • 2013-01-14
      • 2012-10-25
      • 2011-04-24
      • 2010-10-17
      • 2011-12-30
      • 1970-01-01
      • 2019-07-11
      • 1970-01-01
      • 2016-09-06
      相关资源
      最近更新 更多