我有以下網站http://www.freewebservicesx.com/GoldSpotPrice.aspx它提供了一個web服務api。因爲我對肥皂和休息非常新,我完全不知道如何調用這個服務並在android中使用它。有人可以告訴我該怎麼做。在android中使用web服務
0
A
回答
1
1
您可以使用HttpURLConnection
或HttpClient的發出HTTP請求。使用HttpClient
一個RESTful Web服務的例子:
HttpClient httpClient = new DefaultHttpClient();
HttpGet httpGet = new HttpGet("http://www.mywebsite.com/webservice");
HttpResponse response = httpClient.execute(httpGet);
StatusLine statusLine = response.getStatusLine();
if (statusLine.getStatusCode() == HttpStatus.SC_OK) {
HttpEntity entity = response.getEntity();
ByteArrayOutputStream out = new ByteArrayOutputStream();
entity.writeTo(out);
out.close();
String responseStr = out.toString();
// process response
} else {
// handle bad response
}
否則,如果你與SOAP Web服務的工作,我會建議使用ksoap2
+0
http://www.freewebservicesx.com/GetGoldPrice.asmx?op=GetCurrentGoldPrice是該文件。我將如何去用這個用戶名和密碼來打電話 – user1092042 2012-04-07 04:18:35
相關問題
- 1. 在Android中使用Web服務
- 2. 如何在Android中使用Web服務?
- 3. 在android中使用JSON Web服務
- 4. 在Android中使用Web服務
- 5. 如何在Android中使用Web服務?
- 6. 在Android中使用.net web服務
- 7. 在Android中使用XML-RPC Web服務
- 8. 在Android中使用Web http服務
- 9. android使用navision web服務
- 10. REST Web服務使用Android中
- 11. 使用KSOAP的Android中的Web服務
- 12. 無法在Android上使用Web服務
- 13. 使用android xamarin使用web服務
- 14. 在android中調用asp.net web服務
- 15. 如何在Android中調用Web服務
- 16. 在android中調用soap web服務
- 17. 如何在android中調用web服務
- 18. 如何在android中調用web服務
- 19. 在Android中調用Web服務
- 20. 在Web服務中內部使用Web服務
- 21. Android:使用SOAP調用Web服務
- 22. 如何在python中使用https服務使用web服務
- 23. 使用web服務在jar中使用服務
- 24. 使用Web服務在iPhone
- 25. RE:在使用Web服務
- 26. Android中的Web服務
- 27. android/eclipse中的web服務
- 28. Android Web服務中的java.lang.NullPointerException
- 29. 使用android連接到web服務器
- 30. Android:使用Soap的Web服務
http://www.freewebservicesx.com/GetGoldPrice。 asmx?op = GetCurrentGoldPrice是文件。我將如何去調用這從android – user1092042 2012-04-07 04:19:02