如何在 WebSphere 7 中以编程方式设置 JAX-WS 2.1 JMS 客户端超时?
我正在将 JAX-RPC 客户端和服务转换为 JAX-WS,并尝试找出如何以编程方式设置客户端超时。这将是在 WebSphere 7 中运行的 JAX-WS 2.1 客户端。在 JAX-RPC 中,我可以在 SOAPBindingStub 上设置一个属性来设置超时。
在 JAX-WS 代码中,我尝试设置几个属性,如下所示,但没有成功:
PolicyFinderService policyFinderService = new PolicyFinderService();
PolicyFinder policyFinder = policyFinderService.getPolicyFinderSOAPPort();
((BindingProvider)policyFinder).getRequestContext().put(com.ibm.wsspi.websvcs.Constants.REQUEST_TIMEOUT_PROPERTY, 1);
((BindingProvider)policyFinder).getRequestContext().put(com.ibm.wsspi.websvcs.Constants.WRITE_TIMEOUT_PROPERTY, 1);
((BindingProvider)policyFinder).getRequestContext().put(com.ibm.wsspi.webservices.Constants.READ_TIMEOUT_PROPERTY, 1);
((BindingProvider)policyFinder).getRequestContext().put(com.ibm.wsspi.webservices.Constants.RESPONSE_TIMEOUT_PROPERTY, 1);
((BindingProvider)policyFinder).getRequestContext().put(com.ibm.wsspi.webservices.Constants.WRITE_TIMEOUT_PROPERTY, 1);
当我拨打电话并且服务未运行时,这些属性都没有任何效果,它只是挂起默认超时值(我超时前思考 5 分钟)。
有人找到了在 WebSphere 7 中以编程方式设置此超时值的方法吗?
I'm converting a JAX-RPC client and service to JAX-WS, and am trying to figure out how to set the client timeout programmatically. This will be a JAX-WS 2.1 client running in WebSphere 7. In JAX-RPC, there was a property I could set on the SOAPBindingStub to set the timeout.
In the JAX-WS code, I've tried setting several properties as follows, with no luck:
PolicyFinderService policyFinderService = new PolicyFinderService();
PolicyFinder policyFinder = policyFinderService.getPolicyFinderSOAPPort();
((BindingProvider)policyFinder).getRequestContext().put(com.ibm.wsspi.websvcs.Constants.REQUEST_TIMEOUT_PROPERTY, 1);
((BindingProvider)policyFinder).getRequestContext().put(com.ibm.wsspi.websvcs.Constants.WRITE_TIMEOUT_PROPERTY, 1);
((BindingProvider)policyFinder).getRequestContext().put(com.ibm.wsspi.webservices.Constants.READ_TIMEOUT_PROPERTY, 1);
((BindingProvider)policyFinder).getRequestContext().put(com.ibm.wsspi.webservices.Constants.RESPONSE_TIMEOUT_PROPERTY, 1);
((BindingProvider)policyFinder).getRequestContext().put(com.ibm.wsspi.webservices.Constants.WRITE_TIMEOUT_PROPERTY, 1);
None of these have any effect when I make a call and the service isn't running, it just hangs for the default timeout value (I think 5 minutes) before timing out.
Has anyone found a way to programatically set this timeout value in WebSphere 7?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
请参阅文章 http://www.websphere- world.com/modules.php?name=News&file=article&sid=2058。
作者,这里详细介绍了在WebSphere 中为JAX-WS 客户端设置超时的步骤。问候,迈克
See article at http://www.websphere-world.com/modules.php?name=News&file=article&sid=2058.
Author, here details steps to set timeout for JAX-WS client in WebSphere. Regards, Mike
您可能需要
在写入之前执行此操作...可能
也是如此?
可能 REQUEST_TIMEOUT_PROPERTY 实际上可能以毫秒为单位,所以也许 1 的低值稍后会以某种方式四舍五入到 0(无限)...也许尝试 2000?
its possible you might need to
it might do that before the write...possibly
perhaps this also?
possibly REQUEST_TIMEOUT_PROPERTY may actually be in milliseconds, so maybe a low val of 1 gets rounded somehow to 0 (infinite) later on... maybe try 2000?