apache cxf could not send message and read time out

irumi picture irumi · Jan 31, 2013 · Viewed 66.7k times · Source

What might be the cause of:

org.apache.cxf.interceptor.Fault: Could not send Message.

Caused by: java.net.SocketTimeoutException: SocketTimeoutException invoking https://xxx.xxx.xxx.xxx:8443/services/test: Read timed out

It usually occurs after I send a soap request to the ws. I'm using apache cxf. I'm completely sure that the ws is up and running because before the time out occur the client will send 2 more request. The timeout happens in the third soap request.

Answer

Carlos Jaime C. De Leon picture Carlos Jaime C. De Leon · Sep 25, 2013

I have encountered this error as well for my webservice client. The solution that worked for me is to configure the http client in the CXF config file (cxf.xml).

As documented in Apache CXF document:

1.Add the http-conduit namespace and xsd:

<beans ...
       xmlns:http-conf="http://cxf.apache.org/transports/http/configuration
       ...
       xsi:schemaLocation="...
           http://cxf.apache.org/transports/http/configuration
           http://cxf.apache.org/schemas/configuration/http-conf.xsd
       ...">

2.Add the http-conduit tag/element and set the RecieveTimeout/ConnectionTimeout to 180000ms:

<http-conf:conduit name="*.http-conduit">
      <http-conf:client 
                      ConnectionTimeout="300000"
                      ReceiveTimeout="300000"/>       
</http-conf:conduit>