HttpClient http = new DefaultHttpClient();
HttpPost post = new HttpPost(url);
List<NameValuePair> formparam = new ArrayList<NameValuePair>();
formparam.add(new BasicNameValuePair("para_xml", xmlStr));
UrlEncodedFormEntity entity;
entity = new UrlEncodedFormEntity(formparam, "utf-8");
post.setEntity(entity);
HttpResponse response = http.execute(post);
if (HttpStatus.SC_OK == response.getStatusLine().getStatusCode()) {
HttpEntity entitys = response.getEntity();
if (entitys != null) {
returnXml = EntityUtils.toString(entitys);
}
HttpPost post = new HttpPost(url);
List<NameValuePair> formparam = new ArrayList<NameValuePair>();
formparam.add(new BasicNameValuePair("para_xml", xmlStr));
UrlEncodedFormEntity entity;
entity = new UrlEncodedFormEntity(formparam, "utf-8");
post.setEntity(entity);
HttpResponse response = http.execute(post);
if (HttpStatus.SC_OK == response.getStatusLine().getStatusCode()) {
HttpEntity entitys = response.getEntity();
if (entitys != null) {
returnXml = EntityUtils.toString(entitys);
}
}
returnXml为发送成功或者失败对方返回的报文或者字符