Export to GitHub

ksoap2-android - issue #132

Connection keep-alive or close


Posted on Sep 10, 2012 by Grumpy Hippo

Why use in HttpTransportSE.java the property conection-closed? In android 4.0 this cause a issue over 3g that close the socket, but if use conection keep-alive this works fine.

Comment #1

Posted on Sep 13, 2012 by Swift Hippo

Try using KeepAliveHttpsTransportSE .. the default class needs to close the connection since it does otherwise not work with older android versions..

Comment #2

Posted on Sep 13, 2012 by Grumpy Hippo

I use with android 2.3 and android 2.2 and with connection open works fine.

Comment #3

Posted on Oct 16, 2012 by Grumpy Hippo

Hi ,

I think that the KeepAliveHttpsTransportSE it is not well implemented. Currently is setting the connection header when you call to the method getServiceConnection

serviceConnection.setRequestProperty("Connection", "keep-alive");

But as this calls is extending from HttpsTransportSE, when you call the method call, it will override your header:

    ServiceConnection connection = getServiceConnection();

    connection.setRequestProperty("User-Agent", USER_AGENT);
    // SOAPAction is not a valid header for VER12 so do not add
    // it
    // @see "http://code.google.com/p/ksoap2-android/issues/detail?id=67
    if (envelope.version != SoapSerializationEnvelope.VER12) {
        connection.setRequestProperty("SOAPAction", soapAction);
    }

    if (envelope.version == SoapSerializationEnvelope.VER12) {
        connection.setRequestProperty("Content-Type", CONTENT_TYPE_SOAP_XML_CHARSET_UTF_8);
    } else {
        connection.setRequestProperty("Content-Type", CONTENT_TYPE_XML_CHARSET_UTF_8);
    }

    connection.setRequestProperty("Connection", "close");
    connection.setRequestProperty("Accept-Encoding", "gzip");

The way to achieve the change on the header is by actually calling the method call, passing as parameter the list of header including the one for Connection.

Actually i am working on a pull request with some changes to improve the performance and memory usage (specially during creation of dump info for debug)

Comment #4

Posted on Oct 17, 2012 by Swift Hippo

Sounds great. I am looking forward to your enhancements.

Comment #5

Posted on Nov 7, 2012 by Swift Hippo

Fixed in 3.0.0-RC.3

Comment #6

Posted on Nov 7, 2012 by Swift Hippo

(No comment was entered for this change.)

Status: Fixed

Labels:
Type-Defect Priority-Medium