lishuyuan / ksoap2-android

Automatically exported from code.google.com/p/ksoap2-android
1 stars 4 forks source link

Connection keep-alive or close #132

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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.

Original issue reported on code.google.com by rbrlnx on 10 Sep 2012 at 7:14

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

Original comment by mosa...@gmail.com on 13 Sep 2012 at 5:20

GoogleCodeExporter commented 9 years ago
I use with android 2.3 and android 2.2 and with connection open works fine.

Original comment by rbrlnx on 13 Sep 2012 at 12:01

GoogleCodeExporter commented 9 years ago
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)

Original comment by jose.cas...@gmail.com on 16 Oct 2012 at 10:17

GoogleCodeExporter commented 9 years ago
Sounds great. I am looking forward to your enhancements.

Original comment by mosa...@gmail.com on 17 Oct 2012 at 2:23

GoogleCodeExporter commented 9 years ago
Fixed in 3.0.0-RC.3

Original comment by mosa...@gmail.com on 7 Nov 2012 at 1:02

GoogleCodeExporter commented 9 years ago

Original comment by mosa...@gmail.com on 7 Nov 2012 at 1:02