package com.thinkgem.jeesite.modules.pay.pinganbank;

import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.methods.StringRequestEntity;

public class PingAnBankService {

    public static void main(String args[]) throws Exception {

//		String url = "http://127.0.0.1:7072/";
//		String xml = "";
//		HttpUtil.postXml(url,xml);

        String res = "A0010101020020108050000801500000000001074001  123450120120620151810201206180000011037  000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000<?xml version=\"1.0\" encoding=\"GBK\"?>" +
                "<Result>" +
                "<BatchNo>201603260001</BatchNo>" +
                "<AcctNo>11014891204004</AcctNo>" +
                "<BusiType>00000</BusiType>" +
                "<CorpId>E000070730</CorpId>" +
                "<TotalNum>2</TotalNum>" +
                "<TotalAmount>50</TotalAmount>" +
                "<FileName>req_20160326_0001.txt</FileName>" +
                "<RandomPwd>mem12Xv0vc+chHRyXHT8HWlcXVQTHZWQ</RandomPwd>" +
                "<HashData></HashData>" +
                "<SignData></SignData>" +
                "<Remark>备注信息</Remark>" +
                "</Result>";

        PostMethod postMethod = new PostMethod(
                "http://127.0.0.1:7072");

        postMethod.setRequestEntity(new StringRequestEntity(
                res, "text/html", "GBK"));
        postMethod.setRequestHeader("Content-Type",
                "text/xml; charset=GBK");

        HttpClient httpClient = new HttpClient();
        int resultint = httpClient.executeMethod(postMethod);
        res = new String(postMethod.getResponseBody(),"GBK");
        System.out.println("http response:" + res);
        postMethod.releaseConnection();
        System.out.println(resultint);

    }
}
