On Feb 12, 7:26 am, Michael Rueger <[email protected]> wrote:
> answering to my own post, for whom it may concern.
> Turns out in the ksoap HttpTransportSE setup the innocent looking line
>
> connection.setRequestProperty("Connection", "close");
>
> seems to be the culprit. Removed it, now it seems to work.

Thanks for tracking this down Michael.  I have the same problem with
connecting to salesforce.com API.  It would fail on consecutive
"query" calls.  However, staying with "Connection: keep-alive" appears
to work.

So I have made a couple of wrapper classes thusly, so that I needn't
modify ksoap2:

public class SFDCAndroidHttpTransport extends AndroidHttpTransport {

        public SFDCAndroidHttpTransport(String url) {
                super(url);
        }

        @Override
        protected ServiceConnection getServiceConnection() throws IOException
{
                ServiceConnection connection = new
SFDCAndroidServiceConnection(super.url);
                connection.setRequestProperty("Connection", "keep-alive");
                return connection;
        }

}

public class SFDCAndroidServiceConnection extends
AndroidServiceConnection {

        public SFDCAndroidServiceConnection(String url) throws IOException {
                super(url);
        }

        @Override
        public void setRequestProperty(String string, String soapAction) {
                // We want to ignore any setting of "Connection: close" because
                // it is buggy with Android SSL.
                if ("Connection".equalsIgnoreCase(string) &&
                        "close".equalsIgnoreCase(soapAction)) {
                        return;
                }
                super.setRequestProperty(string, soapAction);
        }

}

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

To unsubscribe, reply using "remove me" as the subject.

Reply via email to