Q: ksoap2 on Android XMLPullParserException: Unexpected Token when using 3g connection I'm using ksoap2 version 2.5.4 to send soap requests to a server from an android application based on cordova. This works great when using a wifi connection from our test device, but fails whenever a 3g connection is used instead.
The device tested on is a Nexus 7
I have searched far and wide for this problem but have yet to find a solution.
When using a wifi connection the response looks great, but whenever I switch to using 3g I get the following error:
 org.xmlpull.v1.XmlPullParserException: Unexpected token (position:TEXT jsoapenv:Env...@1:248 in java.io.InputStreamReader@4164ce20) 
    at org.kxml2.io.KXmlParser.next(KXmlParser.java:426)
    at org.kxml2.io.KXmlParser.next(KXmlParser.java:310)
    at org.kxml2.io.KXmlParser.nextTag(KXmlParser.java:2029)
    at org.ksoap2.SoapEnvelope.parse(SoapEnvelope.java:126)
    at org.ksoap2.transport.Transport.parseResponse(Transport.java:90)
    at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:179)
    at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:90)
    at se.icecon.poc.SOAPRequest.login(SOAPRequest.java:119)
    at se.icecon.poc.SOAPRequest.execute(SOAPRequest.java:37)
    at org.apache.cordova.api.Plugin$1.run(Plugin.java:78)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
    at java.lang.Thread.run(Thread.java:856)

And here's my code for the request.
private String login (String username, String password) {
    SoapObject request = new SoapObject(NAMESPACE, "LoginRequestMessage");
    request.addProperty("username", username);
    request.addProperty("password", password);

    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
    envelope.dotNet = true;
    envelope.setOutputSoapObject(request);

    HttpTransportSE ht = new HttpTransportSE(URL);
    ht.debug = true;
    try {
        ht.call(SOAP_ACTION, envelope);
        return ht.responseDump;
    } catch (Exception e) {
        e.printStackTrace();
    }
    return "";
}

It seems that when 3g is used some bytes are added to the response and shifted around somewhat, therefore corrupting the rest of the data in the request somehow.
My current guess is that it's something similiar to this but I just get a few left over characters that mess up the rest somehow.
Thanks in advance for any tip that might push this in the correct direction.
