I'm doing a http call with kSoap within a TimerTask so I can update the data something like every five minutes. After getting the data from a web service I provide them to an interface via the function procecssData(). This works out perfectly for the first time, but although the timer is firing every time the data stays the same. So in fact, my UI is being drawn every five minutes but it always uses the data from the first http call. Does someone have an idea why this might happen? Seems to me that the variables inside the httpCall() function are not being updated.
public class ConnectionThread extends Thread {
SoapObject request;
SoapObject result;
SoapSerializationEnvelope envelope;
String[][] resultArray;
int resultLength;
public ConnectionThread(ConnectionCallback conCallback) {
callbackObj = conCallback;
refreshTask = new TimerTask() {
public void run() {
httpCall();
}
};
new Timer().schedule(refreshTask, 0, 50000);
}
public void httpCall() {
request = new SoapObject(serviceNamespace, methodName);
result = null;
envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
http = new HttpTransport(serviceUrl);
try {
http.call(soapAction, envelope);
result = (SoapObject) envelope.getResponse();
resultLength = result.getPropertyCount();
} catch (final InterruptedIOException ex) {
Dialog.alert("No Internet Connection!");
_isConnected = false;
}
// some other catch blocks
finally {
http.reset();
}
resultArray = new String[resultLength][resultLength * 8];
// put result into own Stringarray
if (_isConnected) {
callbackObj.processData(resultArray, resultLength);
}
}
}
Any help would be soo appreciated! :) Cheers, Musipoo