RestTemplate resttemplate = new RestTemplate();
String query_response = resttemplate.postForObject(url+"/query", "{}", String.class);//url 是对方的url ,后面query 是对方的post;"{}"规定是我传入是jsonl
HttpHeaders headers = new HttpHeaders();
headers.set("Accept-Charset", "utf-8");
headers.set("Content-type", "application/json; charset=utf-8"); //header的规定
HttpEntity<String> formEntity = new HttpEntity<String>("请求报文包体 ,string类型", headers);
//要解决响应报文的乱码问题
String huan_response = "";
try{huan_response =new String( resttemplate.postForObject(huan_url,formEntity , String.class).getBytes("ISO-8859-1"), "utf-8");
System.out.println(huan_response);
}catch(IOException io){
io.printStackTrace();
}