小程序
小游戏
企业微信
微信支付
扫描小程序码分享
<refund_recv_accout><![CDATA[鏀粯鐢ㄦ埛闆堕挶閫歖]></refund_recv_accout>
由于乱码导致后台报错
[Fatal Error] :8:41: 元素类型 "refund_recv_accout" 必须由匹配的结束标记 "</refund_recv_accout>" 终止。
1 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
你自己解析编码不对
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
public Map<String, String> getRefundCallBackInfo(HttpServletRequest request) {
ServletInputStream in = null;
BufferedReader reader = null;
StringBuilder content = new StringBuilder();
try {
in = request.getInputStream();
reader = new BufferedReader(new InputStreamReader(in));
String itemStr = "";// 作为输出字符串的临时串,用于判断是否读取完毕
while (null != (itemStr = reader.readLine())) {
content.append(itemStr);
}
System.out.println("输出返回结果");
System.out.println(content.toString());
//先将返回结果转map
Map<String, String> map = WXPayUtil.xmlToMap(content.toString());
String rawKey = WechatConstant.MCH_KEY;
//取出 req_info 订单相关信息 进行解密
System.out.println("取出加密串");
System.out.println(map.get("req_info"));
String orderInfo = aesDecrypt(map.get("req_info"), rawKey);
System.out.println("加密串解密后的结果");
System.out.println(orderInfo);
String nresult = orderInfo.replace("root", "xml");
System.out.println("root转xml后的结果");
System.out.println(nresult);
Map<String, String> rstMap = WXPayUtil.xmlToMap(nresult);
return rstMap;
} catch (IOException e) {
System.out.println("*****************io异常*****************");
e.printStackTrace();
} catch (Exception e) {
System.out.println("*****************WXPayUtil.xmlToMap异常*****************");
} finally {
if (null != reader)
reader.close();
if (null != in)
in.close();
return null;
/**
InputStreamReader buffer = new
InputStreamReader(inputStream, "UTF-8");
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
你自己解析编码不对
public Map<String, String> getRefundCallBackInfo(HttpServletRequest request) {
ServletInputStream in = null;
BufferedReader reader = null;
StringBuilder content = new StringBuilder();
try {
in = request.getInputStream();
reader = new BufferedReader(new InputStreamReader(in));
String itemStr = "";// 作为输出字符串的临时串,用于判断是否读取完毕
while (null != (itemStr = reader.readLine())) {
content.append(itemStr);
}
System.out.println("输出返回结果");
System.out.println(content.toString());
//先将返回结果转map
Map<String, String> map = WXPayUtil.xmlToMap(content.toString());
String rawKey = WechatConstant.MCH_KEY;
//取出 req_info 订单相关信息 进行解密
System.out.println("取出加密串");
System.out.println(map.get("req_info"));
String orderInfo = aesDecrypt(map.get("req_info"), rawKey);
System.out.println("加密串解密后的结果");
System.out.println(orderInfo);
String nresult = orderInfo.replace("root", "xml");
System.out.println("root转xml后的结果");
System.out.println(nresult);
Map<String, String> rstMap = WXPayUtil.xmlToMap(nresult);
return rstMap;
} catch (IOException e) {
System.out.println("*****************io异常*****************");
e.printStackTrace();
} catch (Exception e) {
System.out.println("*****************WXPayUtil.xmlToMap异常*****************");
e.printStackTrace();
} finally {
try {
if (null != reader)
reader.close();
if (null != in)
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return null;
}
/**
InputStreamReader buffer = new
InputStreamReader(inputStream, "UTF-8");