2014-08-30 48 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