代码之家  ›  专栏  ›  技术社区  ›  Kaleb Brasee

如何在WebSphere7中以编程方式设置JAX-WS2.1JMS客户机超时?

  •  2
  • Kaleb Brasee  · 技术社区  · 15 年前

    我正在将一个JAX-RPC客户机和服务转换为JAX-WS,并试图找出如何以编程方式设置客户机超时。这将是一个在WebSphere7中运行的JAX-WS2.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分钟),然后超时。

    是否有人找到在WebSphere7中通过编程设置此超时值的方法?

    2 回复  |  直到 15 年前
        1
  •  1
  •   jspcal    15 年前

    你可能需要

    ((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);
    

    可能请求超时属性实际上可能是以毫秒为单位的,所以可能很低的值1稍后会以某种方式四舍五入为0(无限)。也许试试2000?

        2
  •  2
  •   Mike Prasad    14 年前

    见文章 http://www.websphere-world.com/modules.php?name=News&file=article&sid=2058 . 作者,这里详细介绍了在WebSphere中设置JAX-WS客户机超时的步骤。问候,迈克