您的位置:首页 > 移动开发 > 微信开发

微信测试公众号 url配置失败的问题

2016-12-22 15:55 267 查看
      微信测试的公众号:

     http://mp.weixin.qq.com/debug/cgi-bin/sandboxinfo?action=showinfo&t=sandbox/index

      下面是servlet代码:

       public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// 微信加密签名
String signature = request.getParameter("signature");
// 时间戳
String timestamp = request.getParameter("timestamp");
// 随机数
String nonce = request.getParameter("nonce");
// 随机字符串
String echostr = request.getParameter("echostr");

PrintWriter out = response.getWriter();
// 通过检验signature对请求进行校验,若校验成功则原样返回echostr,表示接入成功,否则接入失败
if (SignUtil.checkSignature(signature, timestamp, nonce)) {
out.print(echostr);
System.out.println("微信服务验证成功!"+echostr);
}else {
out.print(echostr);
System.out.println("微信服务验证失败!"+echostr);
}
// out.flush();
//out.close();
//out = null;
}             其实就是将微信发过了的随机码echostr返回
            

          内网穿透工具用的nat123

          按照文档各种试,都是提示配置失败,虽然servlet已经收到了微信发来的随机码,并且也给了返回,但是依然配置失败。搞得我都开始怀疑自己的人生了!!! ,现在互联网真玩不转。太难弄了。

         难道是nat123的服务器在国外,响应速度很慢??

         

        后来看微信开发文档上说url的端口是80端口,nat123发布的外网地址已经是80端口了,后来将内网的服务地址也改成80端口。配置成功!!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐