I'm currently trying to send a simple POST request via Google Volley to my server. Therefore, I wrote the following lines of code:
Map<String, String> params = new HashMap<String, String>(); params.put("regId", "skdjasjdaljdlksajskl"); JSONObject object = new JSONObject(params); JsonObjectRequest request = new JsonObjectRequest(Method.POST, "address_of_my_server/method", object, successListener, errorListener); queue.add(request);
But I get an error 500, which says that the parameter (regId) is missing. I tried the same with GET-Request but got the same result.
Only when I use StringRequest with a formatted URL, for example, "address_of_my_server / method? RegId = sadlasjdlasdklsj", the server responds to 200.
I get the same result when I use StringRequest, for example:
StringRequest request = new StringRequest(Method.POST, "myurl", successListener, errorListener){ @Override protected Map<String, String> getParams() throws AuthFailureError { Map<String, String> params = new HashMap<String, String>(); params.put("regId", "skdjasjdaljdlksajskl"); return params; } };
Why is Wally ignoring my options?
Frame91 Nov 04 '13 at 1:06 on 2013-11-04 01:06
source share