小程序接入,消息推送,xml格式时,xml转WxMaMessage 出错
---- Debugging information ---- message : Explicit selected converter cannot handle type item-type : java.lang.Integer converter-type : com.thoughtworks.xstream.converters.SingleValueConverterWrapper class : cn.binarywang.wx.miniapp.bean.WxMaMessage required-type : cn.binarywang.wx.miniapp.bean.WxMaMessage converter-type[1] : com.thoughtworks.xstream.converters.reflection.ReflectionConverter line number : 3 version : 1.4.9 -------------------------------] with root cause
String plainText = new WxMaCryptUtils(wxMaConfig).decrypt(msgSignature, timestamp, nonce, encryptedXml);
<xml><ToUserName><![CDATA[gh_13c7134d8566]]></ToUserName>
<FromUserName><![CDATA[oE10C0djCyTsYuCo9V55n8Ud3njQ]]></FromUserName>
<CreateTime>1529568609</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[user_enter_tempsession]]></Event>
<SessionFrom><![CDATA[wxapp]]></SessionFrom>
</xml>
不明白你为什么要这么写代码?请先参考下demo
我是按demo写的,代码这样写出来,是为了把解密后的信息截图出来。
inMessage = WxMaMessage.fromEncryptedXml(requestBody, this.wxMaService.getWxMaConfig(),
timestamp, nonce, msgSignature);
好像是xml转bean出错了。
你是否使用json格式的测试过? 不建议使用xml,从目前形势看,xml问题很多,比如微信支付最近吵得沸沸扬扬的XXE漏洞就是个很大的安全隐患。 后期我在抽空验证下xml的格式解析是否有问题。