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

      微信测试的公众号:

     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端口。配置成功!!

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值