我想從我在模擬器上運行的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