- java 微信退款 httpClient.execute(httpPost) 空指针 什么原因?
public static String postDataWithCert(String url, String xmlObj, String mchId, String certPath) { // 加载证书 try { initCert(mchId, certPath); } catch (Exception e) { e.printStackTrace(); } String result = null; HttpPost httpPost = new HttpPost(url); // 得指明使用UTF-8编码,否则到API服务器XML的中文不能被成功识别 StringEntity postEntity = new StringEntity(xmlObj, "UTF-8"); httpPost.addHeader("Content-Type", "text/xml"); httpPost.setEntity(postEntity); // 根据默认超时限制初始化requestConfig requestConfig = RequestConfig.custom().setSocketTimeout(socketTimeout).setConnectTimeout(connectTimeout).build(); // 设置请求器的配置 httpPost.setConfig(requestConfig); try { HttpResponse response = null; try { response = httpClient.execute(httpPost); } catch (IOException e) { e.printStackTrace(); } HttpEntity entity = response.getEntity(); try { result = EntityUtils.toString(entity, "UTF-8"); } catch (IOException e) { e.printStackTrace(); } } finally { httpPost.abort(); } return result; }
2021-10-15 - 物流助手生成运单失败 delivery_resultcode":20002 。返回的乱码是什么?
请求参数: {"add_source":0,"order_id":6222,"openid":"osJz74n7X9S996PW","delivery_id":"SF","biz_id":"57171","sender":{"name":"国际商贸中心","mobile":"13757180210","province":"浙江省","city":"杭州市","area":"拱墅区","address":"耀江"},"receiver":{"name":"张天天","mobile":"15241755210","province":"浙江省","city":"杭州市","area":"西湖区","address":"剑桥"},"cargo":{"count":1,"weight":1,"space_x":50,"space_y":50,"space_z":50,"detail_list":[{"name":"小灯泡","count":1}]},"shop":{"wxa_path":"/pages/order?id=6222","img_url":"https://cdn.kanhaowan.cn/funImg/2020-12-21T11:38:01.821.jpg","goods_name":"小灯泡","goods_count":1},"insured":{"use_insured":0,"insured_value":0},"service":{"service_type":0,"service_name":"顺丰速运"}} {"errcode":9300501,"errmsg":"delivery logic fail rid: 5fe06e84-1422d173-49f8904d","delivery_resultcode":20002,"delivery_resultmsg":"å¯ä»¶äººä¿¡æ¯å¼å¸¸","waybill_data":[]}
2020-12-21