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();

谢谢你

4

1 回答 1

1

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

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

于 2011-12-20T10:30:22.837 回答