public static String doPostJson(String url,String key,String json){
try {
String postURL=url;
PostMethod postMethod = null;
postMethod = new PostMethod(postURL) ;
postMethod.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8") ;
postMethod.addParameter(key,json); //传参数
HttpClient httpClient = new HttpClient();
int response = httpClient.executeMethod(postMethod); // 执行POST方法
String result = postMethod.getResponseBodyAsString() ;
return result;
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
}