2014-08-30 42 views
1

我創建使用由Spring配置CXF Web服務客戶端,如下圖所示:CXF超時工作不

<!-- HTTP Conduit --> 
<http-conf:conduit name="*.http-conduit"> 
    <http-conf:client ConnectionTimeout="30000" 
     ReceiveTimeout="30000" /> 
</http-conf:conduit> 

<!-- Client Proxies --> 
<jaxws:client name="wsClient" serviceName="..." 
    serviceClass="..." 
    address="..." wsdlLocation="..."> 
</jaxws:client> 

現在當服務已啓動,一切都工作正常,但問題是,當服務已關閉在HTTPConduit超時值被忽略了,我在1秒鐘後收到以下錯誤:

org.apache.cxf.interceptor.Fault: Could not send Message. 
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64) 
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263) 
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:570) 
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:479) 
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:382) 
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:335) 
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96) 
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:136) 

Caused by: java.net.ConnectException: Tried all: '1' addresses, but could not connect over HTTP to server: '192.168.80.55', port: '24004' 
at weblogic.net.http.HttpClient.openServer(HttpClient.java:333) 
at weblogic.net.http.HttpClient.openServer(HttpClient.java:425) 
at weblogic.net.http.HttpClient.New(HttpClient.java:252) 
at weblogic.net.http.HttpURLConnection.connect(HttpURLConnection.java:213) 
at weblogic.net.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:279) 
at org.apache.cxf.transport.http.HTTPCon2014-08-30 13:06:59 ERROR: javax.xml.ws.WebServiceException: Could not send Message. 

任何線索,爲什麼消費者不提出這個錯誤之前停留的超時時間?

回答

1

當服務器「關閉」時,超時不適用。

ConnectionTimeout是連接前需要等待多少。

ReceiveTimeout在收到回覆前需要等待多少時間。

在你的情況下,沒有服務器在該端口上偵聽,所以當你的客戶端嘗試連接時,客戶端立即失敗立即

0

'down'是什麼意思?服務響應404?關閉的端口(連接被拒絕)?主機關閉(由於超時而無法連接)?

+0

服務關閉,我的意思是主機關閉或服務未在該端口上運行。 – 2014-08-30 11:27:30