0
votes

I need to configure a SOAP WebService client with certain timeout values for connection attempts and service invocations.

The WS client is a jar dependency generated using the WSDL with Maven cxf-codegen-plugin. I use this client jar in my web app as a maven dependency and invoke the service operations.

So my webapp pom contains:

<dependency>
    <groupId>my.web.service</groupId>
    <artifactId>web-service-client-jar</artifactId>
    <version>x.x.x</version>
</dependency>

along with the Apache CXF dependencies:

<!-- CXF dependencies -->
<dependency>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-rt-frontend-jaxws</artifactId>
    <version>${cxf.version}</version>
</dependency>
<dependency>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-rt-transports-http</artifactId>
    <version>${cxf.version}</version>
</dependency>

And I have defined below spring configuration to setup timeouts which does not work..

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd">

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

<cxf:bus>
    <cxf:outInterceptors>
        <ref bean="fileuploadlogOutbound" />
    </cxf:outInterceptors>
</cxf:bus>

<!-- Outbound Message Logging -->
<bean id="fileuploadlogOutbound" class="test.logging.MyLoggingOutInterceptor">
    <property name="prettyLogging" value="true" />
</bean>

But to my confusion, the outInterceptors defined for pretty logging works fine. Hence, I doubt if my configuration has any errors or not. FYI I'm trying to get this working in WebSphere 8.5 environment.

This is how I instantiate the WS Client in spring:

<jaxws:client id="documentUploadServiceJaxwsClient"
    serviceClass="org.tempuri.IDocumentUploadService" address="#serviceEndpointString" >

    <jaxws:binding>
        <soap:soapBinding version="1.2" mtomEnabled="true" />
    </jaxws:binding>
</jaxws:client>

Is there any steps missing in Spring config or do I need to look into WebSphere 8.5 specific configuration which will enforce HTTP/SOAP connection & response timeouts?

1
For the record, cxf version is 2.7.7 and Spring is 3.2.7.Dinusha Kariyawasam

1 Answers

0
votes

I figured out that my CXF configuration mentioned above works fine but the WAS environment where the application deployed is actually overriding any config you define at the application level. Hence, I followed this link to copy and define custom HTTP Transport policy where you can set values for below timeouts.

Read timeout
Write timeout
Connection timeout