Soap query with jQuery / Phonegap always fail on Android

I developed an iPhone/Android app with jQuery mobile & Phonegap (now Cordova). This app use different services with no problem. One of this services is a Soap one so i use the jsSOAPClient (jquery.jqSOAPClient.js) for jQuery in order to request the service. I have no problem at all from an iOS device but the query always fail on Android.

In jsSOAPClient the request looks like that :

  • Facebook Sdk Has Not Been Initilized
  • How to set Image resource to ImageView using DataBinding
  • Catching key pressed with the virtual keyboard in Android?
  • Content Observer onChange method called twice after 1 change in cursor
  • How to generate R.java
  • Testing AsyncTaskLoaders with Robolectric
  •         function getResponse(xData, status) {
                if(!!callback) {
                    SOAPClient.Status = xData.status;
                    SOAPClient.ResponseText = xData.responseText;
                    SOAPClient.ResponseXML = xData.responseXML;
                    callback(xData.responseXML);
                }
            }
    
            $.ajax({
                 type: "POST",
                 url: SOAPClient.Proxy,
                 dataType: "xml",
                 processData: false,
                 data: content,
                 complete: getResponse,
                 beforeSend: function(req) {
                    req.setRequestHeader("Method", "POST");
                    req.setRequestHeader("Content-Length", SOAPClient.ContentLength);
                    req.setRequestHeader("Content-Type", SOAPClient.ContentType + "; charset=\"" + SOAPClient.CharSet + "\"");
                    req.setRequestHeader("SOAPServer", SOAPClient.SOAPServer);
                    req.setRequestHeader("SOAPAction", soapReq.Action);
                 }
            });
    

    The “getResponse” “status” value is “error” and the “SOAPClient.Status” (equal to “xData.status”) value is “0”.

    The server seems to not receive request at all…

    I repeat that the same code with the same request datas have results on iOS.

    Thanks for help.

    / EDIT */
    I tried to comment the line :

    //type: "POST",
    

    it seems to work, i mean i have a 200 status code in this case even if i have a parse error due to the unexpected response format.

  • java.lang.NullPointerException: CameraUpdateFactory is not initialized logcat exception
  • BottomSheetDialog remains hidden after dismiss by dragging down
  • securing a REST API accessible from Android
  • Why Android Gradle preDexDebug “Source and destination must be different” build failed?
  • Dynamic Apk In Android
  • How do I effectively implement the MVVM design pattern for my android app which will also ease writing of test cases?
  • One Solution collect form web for “Soap query with jQuery / Phonegap always fail on Android”

    Apparently there is a bug in Android 2.x where setting the
    “Content-length” header causes the problem you describe. It looks like
    the bug has been fixed in Android 4.0.3. So try your code unmodified
    in the 4.0.3 emulator and it should work then come back to 2.x and
    remove the Content-length header to see if it works as well.

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.