Android Post 请求不在服务器上发布任何数据

Android Post request not posting any data on server

=====已更新========
其实下面的代码没问题,我的问题在服务器端。
=====已更新========

下面是我的代码,我正在使用 HttpURLConnection 但无法将 JSON 数据发送到服务器。

请帮助我提前致谢

 JSONObject jo = new JSONObject();
    jo.put("ID", "25")
    Log.e("test", jo.toString());

    url = new URL(URL);
    connection = (HttpURLConnection) url.openConnection();
    connection.setRequestMethod("POST");
    connection.setRequestProperty("Content-Type", "application/json");

    connection.setUseCaches(false);
    connection.setDoInput(true);
    connection.setDoOutput(true);

    //Send request
    DataOutputStream wr = new DataOutputStream(
    connection.getOutputStream());
    wr.writeBytes(jo.toString());

    wr.flush();
    wr.close();

    //Get Response
    InputStream is = connection.getInputStream();
    BufferedReader rd = new BufferedReader(new InputStreamReader(is));

    String line;
    StringBuffer sb = new StringBuffer();
    int chr;
    while ((chr = is.read()) != -1) {
    sb.append((char) chr);
    }
    line = sb.toString();
    Log.e("json_temp", line);
    rd.close();

您的代码没问题,它没有显示空数组,而是字符串"Array()"。我尝试了资源测试,这正是它向我展示的内容。 如果您在浏览器中输入 URL,您应该会看到相同的内容。