81,091
社区成员
发帖
与我相关
我的任务
分享
try {
String url ="http://webservice.webxml.com.cn/WebServices/ForexRmbRateWebService.asmx?disco";
HttpClient client = new HttpClient();
// String params = "";
HttpMethod method = new GetMethod(url);
// method.setQueryString(params); //params 为访问参数 System.out.println(method);
client.executeMethod(method);
if (method.getStatusCode() == HttpStatus.SC_OK) {
//返回访问结果
String response = method.getResponseBodyAsString();
System.out.println(response);
}
method.releaseConnection();
} catch (HttpException e) {
// TODO Auto-generated catch block
System.out.println("访问失败!");
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
System.out.println("返回失败!");
result = "0.00";
e.printStackTrace();
}