0
REST 웹 서버에 연결하려고하는데 어떤 문제가 있는지 잘 모릅니다. 여기에, 잘HttpClient를 통해 웹 서버에 연결
public List<Agenda> getAgenda(String dia) {
try {
Log.i(TAG, "It is inside getAgenda()");
HttpClient client = new DefaultHttpClient();
HttpGet method = new HttpGet(Settings.getServiceUrl() + "/" + dia);
Log.i(TAG, Settings.getServiceUrl() + "/" + dia);
//the line above prints: http://192.168.0.100/odonto/agenda.php/2012-02-01
HttpResponse resp = client.execute(method);
//return loadFromJSONArray(client.execute(method));
Log.i(TAG, "Recebeu a response");
return loadFromJSONArray(resp);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
것은 다음과 같습니다 : 연결하는 코드는 제대로 디버그 창에 선
Log.i(TAG, Settings.getServiceUrl() + "/" + dia);
인쇄합니다. 그러나 라인 :
Log.i(TAG, "Recebeu a response");
인쇄되지 않습니다. 그래서 문제는 온라인에 있습니다 :
HttpResponse resp = client.execute(method);
그러나 나는 정말로 이것이 어떻게 잘못 될 수 있는지 모른다! 나는 이미 Firefox로 REST 서버를 테스트했으며 잘 작동한다. 당신은 권한 거부 오류가 발생하는
나는 라인을 추가하고 잘 작동했습니다! 다른 오류가 있지만 연결이 작동 중입니다. 고마워요 ... – trebew