2013-03-12 85 views
1

我们的应用程序托管在websphere中,我的webservice客户端(jax-ws)正在对远程服务器进行webservice调用。我将需要定义此web服务调用的超时。我尝试了不同的方式来设置超时没有运气。这里是我的尝试:他们的如何在websphere中定义webservice客户端的超时

Map<String, Object> requestContext = ((BindingProvider) binding).getRequestContext(); 
    requestContext.put("com.ibm.websphere.webservices.jaxws.asynctimeout", 15000); 

Map<String, Object> requestContext = ((BindingProvider) binding).getRequestContext(); 
    requestContext.put(BindingProviderProperties.REQUEST_TIMEOUT, 15000); 
    requestContext.put(BindingProviderProperties.CONNECT_TIMEOUT, 15000); 

无工作

任何人能给出暗示,如何设置超时Web服务客户端在WebSphere?

THX

回答

0

因为JAX-WS在WAS依赖于轴2我相信你可以使用标准的2轴的方法来做到这一点,尝试(从轴2个文档):

超时配置

传输级别存在两个超时实例,即套接字超时和连接超时。这些可以在部署或运行​​时进行配置。如果在部署时进行配置,用户必须在axis2.xml中添加以下行。

对于套接字超时: 如果您想了解更多信息,检查......

Options options = new Options(); 
options.setProperty(HTTPConstants.SO_TIMEOUT, new Integer(timeOutInMilliSeconds)); 
options.setProperty(HTTPConstants.CONNECTION_TIMEOUT, new Integer(timeOutInMilliSeconds)); 

// or 
options.setTimeOutInMilliSeconds(timeOutInMilliSeconds); 
... 

<parameter name="SO_TIMEOUT">some_integer_value</parameter> 
For Connection timeout: 

<parameter name="CONNECTION_TIMEOUT">some_integer_value</parameter> 

对于运行时配置,它可以在客户端存根内设置如下http://axis.apache.org/axis2/java/core/docs/http-transport.html

另外:

http://wso2.org/library/209

http://singztechmusings.wordpress.com/2011/05/07/how-to-configure-timeout-duration-at-client-side-for-axis2-web-services/

如果您使用ServiceClient检查此线程请:Axis2 ServiceClient options ignore timeout

请让我知道它的工作;)

+1

我们使用ServiceClient方式而不是存根方式来调用远程服务。我不知道是否有办法从PortType获取存根。 – user273098 2013-03-12 18:10:40

+0

我已经更新了我的答案,以指向另一个StackOverflow线程中的解决方案。希望能帮助到你。 – 2013-03-13 01:52:26

+0

感谢您的回复,我以为我有serviceClient,但是当我回到我生成的websphere代码,我所拥有的是:类扩展javax.xml.ws.Service和porttype,我想不出如何设置选项两个中的任何一个。 – user273098 2013-03-13 15:29:16

相关问题