javaweb-servicestimeoutcxfjax-ws

How to increase Apache CXF timeout using XML configuration and JaxWsProxyFactoryBean?


I am using apache CXF implementation of JAX-WS. My web service is configured via spring xml configuration using JaxWsProxyFactoryBean:

<bean id="myWSClient" class="my.package.MyWSClient"
      factory-bean="clientFactory" 
      factory-method="create" />

<bean id="clientFactory" class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
    <property name="serviceClass" value="my.package.MyWSClient"/>
    <property name="address" value="http://some.url"/>
</bean>

and later I am injecting it via:

@Resource(name = "myWSClient")
MyWSClient myWSClient;

How I can manage to increase timeout for MyWSClient?


Solution

  • To configure client timeouts using spring configuration use this:

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

    In this example timeout for response and connection is setup for 600 seconds.

    Reference: