无法使用 HttpPost post JSON 数据

Unable to post JSON data using HttpPost

我正在尝试 post JSON 数据到我的 API。但执行后我得到以下结果:

{"name":"Corporate","addr":"Unknown","area":"Unknown","cityId":10,"phone":"--","fax":"--","wooqStoreId":1}]

Response 2 >>{"message":"Blank String","result":"Error","resultCode":"RESULT_CODE_002"}
true

前两行显示我的 JSON 字符串和 响应 2 是我收到的消息。这应该是一条成功消息,因为我收到状态代码 200。

public static boolean pushtoAPI(String url, String jsonObject) {
            DefaultHttpClient client = new DefaultHttpClient();
            HttpPost request = null;
            HttpResponse response = null;
            String postUrl = getHostUrl() + url;

            try {
                    request = new HttpPost(postUrl);


                    StringEntity postingString = new StringEntity(jsonObject.toString());
                    postingString.setContentType("application/json;charset=UTF-8");
                    postingString.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE,
                                    "application/json;charset=UTF-8"));

                    request.setEntity(postingString);


                    request.setHeader("Content-type", "application/json");


                    String custom_cookie = ConstantUtil.authCookie(ConstantUtil.getLoginJsessionId());
                    request.setHeader("Cookie", custom_cookie);

                    response = client.execute(request);
                    System.out.println("Response 2 >>" + EntityUtils.toString(response.getEntity()));
                    if (response.getStatusLine().getStatusCode() == 200) {
                            System.out.println("true");
                            return true;
                    }
            } catch (ClientProtocolException e) {
                    e.printStackTrace();
            } catch (IOException e) {
                    e.printStackTrace();
            } catch (Exception e) {
            } finally {
                    request.abort();
            }

            return false;
    }

看起来像是服务器端代码问题。

你能说明你在哪里创建这个字符串吗?

"message":"Blank String","result":"Error","resultCode":"RESULT_CODE_002"