gandra404
gandra404

Reputation: 6071

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?

Upvotes: 1

Views: 5702

Answers (2)

Tomasz
Tomasz

Reputation: 1396

You can add property javax.xml.ws.client.receiveTimeout inside xml configuration. Value in millisecounds. 300000 millisecounds = 5 min

    <bean id="serviceServiceFactory" class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
    <property name="serviceClass" value="pl.service.YourService"/>
    <property name="address" value="http://address:port/ws/YourService"/>
    <property name="properties">
        <map>
            <entry key="javax.xml.ws.client.receiveTimeout"><value>300000</value></entry>
        </map>
    </property>
</bean>

Upvotes: 0

gandra404
gandra404

Reputation: 6071

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:

Upvotes: 1

Related Questions