I'm writing an app that connect to an https web service many times using ksoap2 and the data usage of the app is high. I think it's high because I'm doing the connection every time i invoke the WS.
There is a way to use the same connection for my application like a singleton or sharing the HttpTransportSE object?
An example of my code:
public boolean Call1_Example(String Param1, String Param2)
{
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME24);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
request.addProperty("Param1", Param1);
request.addProperty("Param2", Param2);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
Boolean resultado = false;
Object response;
try {
androidHttpTransport.call(Method1_SOAP_ACTION,
envelope);
response = envelope.getResponse();
resultado = Boolean.parseBoolean(response.toString());
} catch (Exception e) {
resultado = false;
}
return resultado;
}