HttpClient client = new HttpClient()的依赖

<dependency>
    <groupId>commons-httpclient</groupId>
    <artifactId>commons-httpclient</artifactId>
    <version>3.1</version>
</dependency>
String SendUrl = "https://nnfpdev.jss.com.cn/shop/buyer/allow/cxfKp/cxfServerKpOrderSync.action";
        String order = "{\"identity\":\"93363DCC6064869708F1F3C72A0CE72A713A9D425CD50CDE\","
                +
                "\"order\":{\"orderno\":\"No.12016101300002\",\"saletaxnum\":\"339901999999142\","
                + "\"saleaddress\":\"&*杭州市中河中路 222 号平海国际商务大厦 5 楼\",\"salephone\":\"0571-87022168\","
                + "\"saleaccount\":\"东亚银行杭州分行 131001088303400\",\"clerk\":\"袁 牧庆\",\"payee\":\"络克\","
                + "\"checker\":\"朱燕\",\"invoicedate\":\"2016-06-15 01:51:41\","
                + "\"kptype\":\"1\",\"address\":\"\","
                +
                "\"phone\":\"13185029520\",\"taxnum\":\"110101TRDX8RQU1\",\"buyername\":\" 个 人\",\"account\":\"\","
                + "\"fpdm\":\"\",\"fphm\":\"\",\"message\":\"开票机号为02 请前往诺诺网 (www.jss.com.cn)查询发票详情\","
                + "\"qdbz\":\"1\",\"qdxmmc\":\"1111\","
                +
                "\"detail\":[{\"goodsname\":\"1\",\"spec\":\"1\",\"unit\":\"1\",\"hsbz\":\"1\",\"num\":\"1\","
                + "\"price\":\"19.99\","
                +
                "\"spbm\":\"1090511030000000000\",\"fphxz\":\"0\",\"yhzcbs\":\"0\",\"zzstsgl\":\"222222\",\"l slbs\":\"\","
                + "\"taxrate\":\"0.16\"},"
                + "{\"goodsname\":\"2\",\"spec\":\"2\","
                + "\"unit\":\"2\",\"hsbz\":\"1\",\"num\":\"1\",\"price\":\"20\","
                + "\"spbm\":\"1090511030000000000\",\"fphxz\":\"0\",\"yhzcbs\":\"0\",\"zzstsgl\":\"222222\",\"l slbs\":\"\","
                + "\"taxrate\":\"0.16\"}]}}";
//        order = DESDZFP.encrypt(order);
        HttpClient httpclient = null;
        PostMethod post = null;
        try {
            httpclient = new HttpClient();
            post = new PostMethod(SendUrl);
            //设置编码方式
            post.getParams().setParameter(HttpMethodParams.HTTP_CONTENT_CHARSET, "UTF-8");
            //添加参数
            post.addParameter("order", order);
           //执行
            httpclient.executeMethod(post);
            //接口返回信息
            String info = new String(post.getResponseBody(), "UTF-8");
            System.out.println(info);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            //关闭连接,释放资源
            post.releaseConnection();
            ((SimpleHttpConnectionManager) httpclient.getHttpConnectionManager()).shutdown();
        }

这里面的HttpClient client = new HttpClient()和PostMethod post=new PostMethod(SendUrl)所引用的依赖都是

<dependency>

<groupId>commons-httpclient</groupId>

<artifactId>commons-httpclient</artifactId>

<version>3.1</version>

</dependency>

而不是阿帕奇的那个

评论 13
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值