-2
JsonObjectRequest jsonRequest = new JsonObjectRequest(Request.Method.POST,url , jsonobj,
                new Response.Listener<JSONObject>() {
                    @Override
                    public void onResponse(JSONObject respStr) {
                     if (respStr != null) {
                      //// some code
}}};
new Response.ErrorListener() {``
                    @Override
                    public void onErrorResponse(VolleyError error) {
                        pDialog.dismiss();
                        Toast.makeText(CodeActivity.this, "Network Error", Toast.LENGTH_LONG).show();
                    }
                }) {
            @Override
            public Map<String, String> getHeaders() throws AuthFailureError {
                Map<String, String> params = new HashMap<String, String>();

                params.put("Authorization", "Bearer " + token);
                return params;
            }
        };
        RequestQueue requestQueue = Volley.newRequestQueue(this);
        requestQueue.add(jsonRequest);`

}

I have this Error in my logcat. BasicNetwork.performRequest: Unexpected response code 405 for url I use Volley to send a request.

Mayuri
  • 121
  • 10
  • You need to confirm that the server at `url` is handling the `HTTP-POST` requests. Perhaps edit the question to include the request handling server-side so we can all examine and suggest possible solutions. – ishmaelMakitla Aug 05 '16 at 08:42
  • yes url is handling httppost . – Mayuri Aug 05 '16 at 08:56
  • I have tested with normal HttpPost and it is working from there, but while using Volley its getting Error. – Mayuri Aug 05 '16 at 08:57
  • Have a look at [Itai Hanski's answer](http://stackoverflow.com/questions/19837820/volley-jsonobjectrequest-post-request-not-working?rq=1) in this related post here and try the simple test to see if the request succeeds - – ishmaelMakitla Aug 05 '16 at 09:22

1 Answers1

0

405 Method Not Allowed

A request method is not supported for the requested resource; for example, a GET request on a form which requires data to be presented via POST, or a PUT request on a read-only resource.

Check if Request.Method.POST allowed to the server you trying to use

HendraWD
  • 2,984
  • 2
  • 31
  • 45