I saw similar questions but I didn't find an answer. I'm using ksoap2 library to connect with the webserver and sometimes I got that exception java.net.SocketTimeoutException: read timed out.
Here is my code:
SoapObject request = new SoapObject(NAMESPACE, method);
if (properties != null) {
for (PropertyInfo property : properties) {
request.addProperty(property);
}
}
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);;
HttpsTransportSE transport = new HttpsTransportSE(HOST, PORT, FILE, TIMEOUT);
transport.debug = true;
transport.setXmlVersionTag("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
try {
transport.call(NAMESPACE + "#" + soapAction, envelope);
Object res = (Object)envelope.getResponse();
return res;
} catch (Exception e) {
Log.e("WebService", e.toString());
return null;
}
Can I change somewhere the timeout for socket or what can I do?