以Json格式发布数据Android错误404

时间:2015-05-05 13:11:36

标签: android json android-activity

我将json格式的数据发布到服务器但我得到的响应状态为404, 请让我知道如何修复,

JSONObject jsonObject = new JSONObject();
            jsonObject.accumulate("email", uemail);

            // 4. convert JSONObject to JSON to String
            json = jsonObject.toString();
            Log.e("value send",json);

            StringEntity se = new StringEntity(json.toString());


            // 6. set httpPost Entity
            httpPost.setEntity(se);

            // 7. Set some headers to inform server about the type of the content
           httpPost.setHeader("Accept", "application/json");
           httpPost.setHeader("Content-type", "application/json");

            // 8. Execute POST request to the given URL
            HttpResponse httpResponse = httpclient.execute(httpPost);

            // 9. receive response as inputStream
            inputStream = httpResponse.getEntity().getContent();

感谢

0 个答案:

没有答案