Reputation: 17429
How can I close connection opened by the following code:
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL)
androidHttpTransport.call(soap_action, envelope);
HttpTransportSE is a class defined in Ksoap2 library.
Upvotes: 1
Views: 2299
Reputation: 26
if(httpTransport!=null){
httpTransport.reset();
try {
httpTransport.getConnection().disconnect();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Upvotes: 1
Reputation: 16364
Cancel the AsyncTask inside which you are creating the connection as the cancelled AsyncTask will stop all the processes running inside it and hence your connection would get closed too.
mAsyncTask.cancel(true);
Upvotes: 0