public synchronized static String getBodyPost(String url, Map parms) {
       // byte[] body = null;
       String resultstr = null;
       // 构造HttpClient的实例
       HttpClient httpClient = new HttpClient();
       // 创建POST方法的 实例
       PostMethod postMethod = new PostMethod(url);
       // 填入各个表单域的 值
       NameValuePair[] data = new NameValuePair[parms.keySet().size()];
       Iterator it = parms.entrySet().iterator();
       int i = 0;
       while (it.hasNext()) {
           Map.Entry entry = (Map.Entry) it.next();
           Object key = entry.getKey();
           Object value = entry.getValue();
           data[i] = new NameValuePair(key.toString(), value.toString());
           i++;
       }
       // 将表单的 值放入postMethod中
       postMethod.setRequestBody(data);
       try {
           // 执行postMethod
           int statusCode = httpClient.executeMethod(postMethod);// httpclient对于要求接受后继服务的请求，等待返回
           // 象post和put等不能自动处理转发
           // 301或者302
           if (statusCode == HttpStatus.SC_MOVED_PERMANENTLY
                   || statusCode == HttpStatus.SC_MOVED_TEMPORARILY) {
               // 从 头中取出转向的地址
               Header locationHeader = postMethod
                       .getResponseHeader("location");
               String location = null;
               if (locationHeader != null) {
                   location = locationHeader.getValue();
                   System.out.println("The page was redirected to:" + location);
               } else {
                   System.out.println("Location field value is null");
               }
           }
           // 第一张接收返回信息方式
           // body = postMethod.getResponseBody();
           resultstr = new String(postMethod.getResponseBodyAsString()
                   .getBytes(), "UTF-8");

           /**
            * 第二张接收返回信息方式 String newStr = new
            * String(postMethod.getResponseBodyAsString().getBytes(), "UTF-8"
            * ); System.out.println(newStr);
            */

       } catch (Exception e) {

           e.printStackTrace();
       } finally {
           postMethod.releaseConnection();
       }
       return resultstr;
   }