Hi All I am using Volley and trying to parse data from SOAP api. Following is my snippet code, when I try to parse data it is giving error. Can any one help me with this? I am getting following error every time.
E/Volley: [7440] BasicNetwork.performRequest: Unexpected response code 400 for
public void HttpPOSTRequestWithParam() {
RequestQueue queue = Volley.newRequestQueue(this);
String url = "https://www.myweb.co.ke/Wt/webtask.asmx?op=GetProductListing";
StringRequest postRequest = new StringRequest(Request.Method.POST, url,
new Response.Listener<String>()
{
@Override
public void onResponse(String response) {
Log.e("Response", response);
}
},
new Response.ErrorListener()
{
@Override
public void onErrorResponse(VolleyError error) {
Log.e("ERROR","error => "+error.toString());
}
}
) {
@Override
protected Map<String, String> getParams() {
Map<String, String> params = new HashMap<String, String>();
params.put("UserName", "John");
return params;
}
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
Map<String, String> params = new HashMap<String, String>();
params.put("User Name", "1234");
params.put("Password", "4321");
return params;
}
};
queue.add(postRequest);}
You may need to tell it how the Content-Type and Accept headers are encoded. Here the parameter string should look like: 'grant_type=password&username=apikey&password=apipassword'