Android 2.2 vs 2.3 - soapaction vs SOAPAction in HTTP header - android

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();
}

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.

Related

IIS and Apache Content-Type header... IIS will only accept one, Apache accepts more than one

IIS will send back a 400 error if you send it two content-type headers, here is an example:
1: Content-type : application/json
2: Content-type : application/json; charset=utf-8;
Apache handles that and processes properly for json.
My reading of the w3c spec is that only a single Content-Type header is allowable. Arguably though both headers mean exactly the same thing as JSON in this case is as I understand it, UTF-8. So whose right here? IIS or Apache?
My app fails running on IIS, the Android lib I am using sends 2 headers if I give it my own and fails on IIS. So currently I'm locked into Apache.

Android Https signing parameters

Good day!
I have a trouble with sending https request from android application with signing parameters.
I have source which allows me to send secure http request, but authentification does not work.
I need to send request to some url with port number.
By using
HttpEntity entity = new UrlEncodedFormEntity(params, "utf-8");
After this, I retrieve this parameters in string format like
param2=param1&param2=param2%20p - encoded format
Next I need take md5 hash and again introduce it in httpbody param without encoding
Example of request:
HTTP method - POST
Headers: Content-Length - 275
Content-Type - application/x-www-form-urlencoded
параметры в HTTP body -
PHONE=2583838&ORDER_STATE_ID=31&SOURCE=улица%20Жандосова,%20188&DESTINATION=Тепличная%20улица,%202а&CLIENTID=62&SOURCE_TIME=20130807120054&IS_PRIOR=true&NOTE=This%20is%20comment&PHONE_TO_DIAL=8(701)746-90-26&CUSTOMER=Anna%20Ahmatova&signature=ed4aaef27e2d46a46f449903f3524788
Help me please. This post request working but everytime I have trouble with authentification

Yahoo messenger API - error when open a long-lived connection for Comet-style notification

I'm trying to get Yahoo messenger notifications (comet style) to work on my Android app but I got a problem:
I have all the oauth tokens + IM cookie, I make the call to notify server but it responds with
403 Bad IM cookie or URI credential
The IM cookie which is sent is correct because it is the same as the one I got from POST /session.
The call:
POST to:http://rproxy2.messenger.yahooapis.com/v1/pushchannel/user_id?sid=T3qRkifs3BiGXCW4LOSoThi3lG2HvWNagr.mGA--&rand=-1131022177&count=10&seq=1&format=json&IM=2x5A0IOr9Js_8er8BgSYUCB9fjB.d20FbKds7NdJdkzWK4u2A92k5dMrM72OetLz9.q70NQCwZpAqafQ5.XM-|QTvOT1rY3ukBC8o4Z0zeRg--&oauth_consumer_key=dj0yJmk9cFNKb2NKbTdINEtFJmQ9WVdrOVpHMW1aVXhKTjJNbWNHbzlNamcyTnpNMU1UWXkmcz1jb25zdW1lcnNlY3JldCZ4PWJh&oauth_nonce=939bc51c9a594c7cbf903643bc10f7d1&oauth_signature_method=PLAINTEXT&oauth_timestamp=1328108171163&oauth_token=A%3DosG_yqL.hxped9sV4ZMVD2A5vugclvEOSKIw85DOg17vQa8N1jQK6UcGqeLGLXKFalrxnYA_iA_ArmhbN6oJ_CEINGwiq7MWsVjO_vQT5bwhmcBMwBLByhusduuH2BFJw1Zd2w_uDj5fEUVMK9bMDzg.fYEpdm1uK.OgwyYLPCwdkzW0w6ujPpaFAea7gwmsSBYHECzjXm8wduoe1Sw3rpJH4z9PGIe8Hkt3wrbyJpW9BuiU4g6OyE1f8nhzHVkcG_70KQiIR_oV3tP8_l4SCsbbHMvSzlyZjK1V6gJp0Q94fAcfuIWQ1Vd.iD.UZPEyzdzYK.k5Q6pE4H3At8czcXFOpmOL5eUwfbeQEtXePCL1b2v9oY4BxtH_dCUVTMhzQsV.YpKZV.ZRZzK8ThveL5gfGuqYcBZLHwVilQnQWo477XwT10GbvWUzJ2EH4v5m9q.sGMViSIKWjbE2O6YfwhYXAgQMA3d8wQLL7IoY4QC0.IR4T8M_KnZVlKoi_EiED8VuK9h7h3emBZeXoM15rqGk2..HUJQEuIe1d0YbTPEGKdM.fbCcT7_Y0Szzw3abf9b1Xjzm8VkNSKL.LXAmy8c9PyNatUT_hKFmzmWMd1RRYfd8rF7i6i7Ec_cVv06QhwCQyKlEsCQh7UChUe9JykUmiA6JOm4JOpsbTQWS1Iec35zrltc4YwouUlMx.y6JbzB_VYL9jkzeuu&oauth_version=1.0&oauth_signature=2cd720831677df11508571218aed6c36c9cf2b51%26e57b0e111092b000a43b4ae9c928178fd5da4b9f
connection: keep-alive
cookie: IM=2x5A0IOr9Js_8er8BgSYUCB9fjB.d20FbKds7NdJdkzWK4u2A92k5dMrM72OetLz9.q70NQCwZpAqafQ5.XM-|QTvOT1rY3ukBC8o4Z0zeRg--
User-Agent: Dalvik/1.2.0 (Linux; U; Android 2.2; sdk Build/FRF91)
Host: rproxy2.messenger.yahooapis.com
Content-Type: application/x-www-form-urlencoded
Content-Length: 0
The server responds with:
HTTP/1.1 403 bad IM cookie or URI credentials
Connection: close
I followed all the instrunctions from docs, not sure how can make it to work.
Thanks.
Your HTTP POST is empty (Content-Length: 0), the docs state:
Note: even though all inputs are optional, the server
still expects an empty POST body (JSON: "{}")
so, change your Content-Type to "application/json;charset=utf-8" and include
{}
as the body of the HTTP POST.
Long lived connections need to be GET calls; see "Notification Management (Comet-Style Push) API", here.

How to make a chunked transfer encoding HTTP request in Android?

How to generate a chunked transfer encoding HTTP request in Android ? The code below did not do the trick for me.
HttpURLConnection cn = (HttpURLConnection)(new URL(url)).openConnection();
cn.setRequestProperty("Transfer-Encoding", "chunked");
You can't request that the response is chunked. The server isn't even required to be able to generate chunked response.
What you are doing by sending that header, is telling the server that the content of the request is in chunked encoding.

Android soap request posting -sample?

I want to send the SOAP xml request to php server from android device, as shown below are required parameter for posting request. Currently i am not getting any method or sample to do achieve.Any suggest some samples.
POST /sample/server.php HTTP/1.0
Host: x.x.x.x
User-Agent: NuSOAP/0.7.3 (1.114)
Content-Type: text/xml; charset=ISO-8859-1
SOAPAction: ""
Content-Length: 551
Thanks

Categories

Resources