Search code examples
androidhttp-headersksoap2android-ksoap2

Android 2.2 vs 2.3 - soapaction vs SOAPAction in HTTP header


Using the ksoap2 library (v2.6.4), SOAP version11, I'm executing a web service via a 2.3.3 emulator device. The server recognizes the requested action and provides the expected answer. The HTTP/1.1 header (debugged at the server side) contains the following:

User-Agent: ksoap2-android/2.6.0+
SOAPAction: myAction
Content-Type: text/xml;charset=utf-8
Connection: close
Content-Length: 1481
Host: xxx.xxx.xxx.xxx
Accept-Encoding: gzip

Trying to fire up the same application - everything is the same (if there's such a thing in the IT world), same source, library, soap config, request, server etc. - but this time on a 2.2 emulator device. The server rejects the request claiming that the SOAPAction is missing from the request. Logs show that this request came with the following HTTP header:

user-agent: ksoap2-android/2.6.0+
soapaction: myAction
content-type: text/xml;charset=utf-8
connection: close
content-length: 1481
Host: xxx.xxx.xxx.xxx

So the SOAPAction (among other parts of the header) arrives as a lowercase parameter. The server does not recognize the lowercase "soapaction" and rejects my request. I'd need this application to work on Android 2.2+

Any ideas where to start?

EDIT: This is how I send my SOAP request. If that's any help.

    public Object executeMyFunction(SoapObject request) throws Exception {

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

            HttpTransportSE _ht = new HttpTransportSE(Configuration.getWsUrl());
            _ht.call("myFunction", envelope);
            return envelope.getResponse();

    }

Solution

  • I had similar problem with ksoap2. Application was working on android version 2.2 but not on 2.3.3. That thing that cause problem was caseing, so I was looking for response header parameter :

    set-cookie 
    

    insted of

    Set-Cookie
    

    IgnoreCase solved my problem. You should allways try to catch http messages from emulator with wireshark, and than compare them.