public static void main(String[] args) throws HttpException, IOException {
System.out.println("Response body: ");
//File input = new File("d://selectProtocol.xml");
File input = new File("d://insurance.xml");
PostMethod post = new PostMethod("http://localhost:7001/bib-pafa-esb/remoting/pafaESBRequest");
// 设置请求的内容直接从文件中读取
FileInputStream fi = new FileInputStream(input);
post.setRequestBody(new FileInputStream(input));
if (input.length() < Integer.MAX_VALUE)
post.setRequestContentLength(input.length());
else post.setRequestContentLength(EntityEnclosingMethod.CONTENT_LENGTH_CHUNKED);
// 指定请求内容的类型
post.setRequestHeader("Content-type", "text/xml; charset=GBK");
HttpClient httpclient = new HttpClient();
int result = httpclient.executeMethod(post);
System.out.println("Response status code: " + result);
System.out.println("Response body: ");
System.out.println(post.getResponseBodyAsString());
post.releaseConnection();
}