try{
CloseableHttpClient httpClient = null;
httpClient = HttpClients.createDefault();
String url = "需要连接的接口地址";
HttpPost httpPost = new HttpPost(url);
// 需要发送的报文内容-------start,没有的话可以省略
StringBuilder content = new StringBuilder();
content .append("报文格式1");
content .append("报文格式2");
content .append("报文格式3");
........// 报文格式根据接口方的文档确定
String queryParm = content .toString();
String entity = new StringEntity(queryParm需要发送的报文,"UTF-8");
httpPost.setEntity(entity);// 发送 的报文参数
// 需要发送的报文内容-------end,没有的话可以省略
HttpResPonse httpPesPonse= httpPost.execute(httpPost);// 发送请求
String result = EntitUtils.toString(httpPesPonse.getEntity(),"Utf-8");// 获取接口返回的内容
}catch (Exception e) {
// 根据情况异常日志
}