/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  org.apache.commons.httpclient.Header
 *  org.apache.commons.httpclient.HttpClient
 *  org.apache.commons.httpclient.HttpMethod
 *  org.apache.commons.httpclient.methods.PostMethod
 *  org.apache.commons.logging.Log
 *  org.apache.commons.logging.LogFactory
 */
package com.hst.taxService.service.imp;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.httpclient.Header;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpMethod;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class TestFpdk {
    public static Log _logger = LogFactory.getLog(TestFpdk.class);

    public static void main(String[] args) {
        String url = "http://127.0.0.1:8088/taxService/service/taxCommon!doZcjd";
        String charset = "GBK";
        HashMap<String, String> params = new HashMap<String, String>();
        params.put("domain.ywId", "wx.BswdGetBsdtList");
        params.put("domain.ParmJson", "{\"uid\":\"15068766863\",\"bid\":\"wx.BswdGetBsdtList\",\"ver\":\"1.0\",\"swjgDm\":\"13301000000\"}");
        params.put("domain.ywId", "wx.SjqhGetSjqhhm");
        params.put("domain.ParmJson", "{\"uid\":\"ea16224e251\",\"sfzhm\":\"3424271298706244021\",\"userID\":\"ea16224e50\",\"sid\":\"\",\"ywflbm\":\"01\",\"kz\":\"\",\"nsrsbh\":\"\",\"lbDm\":\"2\",\"ver\":\"1.0\",\"ywflmc\":\"\",\"bsdtDjxh\":\"1330000116\",\"bid\":\"wx.SjqhGetSjqhhm\"}");
        params.put("domain.ywId", "wx.SjqhGetJhxtYwfl");
        params.put("domain.ParmJson", "{\"uid\":\"15068766863\",\"bid\":\"wx.SjqhGetJhxtYwfl\",\"ver\":\"1.0\",\"bsdtDjxh\":\"1330000116\"}");
        String str = TestFpdk.doPost(url, params, charset, true);
        System.out.println(str);
    }

    public static String doPost(String url, Map<String, String> params, String charset, boolean pretty) {
        StringBuffer response;
        block10: {
            response = new StringBuffer();
            HttpClient client = new HttpClient();
            PostMethod post = new PostMethod(url);
            post.setRequestHeader(new Header("Content-type", "application/x-www-form-urlencoded;charset=GBK"));
            post.setRequestHeader(new Header("User-Agent", "Mozilla/5.0 /Windows; U; Windows NT 4.1; de; rv:1.9.1.5) Gecko/20091102 Firefox/3.0"));
            if (params != null) {
                for (Map.Entry<String, String> entry : params.entrySet()) {
                    post.setParameter(entry.getKey(), entry.getValue());
                }
            }
            try {
                try {
                    client.executeMethod((HttpMethod)post);
                    if (post.getStatusCode() == 200) {
                        String line;
                        BufferedReader reader = new BufferedReader(new InputStreamReader(post.getResponseBodyAsStream(), charset));
                        while ((line = reader.readLine()) != null) {
                            if (pretty) {
                                response.append(line).append(System.getProperty("line.separator"));
                                continue;
                            }
                            response.append(line);
                        }
                        reader.close();
                    }
                }
                catch (IOException e) {
                    _logger.error((Object)("\u6267\u884cHTTP Post\u8bf7\u6c42" + url + "\u65f6\uff0c\u53d1\u751f\u5f02\u5e38\uff01"), (Throwable)e);
                    post.releaseConnection();
                    break block10;
                }
            }
            catch (Throwable throwable) {
                post.releaseConnection();
                throw throwable;
            }
            post.releaseConnection();
        }
        return response.toString();
    }
}
