微信測試公眾號 url配置失敗的問題
阿新 • • 發佈:2019-01-26
微信測試的公眾號:
http://mp.weixin.qq.com/debug/cgi-bin/sandboxinfo?action=showinfo&t=sandbox/index
下面是servlet程式碼:
其實就是將微信發過了的隨機碼echostr返回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; }
內網穿透工具用的nat123
按照文件各種試,都是提示配置失敗,雖然servlet已經收到了微信發來的隨機碼,並且也給了返回,但是依然配置失敗。搞得我都開始懷疑自己的人生了!!! ,現在網際網路真玩不轉。太難弄了。
難道是nat123的伺服器在國外,響應速度很慢??
後來看微信開發文件上說url的埠是80埠,nat123釋出的外網地址已經是80埠了,後來將內網的服務地址也改成80埠。配置成功!!