https://pubsubhubbub.appspot.com/subscribe 空响应

发布于 2024-12-22 04:45:15 字数 1817 浏览 4 评论 0原文

我有一个连接到 https://pubsubhubbub.appspot.com/subscribe 的订阅者客户端,我将参数放在下面

https://pubsubhubbub.appspot.com/subscribe
hub.topic    http://...../lastupby
hub.callback http://localhost:8080/Subscription/subscription/subscribe
hub.mode subscribe

但我得到空响应我不明白问题是什么谢谢你的帮助

HttpPost httppost = new HttpPost(hub);  
                List<NameValuePair> nvps = new ArrayList<NameValuePair>();
                nvps.add(new BasicNameValuePair("hub.callback", callbackUrl));
                nvps.add(new BasicNameValuePair("hub.mode", "subscribe"));
                nvps.add(new BasicNameValuePair("hub.topic", topic_url));
                nvps.add(new BasicNameValuePair("hub.verify", "sync"));
                if (lease_seconds != null)
                    nvps.add(new BasicNameValuePair("hub.lease_seconds", lease_seconds));
                //For future https implementation
                //if ((secret !=null) && (secret.getBytes("utf8").length < 200))
                //  nvps.add(new BasicNameValuePair("hub.hub.secret", secret));
                if (verifytoken !=null)
                    nvps.add(new BasicNameValuePair("hub.verify_token", verifytoken));

                webserver.addAction("subscribe",topic_url, verifytoken);

                httppost.setEntity(new UrlEncodedFormEntity(nvps));
                httppost.setHeader("Content-type", "application/x-www-form-urlencoded");
                httppost.setHeader("User-agent", "RSS pubsubhubbub 0.3");

                //create the thread and start it running
                GetThread thread = new GetThread(httpClient, httppost);
                thread.start();
                thread.join();

谢谢

I have a subscriber client that connects to https://pubsubhubbub.appspot.com/subscribe I put parameter below

https://pubsubhubbub.appspot.com/subscribe
hub.topic    http://...../lastupby
hub.callback http://localhost:8080/Subscription/subscription/subscribe
hub.mode subscribe

but I got null response I can't understand what is the problem thank you for your help

HttpPost httppost = new HttpPost(hub);  
                List<NameValuePair> nvps = new ArrayList<NameValuePair>();
                nvps.add(new BasicNameValuePair("hub.callback", callbackUrl));
                nvps.add(new BasicNameValuePair("hub.mode", "subscribe"));
                nvps.add(new BasicNameValuePair("hub.topic", topic_url));
                nvps.add(new BasicNameValuePair("hub.verify", "sync"));
                if (lease_seconds != null)
                    nvps.add(new BasicNameValuePair("hub.lease_seconds", lease_seconds));
                //For future https implementation
                //if ((secret !=null) && (secret.getBytes("utf8").length < 200))
                //  nvps.add(new BasicNameValuePair("hub.hub.secret", secret));
                if (verifytoken !=null)
                    nvps.add(new BasicNameValuePair("hub.verify_token", verifytoken));

                webserver.addAction("subscribe",topic_url, verifytoken);

                httppost.setEntity(new UrlEncodedFormEntity(nvps));
                httppost.setHeader("Content-type", "application/x-www-form-urlencoded");
                httppost.setHeader("User-agent", "RSS pubsubhubbub 0.3");

                //create the thread and start it running
                GetThread thread = new GetThread(httpClient, httppost);
                thread.start();
                thread.join();

thank you

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

烟凡古楼 2024-12-29 04:45:15

您应该检查的第一件事是响应的 HTTP 状态,然后检查正文本身,因为可能包括您做错了什么。

另外,根据您的示例,我几乎可以肯定问题出在您的回调网址上。当您向中心发送订阅请求时,中心需要与您确认您是否需要此订阅。然后,它向您的回调 URL 发送请求(检查规范中的意图验证部分)。由于您的回调确实位于防火墙后面,因此集线器将永远无法到达它。

The first thing you should check is the HTTP status of the response, and then, check the body itself, as may include what you're doing wrong.

Also, based on your example, I am almost certain the issue is with your callback url. When you send a subscription request to the hub, the hub needs to check back with you that you want this subscription. It then sends a request to your callback url (check the verification of intent section in the spec). Since your callback is indeed behind the firewall, the hub will never be able to reach it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文