Open jpock76 opened 5 years ago
wanna send a PR to improve this?
I would, but I am new on Github and not sure I am doing this right. The strange thing is when I compare my downloaded version, 3.6.4 in Android Studio, the Transport.java does not match the copy in ksoap2-android/ksoap2-base/src/main/java/org/ksoap2/transport/transport.java. I expected them to be the same, comparing latest to latest. Am I wrong? I also and completely unfamiliar with Maven.
Sent a small PR which should fix this
A workaround is: httpTransport.setReadTimeout(timeout);
There are other programming errors around here as well. For example, HttpsTransportSE
(Notice the s
in Https
) passes readTimeout
value into contentLength
parameter for the (String, int, String, int, int)
-constructor which moves on to doing nothing at all with it in the base class; connection timeout gets set but not read timeout:
https://github.com/simpligility/ksoap2-android/blob/0d2b179da0e243c3047eba10ece80d44adde56e1/ksoap2-j2se/src/main/java/org/ksoap2/transport/HttpsTransportSE.java#L30-L31
https://github.com/simpligility/ksoap2-android/blob/0d2b179da0e243c3047eba10ece80d44adde56e1/ksoap2-j2se/src/main/java/org/ksoap2/transport/HttpTransportSE.java#L91-L93
timeOut is passed to HttpTransportSE.
HttpTransportSE httpTransport = new HttpTransportSE(url, timeOut);
HttpTransportSE accepts the input into this constructor: public HttpTransportSE(String url, int timeout) { super(url, timeout); }
super(url, timeout) - super is Transport.java. Looking into that, I find the constructor using only url, timeout.
It seems there is a relatively new implementation of "readtimeout" that is not getting set to the timeout passed. Every other constructor signature used will set this.readtimeout = the passed timeout. So it would seem that without this.readtimeout getting set, it will always use the default which is 20 seconds.
To get around this I just call HttpTransportSE httpTransport = new HttpTransportSE(null, url, timeOut); Passing "null" to the proxy parameter, which forces it to use the method which properly sets this.readtimeout to the passed value. Testing with this change, my web service calls were no longer timing out at 20 seconds, but at 60 like I asked it to.