Ruby confluence4r 示例
我找不到下载 confluence4r gem 的位置,并且当我下载时它不起作用:
gem install confluence4r
我在这里下载了一个: http://confluence.atlassian.com/display/DISC/Confluence4r
我可以登录,
server = Confluence::RPC.new("http://wiki/")
server.login("username","password")
但一旦我执行其他任何操作,它就会失败,
server.getSpace("key")
但请稍等..我第二次执行它并且它有效...
server.getSpace("key")
{"name"=>"key example", "homePage"=>"235325", "url"=>"http://wiki/display/key", "type"=>"global", "description"=>"description example", "key"=>"key"}
这是错误我在第一次尝试时收到了第二次尝试之前的信息:
EOFError: end of file reached
来自 /usr/lib/ruby/1.8/net/protocol.rb:135:in sysread' 来自 /usr/lib/ruby/1.8/net/protocol.rb:135:in
rbuf_fill' 来自 /usr/lib/ruby/1.8/timeout.rb:62:in timeout' 来自 /usr/lib/ruby/1.8/timeout.rb:93:in 超时' 来自 /usr/lib/ruby/1.8/net/protocol.rb:134:in
rbuf_fill' 来自 /usr/lib/ruby/1.8/net/protocol.rb:116:in
readuntil' 来自 /usr/lib/ruby/1.8/net/protocol.rb:126:in readline' 来自 /usr/lib/ruby/1.8/net/http.rb:2024:in
read_status_line' 来自 /usr/lib/ruby/1.8/net/http.rb:2013:in read_new' 来自 /usr/lib/ruby/1.8/net/http.rb:1050:in
request' 来自 /usr/lib/ruby/1.8/net/http.rb:992:in post2' 来自 /usr/lib/ruby/1.8/xmlrpc/client.rb:538:in
do_rpc' 来自 /usr/lib/ruby/1.8/xmlrpc/client.rb:420:in call2' 来自 /usr/lib/ruby/1.8/xmlrpc/client.rb:410:in
call' 来自 /usr/lib/ruby/1.8/xmlrpc/client.rb:617:in send' 来自 /usr/lib/ruby/1.8/xmlrpc/client.rb:617:in
method_missing' 来自 ./confluence4r.rb:35:in send' 来自 ./confluence4r.rb:35:in
method_missing'
有什么想法为什么我会收到错误吗?
编辑
好吧,我正在使用这个 gem 的一部分,它工作正常:
gem install confluencer
@api = Confluence::Client.new(:url => "http://wiki")
@api.login("username","password")
user = @api.getUser("username")
pp user
{"name"=>"username",
"url"=>"http://wiki/display/~username",
"fullname"=>"Full Name",
"email"=>"[email protected]"}
现在的问题是我无法添加任何东西,但我可以做 gets ,就是这样。它只是挂起,我相信会继续一遍又一遍地重试。也许我的 wiki 坏了..
create_user = @api.createUser("username","password","First LastName","[email protected]")
pp create_user
挂在 create_user 处
I cannot find where to download the confluence4r gem and it doesn't work when I do:
gem install confluence4r
I downloaded one here: http://confluence.atlassian.com/display/DISC/Confluence4r
I can login
server = Confluence::RPC.new("http://wiki/")
server.login("username","password")
but once I do anything else it fails
server.getSpace("key")
but wait.. I do it a 2nd time and it works...
server.getSpace("key")
{"name"=>"key example", "homePage"=>"235325", "url"=>"http://wiki/display/key", "type"=>"global", "description"=>"description example", "key"=>"key"}
Here's the error I receive on the first try before making it work on the 2nd try:
EOFError: end of file reached
from /usr/lib/ruby/1.8/net/protocol.rb:135:in sysread'
rbuf_fill'
from /usr/lib/ruby/1.8/net/protocol.rb:135:in
from /usr/lib/ruby/1.8/timeout.rb:62:in timeout'
timeout'
from /usr/lib/ruby/1.8/timeout.rb:93:in
from /usr/lib/ruby/1.8/net/protocol.rb:134:in rbuf_fill'
readuntil'
from /usr/lib/ruby/1.8/net/protocol.rb:116:in
from /usr/lib/ruby/1.8/net/protocol.rb:126:in readline'
read_status_line'
from /usr/lib/ruby/1.8/net/http.rb:2024:in
from /usr/lib/ruby/1.8/net/http.rb:2013:in read_new'
request'
from /usr/lib/ruby/1.8/net/http.rb:1050:in
from /usr/lib/ruby/1.8/net/http.rb:992:in post2'
do_rpc'
from /usr/lib/ruby/1.8/xmlrpc/client.rb:538:in
from /usr/lib/ruby/1.8/xmlrpc/client.rb:420:in call2'
call'
from /usr/lib/ruby/1.8/xmlrpc/client.rb:410:in
from /usr/lib/ruby/1.8/xmlrpc/client.rb:617:in send'
method_missing'
from /usr/lib/ruby/1.8/xmlrpc/client.rb:617:in
from ./confluence4r.rb:35:in send'
method_missing'
from ./confluence4r.rb:35:in
Any ideas why I'm getting the error?
EDIT
Okay, I'm using part of this gem instead and it works fine:
gem install confluencer
@api = Confluence::Client.new(:url => "http://wiki")
@api.login("username","password")
user = @api.getUser("username")
pp user
{"name"=>"username",
"url"=>"http://wiki/display/~username",
"fullname"=>"Full Name",
"email"=>"[email protected]"}
now the problem is I am unable to add anything, but I can do gets and thats it. It just hangs and I believe continues to do a retry over and over again. Maybe my wiki is broken..
create_user = @api.createUser("username","password","First LastName","[email protected]")
pp create_user
Hangs at create_user
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好吧,现在只使用 XMLRPC 客户端,一切正常,
我在 confluence 2.8 到 3.4 中对此进行了测试 - 哇,这太容易了!
Okay using just XMLRPC Client now and everything is working
I tested this in confluence 2.8 to 3.4 - wow that was soo much easier!
仅供参考,使用 Confluence4r.rb 代码在 Confluence v4 中失败。简单的解决方法是更改...
@conf = server.proxy("confluence1")
到
@conf = server.proxy("confluence2")
错误消息是:
confluence.rb:38:in
rescue in method_missing': java.lang.Exception: com.atlassian.confluence.rpc.RemoteException: 不支持的操作:无法再从此 API 检索 Wiki 格式的内容。请使用版本 2 API。版本 2 WSDL 可从以下位置获取:https://wiki.globalrelay。 net/rpc/soap-axis/confluenceservice-v2?wsdl. XML-RPC 请求应以“confluence2.”为前缀。 (运行时错误)
method_missing'来自 confluence.rb:31:in
FYI, using the confluence4r.rb code fails with Confluence v4. The simple fix is to change...
@conf = server.proxy("confluence1")
TO
@conf = server.proxy("confluence2")
The error message is:
confluence.rb:38:in
rescue in method_missing': java.lang.Exception: com.atlassian.confluence.rpc.RemoteException: Unsupported operation: Wiki formatted content can no longer be retrieved from this API. Please use the version 2 API. The version 2 WSDL is available at: https://wiki.globalrelay. net/rpc/soap-axis/confluenceservice-v2?wsdl. XML-RPC requests should prefixed with "confluence2.". (RuntimeError)
method_missing'from confluence.rb:31:in