String returnXml = "";
HttpClient httpclient = new HttpClient();
PostMethod post = new PostMethod(url);
post.getParams().setContentCharset("UTF-8");
NameValuePair trackInfo = new NameValuePair("trackInfo", xmlStr);
try{
post.setRequestBody(new NameValuePair[] { trackInfo });
httpclient.executeMethod(post);
InputStream inputStream = post.getResponseBodyAsStream();
BufferedReader br = new BufferedReader(new InputStreamReader(
inputStream, "UTF-8"));
StringBuffer stringBuffer = new StringBuffer();
String str2 = "";
while ((str2 = br.readLine()) != null) {
stringBuffer.append(str2);
}
returnXml = stringBuffer.toString();
}catch (Exception e) {
logger.error(e.getMessage(),e);
}
if (logger.isDebugEnabled()) {
// 打印xmlString报文
logger.debug("---------------返回报文:" + returnXml);
}
HttpClient httpclient = new HttpClient();
PostMethod post = new PostMethod(url);
post.getParams().setContentCharset("UTF-8");
NameValuePair trackInfo = new NameValuePair("trackInfo", xmlStr);
try{
post.setRequestBody(new NameValuePair[] { trackInfo });
httpclient.executeMethod(post);
InputStream inputStream = post.getResponseBodyAsStream();
BufferedReader br = new BufferedReader(new InputStreamReader(
inputStream, "UTF-8"));
StringBuffer stringBuffer = new StringBuffer();
String str2 = "";
while ((str2 = br.readLine()) != null) {
stringBuffer.append(str2);
}
returnXml = stringBuffer.toString();
}catch (Exception e) {
logger.error(e.getMessage(),e);
}
if (logger.isDebugEnabled()) {
// 打印xmlString报文
logger.debug("---------------返回报文:" + returnXml);
}
url:地址
xmlStr:报文
returnXml:客户接收返回报文