Search code examples
androidweb-serviceshttpksoap2

Close http connection after web service call, in Android


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.


Solution

  •         if(httpTransport!=null){
                httpTransport.reset();
                try {
                    httpTransport.getConnection().disconnect();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }