나는 ulr에서 json 데이터를 가져 오려고합니다.android에서 전체 http 응답을받지 못합니다
나는 firefox 포스터에 추가 기능이 제대로 작동하는지, 전체 응답으로 테스트 중입니다.
하지만 안드로이드는 전체 http 응답을받지 못합니다.
나는 또한 구글에서 검색 및 코드를 시도하지만 내 문제가 해결되지 오전
HttpClient client = new DefaultHttpClient();
HttpConnectionParams.setConnectionTimeout(client.getParams(), 10000); // Timeout
// Limit
HttpResponse response;
JSONObject json = new JSONObject();
try {
HttpPost post = new HttpPost(API.ALL_PROPERTY_BUY);
/*
* json.put("fId", fname); json.put("fId", lname);
*/
StringEntity se = new StringEntity(json.toString());
se.setContentType(new BasicHeader(HTTP.CONTENT_TYPE,"application/json"));
post.setEntity(se);
response = client.execute(post);
/* Checking response */
if (response != null) {
InputStream in = response.getEntity().getContent(); // Get the
// data in
// the
// entity
// System.out.println("Response is:"+ in.toString());
InputStreamReader isr = new InputStreamReader(in);
BufferedReader br = new BufferedReader(isr);
String s = new String();
temps = new String();
while ((s = br.readLine()) != null) {
System.out.println("response is :" + s);
}
}
} catch (Exception e) {
e.printStackTrace();
}
이 내 코드입니다.
아무쪼록 도와주세요.
매니페스트 파일에 인터넷 권한을 추가하십시오. –
@VivekKumarSrivastava 모든 권한 추가 및 코드 잘 작동하지만 문제가 webservice에서 전체 응답을 받고 있지 않습니다. – Hemant
String을 사용할 수 있습니다. EntityUtils.toString (response.getEntity()); 이 작품이 나에게 알려주세요. –