Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Incomplete
-
1.7.4
-
None
-
None
-
Java 8, Tomcat
Description
According to documentation https://axis.apache.org/axis2/java/core/docs/http-transport.html the timeouts can be defined:
For runtime configuration, it can be set as follows within the client stub: ... Options options = new Options(); options.setProperty(HTTPConstants.SO_TIMEOUT, new Integer(timeOutInMilliSeconds)); options.setProperty(HTTPConstants.CONNECTION_TIMEOUT, new Integer(timeOutInMilliSeconds)); // or options.setTimeOutInMilliSeconds(timeOutInMilliSeconds); ...
But instead, Axis ignores this property because: org.apache.axis2.transport.http.CommonsHTTPTransportSender#invoke has code
// set the property values only if they are not set by the user explicitly if (msgContext.getProperty(HTTPConstants.SO_TIMEOUT) == null) { msgContext.setProperty(HTTPConstants.SO_TIMEOUT, soTimeout); } if (msgContext.getProperty(HTTPConstants.CONNECTION_TIMEOUT) == null) { msgContext.setProperty(HTTPConstants.CONNECTION_TIMEOUT, connectionTimeout); }
where connectionTimeout and soTimeout are always non null.
At the same time org.apache.axis2.transport.http.impl.httpclient3.HTTPSenderImpl#setTimeouts tries to define these values if they are null with timeOutInMilliSeconds.
The problem is that org.apache.axis2.transport.http.CommonsHTTPTransportSender#invoke is higher in call hirarchy so the org.apache.axis2.transport.http.impl.httpclient3.HTTPSenderImpl#setTimeouts does not work as expected. The SO_TIMEOUT and CONNECTION_TIMEOUT parameters are always defined inside org.apache.axis2.transport.http.impl.httpclient3.HTTPSenderImpl#setTimeouts.
The workaround is to define timeouts in axis2.xml.