2011-11-04 2 views
0

다음 코드는 아무 것도 반환하지 않습니다 .... 공란. DB에 레코드를 삽입하려고합니다.안드로이드 putJSON 아무것도 반환하지 않습니다

public String inserComment(String url, String commentby, String commenton, String  commenttext, String taskid) 
{ 
     String result = null; 
     JSONObject jsonObject = new JSONObject(); 
    try { 
       jsonObject.put("CommentBy", commentby); 
       jsonObject.put("CommentOn", commenton); 
       jsonObject.put("CommentText", commenttext); 
       jsonObject.put("TaskID", taskid); 

      result = HttpHelper.postJSONforStringResult(url, jsonObject); 

    } catch (JSONException e) { 
      Log.e("DataUploader", "JSONException:" + e.getMessage()); 
      e.printStackTrace(); 
    } catch (IOException e) { 
      Log.e("DataUploader", "IOException:" + e.getMessage()); 
      e.printStackTrace(); 
    } 
    return result; 
} 


public static String postJSONforStringResult(String url, JSONObject json) 
     throws ClientProtocolException, IOException { 

     HttpResponse response = postJSON(url, json); 

     int statusCode = response.getStatusLine().getStatusCode(); 
     String result = (statusCode == 201 || statusCode == 200) ? EntityUtils.toString(response.getEntity()) : "StatusCode=" + statusCode; 
     return result; 
} 

나는 왜 입강이 오늘 작동하지 않는지 모르겠다. 죄송합니다.

답변

0

게시하려는 서버가 실제로 아무것도 반환하지 않는 것을 확인 했습니까? 좋은 상태 코드를 얻었 기 때문에 서버가 응답에 실제로 컨텐트를 넣을 필요는 없습니다.

관련 문제