关于APP的调用webService的问题 本帖最后由 hutao93 于 2014-04-03 20:58:54 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 没什么的,就用httpclient请求服务器的Webservice 参考/** * a http request with given url * @param strUrl the url you want to request * @return */ public static String request(String strUrl){ logger.debug(CommonHTTPRequest.class.getName() + ", request url is : " + strUrl); String userHome = System.getProperty("user.home"); if(userHome.contains("eacfgjl")){ useProxy = true; } if(useProxy){ initProxy(); } URL url = null; String result = ""; HttpURLConnection urlConn = null; InputStreamReader in = null; try { url = new URL(strUrl); urlConn = (HttpURLConnection) url.openConnection(); in = new InputStreamReader(urlConn.getInputStream()); BufferedReader br = new BufferedReader(in); String readerLine = null; while((readerLine=br.readLine())!=null){ result += readerLine; } in.close(); urlConn.disconnect(); } catch (MalformedURLException e) { e.printStackTrace(); logger.error(ExceptionUtil.getTrace(e)); } catch (IOException e) { e.printStackTrace(); logger.error(ExceptionUtil.getTrace(e)); } finally { try { in.close(); } catch (IOException e) { e.printStackTrace(); logger.error(ExceptionUtil.getTrace(e)); } urlConn.disconnect(); } return result; } http://blog.csdn.net/baiyuliang2013/article/details/21979037 android中如何仿select下拉控件 我是新手... 运行时报ResourceNotFound android4.0环境下,状态栏上的MENU 键不显示了 我这么操作怎么会出现Classcast异常呢??求救!! Android SDK 多个Activity之间的转换问题 新手想尝试开发一个项目,有很多疑问,欢迎解答 请问如何将onActivityResult得到的数据更新在alertdialog上 请问这种情况如何处理 MVP模式中,V通过接口实例化P层好还是直接new P层对象好 关于侧滑菜单slidingmenu的一个问题,求解 从资源文件释放数据库的一个奇怪现象
/**
* a http request with given url
* @param strUrl the url you want to request
* @return
*/
public static String request(String strUrl){ logger.debug(CommonHTTPRequest.class.getName() + ", request url is : " + strUrl);
String userHome = System.getProperty("user.home");
if(userHome.contains("eacfgjl")){
useProxy = true;
}
if(useProxy){
initProxy();
}
URL url = null;
String result = "";
HttpURLConnection urlConn = null;
InputStreamReader in = null;
try {
url = new URL(strUrl);
urlConn = (HttpURLConnection) url.openConnection();
in = new InputStreamReader(urlConn.getInputStream());
BufferedReader br = new BufferedReader(in);
String readerLine = null;
while((readerLine=br.readLine())!=null){
result += readerLine;
}
in.close();
urlConn.disconnect();
} catch (MalformedURLException e) {
e.printStackTrace();
logger.error(ExceptionUtil.getTrace(e));
} catch (IOException e) {
e.printStackTrace();
logger.error(ExceptionUtil.getTrace(e));
} finally {
try {
in.close();
} catch (IOException e) {
e.printStackTrace();
logger.error(ExceptionUtil.getTrace(e));
}
urlConn.disconnect();
}
return result;
}