Siva Sankar
Siva Sankar

Reputation: 23

Camel CXF: Soap client timeout

I am using Camel CXF endpoint to connect to my soap server. I wanted to add timeout for my request from client. I am using continuationTimeout option for that. But it's not working. The request is timeout without waiting for the time that I've configured.

Below is my endpoint configuration.

<camel-cxf:cxfEndpoint id="tmAPIWSEndpoint" address="http://IN2NPDCEDB01:8088/webservices/services/TransportationManager"
            wsdlURL="/wsdl/TransportationManager.wsdl"
            endpointName="cis:TransportationManagerPort"
            serviceName="cis:TransportationManagerService"
            xmlns:cis="http://www.i2.com/cis"
            continuationTimeout="60000">
        <camel-cxf:properties>
            <entry key="dataFormat" value="MESSAGE"/>
            <entry key="username" value="XXX"/>
            <entry key="password" value="XXX"/>
        </camel-cxf:properties>
    </camel-cxf:cxfEndpoint>

Upvotes: 2

Views: 8926

Answers (2)

Namphibian
Namphibian

Reputation: 12211

Your question is not very clear since there is no camel route so I cant see if you are creating a SOAP service inside Camel or you are calling a SOAP service from Camel as the client. Based on the little bit information you sent it seems you are creating a client.

According to the camel CXF documentation

  • continuationTimeout: This option is used to set the CXF continuation timeout which could be used in CxfConsumer by default when the CXF server is using Jetty or Servlet transport. (Before Camel 2.14.0, CxfConsumer just set the continuation timeout to be 0, which means the continuation suspend operation never timeout.)

Notice that this is related to CXF server settings not client settings. You are using this property but I dont think this is what you are looking for.

If you reference the Apache CXF Client Settings Documentation page you will find the following notes there:

  • ConnectionTimeout: Specifies the amount of time, in milliseconds, that the client will attempt to establish a connection before it times out. The default is 30000 (30 seconds). 0 specifies that the client will continue to attempt to open a connection indefinitely.
  • ReceiveTimeout: Specifies the amount of time, in milliseconds, that the client will wait for a response before it times out. The default is 60000. 0 specifies that the client will wait indefinitely.

If you visit the CXF documentation page there is a lot examples there.

Upvotes: 4

user3399000
user3399000

Reputation: 387

Here is how to do it programmatically:

HelloWorld hello = (HelloWorld) context.getBean("helloService");
org.apache.cxf.endpoint.Client client = ClientProxy.getClient(hello);
HTTPConduit httpConduit = (HTTPConduit) client.getConduit();
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setConnectionTimeout(5000);
httpClientPolicy.setAllowChunking(false);
httpClientPolicy.setReceiveTimeout(5000);
httpConduit.setClient(httpClientPolicy);
System.out.println(hello.getHelloWorldAsString("Everyone"));

(I am using spirng)

<bean id="helloService"
    class="soap.timeout.demo.client.jaxws.HelloWorld"
    factory-bean="helloServiceFactory" factory-method="create"/>
<bean id="helloServiceFactory"
    class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
    <property name="serviceClass" value="soap.timeout.demo.client.jaxws.HelloWorld"/>
    <property name="address" value="http://localhost:9999/ws/hello"/>
</bean>

Upvotes: 1

Related Questions