Altering the timeout setting of an Axis 1.4 generated SOAP Java client

Jens picture Jens · Mar 16, 2012 · Viewed 13.5k times · Source

I have a problem with changing the standard options used by an Axis 1.4 generated web service client code. We consume a certain web service of a partner who is using the old RPC/Encoded style, which basically means we're not able to go for Axis 2 but are limited to Axis 1.4.

The service client is retrieving data from the remote server through our proxy which actually runs quite nicely.

Our application is deployed as a servlet. The retrieved response of the foreign web service is inserted into a (XML) document we provide to our internal systems/CMS. But if the external service is not responding - which didn't happen yet but might happen at anytime - we want to degrade nicely and return our produced XML document without the calculated web service information within a resonable time. The data retrieved is optional (if this specific calculation is missing it isn't a big issue at all).

So I tried to change the timeout settings. I did apply/use all methods and keys I could find in the documentation of axis to alter the connection and socket timeouts by searching the web. None of these seems to influence the connection timeouts.

Can anyone give me advice how to alter the settings for an axis stub/service/port based on version 1.4?

Here's an example for the several configurations I tried:

MyService service = new MyServiceLocator();
MyServicePort port = null;

try {
    port = service.getMyServicePort();
    javax.xml.rpc.Stub stub = (javax.xml.rpc.Stub) port;
    stub._setProperty("axis.connection.timeout", 10);
    stub._setProperty(org.apache.axis.client.Call.CONNECTION_TIMEOUT_PROPERTY, 10);
    stub._setProperty(org.apache.axis.components.net.DefaultCommonsHTTPClientProperties.CONNECTION_DEFAULT_CONNECTION_TIMEOUT_KEY, 10);
    stub._setProperty(org.apache.axis.components.net.DefaultCommonsHTTPClientProperties.CONNECTION_DEFAULT_SO_TIMEOUT_KEY, 10);

    AxisProperties.setProperty("axis.connection.timeout", "10");
    AxisProperties.setProperty(org.apache.axis.client.Call.CONNECTION_TIMEOUT_PROPERTY, "10");
    AxisProperties.setProperty(org.apache.axis.components.net.DefaultCommonsHTTPClientProperties.CONNECTION_DEFAULT_CONNECTION_TIMEOUT_KEY, "10");
    AxisProperties.setProperty(org.apache.axis.components.net.DefaultCommonsHTTPClientProperties.CONNECTION_DEFAULT_SO_TIMEOUT_KEY, "10");

    logger.error(AxisProperties.getProperties());

    service = new MyClimateServiceLocator();
    port = service.getMyServicePort();
}

I assigned the property changes before the generation of the service and after, I set the properties during initialisation, I tried several other timeout keys I found, ... I think I'm getting mad about that and start to forget what I tried already!

What am I doing wrong? I mean there must be an option, mustn't it?

If I don't find a proper solution I thought about setting up a synchronized thread with a timeout within our code which actually feels quite awkward and somehow silly. Can you imagine anything else?

Thanks in advance

Jens


axis1.4 java client soap wsdl2java rpc/encoded xml servlet generated alter change setup stub timeout connection socket keys methods