2013-03-12 20 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