https://pubsubhubbub.appspot.com/subscribe 空响应
我有一个连接到 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该检查的第一件事是响应的 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.