0
HttpClient Client = new DefaultHttpClient();
String URL = "http://192.168.2.22:1099/Service1.svc/test";
try
{
String setServerString = "";
HttpGet httpget = new HttpGet(URL);
ResponseHandler<String> responseHandler = new BasicResponseHandler();
setServerString = Client.execute(httpget, responseHandler);
lblStatus.setText(setServerString);
}
catch(Exception ex)
{
lblStatus.setText("Fail!");
}
url을 호출하면 문자열을 반환하고 lblStatus로 설정됩니다. 이 코드는 v2.3.에서는 정상적으로 작동하지만 v4.0에서는 작동하지 않습니다. v2.3. * 버전에서는 문자열을 가져올 수 있지만 v4.0에서는 가져올 수 없습니다.httpget android wcf error
[참조하십시오 (http://stackoverflow.com/questions/13134019/http-post-method-passing-null-values-to-the-server/13134287#13134287) 및 [This] (http://chintankhetiya.wordpress.com/) –
@chintankhetiya, 나는 어떤 자료도 게시하고 있지 않다. 문자열을 반환하는 메서드를 호출하고 있습니다. – user223100
괜찮 았으면 매개 변수를 전달할 필요가 없습니다. 단지'URL'을 호출하고 응답을 얻으십시오. –