无法在Facebook上创建Webhook应用程序,因为出现错误“无法验证提供的URL”。
- The url given for callback is working fine from browser with https port 443
The Servlet code to recieve the post call from webhook as below
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("**************Entering Callback Servlet**************************"); Map<String, String[]> parametersMap = request.getParameterMap(); if (parametersMap.size() > 0) { if (request.getParameter("hub.mode").equals("streamInit")) { System.out.println("Verify Token: " + request.getParameter("hub.verify_token")); System.out.println("Challenge number:" + request.getParameter("hub.challenge")); String responseToClient = request.getParameter("hub.challenge"); response.setStatus(HttpServletResponse.SC_OK); response.getWriter().write(responseToClient); response.getWriter().flush(); response.getWriter().close(); response.getWriter().append("Fetch-Mode").append(request.getParameter("hub.mode")); response.getWriter().append("App Verify Token:").append(request.getParameter("hub.verify_token")); response.getWriter().append("App Challenge No").append(request.getParameter("hub.challenge")); System.out.println("**************Callback Successful**************************"); } //response.getWriter().append("Served at: ").append(request.getContextPath()); }else{ System.out.println("**************Not an Facebook POST**************************"); } System.out.println("**************Exiting Callback Servlet**************************"); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); }
0.0.0.0
,对吧?你不能使用本地IP地址,它必须是公共可达的URL。(而且我不确定IP地址是否有效 - 在大多数情况下,Facebook希望具有主机名的URL。) - CBroe