我想从我在模拟器上运行的Android应用程序调用REST webservice。我可以从我的浏览器从Android模拟器调用REST Webservice
http://localhost:39064/AndroidServiceImpl.svc/submitexcerpt?excerpt=...and+the+pirate+fell+off+the+boat
拨打服务我可以从我的仿真器
http://10.0.2.2:39064/AndroidServiceImpl.svc/submitexcerpt?excerpt=...and+the+pirate+fell+off+the+boat
拨打服务但是当我运行这段代码:
HttpClient httpclient = new DefaultHttpClient();
HttpResponse response1;
response1 = httpclient.execute(new HttpGet("http://10.0.2.2:39064/AndroidServiceImpl.svc/submitexcerpt?excerpt=testingthisout"));
我得到一个连接拒绝异常。我已将<user-permission android:name="android.permission.INTERNET"></user-permission>
添加到我的Manifest文件中,并将ThreadPolicy设置为LAX,但仍然没有运气。有什么建议么?
来源未找到标签不再来了,因为我在一般的异常捕获它,我是不是之前,它造成上来。我现在得到一个连接拒绝异常,我正在调查 – Lizzard 2012-04-12 20:30:26