My web server program is written in nodejs , But it does not manage session when i send request from my android app ,I have set the header along with my request, but I'm getting the same response from the server as "Session does not exist" , I added Cookie token along with the request header , something is missing in my Volley request Header .The code below shows my Volley response Header ... can anybody help me to make Volley request header with the cookie token ?
{
Connection=keep-alive,
Content-Length=216,
Content-Type=application/json; charset=utf-8,
Date=Wed,
18 Jan 2017 06:12:11 GMT,
ETag=W/"d8-oF3uHVo3IiU9RmPHXIfBcA",
Server=nginx/1.10.0 (Ubuntu),
set-cookie=connect.sid=s%3ACeQpRX68rrYC6bebVi5F15hEN8uUmetO.GPKqnHv9VYNH83ztga3YnicAsvZ%2FSB28xUcrRGRa2sA; Path=/,
X-Android-Received-Millis=1484719931455,
X-Android-Response-Source=NETWORK 200,
X-Android-Selected-Protocol=http/1.1,
X-Android-Sent-Millis=1484719930801,
X-Powered-By=Express
}
Related
I am getting this error - Request method 'POST' not supported but I am not using POST type.
#GET("ads/getAdsList")
Call<ApiResponse<List<HomeAdModel>>> getAdsList();
I am calling it like above. But getting this error
D/OkHttp: --> POST http://abc/foodS/api/ads/getAdsList
D/OkHttp: <-- 405 http://abc/foodS/api/ads/getAdsList (1661ms)
D/OkHttp: {"timestamp":"2020-07-22T15:32:42.207+0000","status":405,"error":"Method Not Allowed","message":"Request method 'POST' not supported","path":"/foodS/api/ads/getAdsList"}
When I check it in postman, it works. Here is the screenshot.
It seems like your HTTP client changes GET to POST method which is not supported by the backend.
You can change the server side response return to "307" code or, switch to OKHTTP or Volley library to be able to connect to the backend using custom network interceptor.
According to: https://github.com/square/retrofit/issues/1762#issuecomment-215086267
And read: https://github.com/square/okhttp/issues/2262#issuecomment-172933936
Having issue in postman can't send post request to the server.
So I have
#GetMapping("/{id}")
public blablabla (#PathVariable long id )
#PostMapping("/scan")
public blablablabla(){}
Somehow when I send post request for /scan via postman it returns
Failed to convert value of type 'java.lang.String' to required type 'java.lang.Long';
nested exception is java.lang.NumberFormatException: For input string: \"scan\
But it works fine in my android application.
Is this postman issue?
Thank you
I've got the answer..
In postman, I send http request to my https server.
So it's redirecting it making it a GET request instead of my POST request.
We can set logging if we use Ion to make HTTP connection to server as below
Ion.getDefault(getContext()).configure().setLogging("MyLogs", Log.DEBUG);
But we can't see the HTTP response from server from log that generated.
How to see HTTP response ?
Ion does not put the response body into the logs, as the body may be enormous, binary, etc.
If you want to log the body, do so yourself in the setCallback.
I am able to log into the django server using an Http Post request, but when I go to see if the user is authenticated immediately after I am getting a HTTP/1.1 401 UNAUTHORIZED response.
I am using the same DefaultHttpClient for both the post and the get request by means of a static member.
I have already attempted adding the sessionid cookie from the POST request to the GET request as a header.
Is there anything I am missing?
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.