我得到凌空400错误

时间:2017-05-25 05:15:16

标签: java android

date_expr
  

我正在获取以下logcat信息:   05-25 10:23:06.709 16158-18055 / com.example.administrator.crmtestapp E / Volley:[341] BasicNetwork.performRequest:http://103.75.33.98/BPService/GetAllBPService.svc/SetAllBP 05-25 10:23:06.710 16158-的意外响应代码400- 16158 / com.example.administrator.crmtestapp E / LOG_VOLLEY:com.android.volley.ServerError 05-25 10:26:47.326 21337-21337 /? E / cutils-trace:打开跟踪文件时出错:权限被拒绝(13)* /

2 个答案:

答案 0 :(得分:0)

使用邮递员并检查。 https://www.getpostman.com/回复。

答案 1 :(得分:0)

尝试以这种方式发送请求:

RequestQueue requestQueue = Volley.newRequestQueue(BP_Details.this);
StringRequest strReq = new StringRequest(Request.Method.POST,
            URL, new Response.Listener<String>() {
        @Override
        public void onResponse(String response) {
            Log.i("response", response);
        } 
    }, new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {
            Log.e(TAG, "Login Error: " + error.getMessage());
            Toast.makeText(getApplicationContext(),
                    error.getMessage(), Toast.LENGTH_LONG).show();
        }
    }){

        @Override
        protected Map<String, String> getParams() throws AuthFailureError {
            Log.e(TAG,"Inside getParams");

            // Posting parameters to url
            Map<String, String> jsonBody = new HashMap<>();
            jsonBody.put("COMPANY_NO",s);
            jsonBody.put("LOCATION_NO",s1);
            jsonBody.put("BP_CODE",code);
            jsonBody.put("NAME",name);
            jsonBody.put("ADDRESS1",address1);
            jsonBody.put("ADDRESS2",address2);
            jsonBody.put("CITY",city);
            jsonBody.put("STATE",state);
            jsonBody.put("COUNTRY",country);
            jsonBody.put("ZIP",zip);
            jsonBody.put("AREA_CODE",area);
            jsonBody.put("EMAIL",email);
            jsonBody.put("CURRENCY",currency);
            jsonBody.put("TIN_GRN",tin);
            jsonBody.put("CST_NO",cst);
            jsonBody.put("PAN_NO",pan);
            jsonBody.put("SALES_PERSON_NO",salesPname);
            jsonBody.put("PHONE_NO",mobile);
            jsonBody.put("LOCATION",cLocation);

            return params;
        }
    };
    // Adding request to request queue
    queue.add(strReq);