Error “com.android.volley.Server Error” When Send Lots of Json Object

问题内容:

My Code Is

    try
    {
        NetworkManager nm = new NetworkManager(context);
        DeviceInfoManager cm = new DeviceInfoManager(context);

        String gsonString = new Gson().toJson(new PropsUInfos(nm.GetBSSID(),nm.GetSSID(),nm.GetNetworkType()
                ,nm.GetWifiMacAddress(),nm.GetWifiState(),cm.GetAppVersion()
                ,cm.GetSystemLang(),cm.GetSystemVersion(),cm.GetDeviceModel()));

        JSONObject GUIDJson = new JSONObject();
        GUIDJson.put("GUID",ReadGUID());
        String url = "http://mywebsite.com/userinfos.php?guid=" + GUIDJson.toString() + "&uinfos=" + gsonString;
        RequestQueue queue = Volley.newRequestQueue(context);
        StringRequest stringRequest = new StringRequest(Request.Method.GET, url,
                new Response.Listener<String>() {
                    @Override
                    public void onResponse(String response) {
                        try {

                            JSONObject jsonObject = new JSONObject(response);
                            jsonResult = jsonObject.getString("ok");
                        } catch (JSONException e) {
                            e.printStackTrace();
                        }
                    }
                }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
                error.printStackTrace();
                Log.d("status code",String.valueOf(error.networkResponse.statusCode));
            }
        });
        queue.add(stringRequest);
    }
    catch (Exception ex)
    {
        ex.printStackTrace();
    }

When I RunCode I Get com.android.volley.Server Error
but i run my url below in browser and work success full.

http://mywebsite.com/userinfos.php?guid={"GUID":"fdb88de3-51e5-4aee-9291-cc6643058dbc"}&uinfos={"AppVersion":"1.0 (1)","BSSID":"01:11:c2:22:33:03","DeviceModel":"unknownCustom Phone - 5.0.0 - API 21 - 768x1280","NetworkType":"Wifi","SSID":"\"WiredSSID\"","SystemLang":"en-US","SystemVersion":"SDK 21","WifiMacAddress":"09:21:27:af:23:7e","WifiState":3}

When i romove 5 or 4 json object (DeviceModel BSSID etc) Work success full.

Please help me.

问题评论:

    
When Use HttpUrlConnection Error Code is 400 But my Host Work Success Full.(Use Send Data With Browser)
– Mahdi Jalali
14 mins ago

原文地址:

https://stackoverflow.com/questions/47756522/error-com-android-volley-server-error-when-send-lots-of-json-object

添加评论

友情链接:蝴蝶教程