请问楼主解决了吗
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; }
02-04遇到了同样的问题 题主解决了吗
微信退款接口报错日志信息[图片] 代码[图片] 很疑惑,希望有大佬可以解答疑惑
02-04