And*_*uch 0 java eclipse post android http
我需要对Web服务进行HTTP发布..
如果我将它放入这样的Web浏览器中
http://server/ilwebservice.asmx/PlaceGPSCords?userid=99&longitude=-25.258&latitude=25.2548
Run Code Online (Sandbox Code Playgroud)
然后将值存储到服务器上的数据库中..
在Eclipse中,使用Java编程实现android ..这个url看起来像
http://server/ilwebservice.asmx/PlaceGPSCords?userid="+uid+"&longitude="+lng1+"&latitude="+lat1+"
Run Code Online (Sandbox Code Playgroud)
用uid,lng1并且lat1被指定为字符串..
我该怎么办呢?
谢谢
try {
HttpClient client = new DefaultHttpClient();
String getURL = "http://server/ilwebservice.asmx/PlaceGPSCords?userid="+uid+"&longitude="+lng1+"&latitude="+lat1+";
HttpGet get = new HttpGet(getURL);
HttpResponse responseGet = client.execute(get);
HttpEntity resEntityGet = responseGet.getEntity();
if (resEntityGet != null) {
//do something with the response
Log.i("GET RESPONSE",EntityUtils.toString(resEntityGet));
}
} catch (Exception e) {
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8645 次 |
| 最近记录: |