try {
HttpPost httpost = new HttpPost("http://webservice.webxml.com.cn/WebServices/WeatherWS.asmx");
StringEntity myEntity = new StringEntity(FileUtils.readFileToString(new File("a.txt")));
httpost.setHeader("SOAPAction", "http://WebXml.com.cn/getRegionCountry");
httpost.setHeader("Content-Type", "text/xml; charset=utf-8");
httpost.setEntity(myEntity);
for (Header string : httpost.getAllHeaders()) {
System.out.println(string.getName()+":"+string.getValue());
}
System.out.println("-------------------------");
HttpResponse response = httpclient.execute(httpost);
HttpEntity entity = response.getEntity();
String resString = EntityUtils.toString(entity);
for (Header string : response.getAllHeaders()) {
System.out.println(string.getName()+":"+string.getValue());
}
System.out.println("response content:" + resString);
} finally {
httpclient.getConnectionManager().shutdown();
}