我在 Android 中有一个调用 Web 服务的方法,如下所述。
现在,当我的班级调用此方法时,我看不到任何异常,只能看到System.out.println("entered into call service method 2");
日志。我可以看到 logcat 状态response = httpclient.execute(httppost);
不起作用,并且System.out.println("entered into call service method 3");
在 logcat 上也没有显示任何异常。知道为什么吗?如何解决?
public void callService() throws Exception {
System.out.println("entered into call service method");
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://localhost:81/a.php");
HttpResponse response;
System.out.println("entered into call service method 1");
try{
System.out.println("entered into call service method 2");
**response = httpclient.execute(httppost);**
System.out.println("entered into call service method 3");