I am sending POST
query along with String data from android device using Volley
library.
The server however, is receiving only null
values for the params. My code goes like this:
final String param1 = "one";
final String param2 = "124843";
final String param3 = "878942";
final String param4 = "885942";
String url = getIPAddr()+":"+getPort()+"/com.va.jersey.helloworld/hello";
RequestQueue queue = Volley.newRequestQueue(getBaseContext());
StringRequest stringRequest = new StringRequest(Request.Method.POST,url,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
showOutput(response);
}
},new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
showOutput(error.toString());
}
}){
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String, String> params = new HashMap<String, String>();
params.put("param1", param1);
params.put("param2", param2);
params.put("param3", param3);
params.put("param3", param4);
return params;
} //attaching POST params
};
queue.add(stringRequest);
I believe there is some error in StringRequest
, please correct...