gpt4 book ai didi

java - 如何在 WebSphere 7 中以编程方式设置 JAX-WS 2.1 JMS 客户端超时?

转载 作者:行者123 更新时间:2023-12-04 06:59:47 27 4
gpt4 key购买 nike

我正在将 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 中以编程方式设置此超时值的方法?

最佳答案

你可能需要

((BindingProvider)policyFinder).getRequestContext().put(
com.ibm.wsspi.webservices.Constants.CONNECTION_TIMEOUT_PROPERTY, 2000);

它可能会在写之前这样做......可能

也许这也是?
reqCtx.put(JAXWSProperties.CONNECT_TIMEOUT, 10); 
reqCtx.put(BindingProviderProperties.REQUEST_TIMEOUT, 10);

可能 REQUEST_TIMEOUT_PROPERTY 实际上可能以毫秒为单位,所以也许 1 的低 val 稍后会以某种方式四舍五入到 0(无限)......也许尝试 2000?

关于java - 如何在 WebSphere 7 中以编程方式设置 JAX-WS 2.1 JMS 客户端超时?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2060112/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com