首页 > 响应了微信POST请求,但却收不到数据。

响应了微信POST请求,但却收不到数据。

signature 验证通过,但是接受不到响应数据,以下是响应的部分。

DEBUG - Written [<xml>
  <ToUserName><![CDATA[oc1nGsxF1-aNJi56-KdgLq6gDS1o]]></ToUserName>
  <FromUserName><![CDATA[wx9bf6a481c573dee3]]></FromUserName>
  <CreateTime><![CDATA[1417326674703]]></CreateTime>
  <MsgType><![CDATA[text]]></MsgType>
  <Content><![CDATA[请回复命令进行操作...
    .......还有其他信息
●<a href="http://wodinowspring.duapp.com/pages/userhelp.html">点击这里查看游戏帮助</a>]]></Content>
</xml>] as "application/xml;charset=UTF-8" using [org.springframework.http.converter.StringHttpMessageConverter@7d253fa7]

使用的Spring代码是:

@RequestMapping(value="/wodi", method = RequestMethod.POST,produces="application/xml;charset=UTF-8")
@ResponseBody
public String response(InputStream is){
    String respMsg = Reply.ENCOUNTER_ERROR;// 出现异常时候的初始命令,可不设
    try {
        respMsg = commandService.generateResponseXML(is);
    } catch (IOException | DocumentException e) {
        LogUtil.error("IO or DocumentExcetion occurs from generateResponseXML when parsing xml\n");
    }
    return respMsg;
}

问题解决,以上的FromUserName 是开发者ID,而不是应用ID

【热门文章】
【热门文章】