Ruby confluence4r 示例

发布于 2024-09-30 20:29:41 字数 2737 浏览 11 评论 0原文

我找不到下载 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:inrbuf_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:inreaduntil' 来自 /usr/lib/ruby/1.8/net/protocol.rb:126:in readline' 来自 /usr/lib/ruby/1.8/net/http.rb:2024:inread_status_line' 来自 /usr/lib/ruby/1.8/net/http.rb:2013:in read_new' 来自 /usr/lib/ruby/1.8/net/http.rb:1050:inrequest' 来自 /usr/lib/ruby/1.8/net/http.rb:992:in post2' 来自 /usr/lib/ruby/1.8/xmlrpc/client.rb:538:indo_rpc' 来自 /usr/lib/ruby/1.8/xmlrpc/client.rb:420:in call2' 来自 /usr/lib/ruby/1.8/xmlrpc/client.rb:410:incall' 来自 /usr/lib/ruby/1.8/xmlrpc/client.rb:617:in send' 来自 /usr/lib/ruby/1.8/xmlrpc/client.rb:617:inmethod_missing' 来自 ./confluence4r.rb:35:in send' 来自 ./confluence4r.rb:35:inmethod_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'
from /usr/lib/ruby/1.8/net/protocol.rb:135:in
rbuf_fill'
from /usr/lib/ruby/1.8/timeout.rb:62:in timeout'
from /usr/lib/ruby/1.8/timeout.rb:93:in
timeout'
from /usr/lib/ruby/1.8/net/protocol.rb:134:in rbuf_fill'
from /usr/lib/ruby/1.8/net/protocol.rb:116:in
readuntil'
from /usr/lib/ruby/1.8/net/protocol.rb:126:in readline'
from /usr/lib/ruby/1.8/net/http.rb:2024:in
read_status_line'
from /usr/lib/ruby/1.8/net/http.rb:2013:in read_new'
from /usr/lib/ruby/1.8/net/http.rb:1050:in
request'
from /usr/lib/ruby/1.8/net/http.rb:992:in post2'
from /usr/lib/ruby/1.8/xmlrpc/client.rb:538:in
do_rpc'
from /usr/lib/ruby/1.8/xmlrpc/client.rb:420:in call2'
from /usr/lib/ruby/1.8/xmlrpc/client.rb:410:in
call'
from /usr/lib/ruby/1.8/xmlrpc/client.rb:617:in send'
from /usr/lib/ruby/1.8/xmlrpc/client.rb:617:in
method_missing'
from ./confluence4r.rb:35:in send'
from ./confluence4r.rb:35:in
method_missing'

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 技术交流群。

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

发布评论

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

评论(2

绝影如岚 2024-10-07 20:29:42

好吧,现在只使用 XMLRPC 客户端,一切正常,

require 'xmlrpc/client'

confluence = XMLRPC::Client.new2("http://wiki/rpc/xmlrpc").proxy("confluence1")
token = confluence.login("username", "password")

user = {
"name" => user_name,
"fullname" => full_name,
"email" => email
}

confluence.addUser(token, user, user_name)

我在 confluence 2.8 到 3.4 中对此进行了测试 - 哇,这太容易了!

Okay using just XMLRPC Client now and everything is working

require 'xmlrpc/client'

confluence = XMLRPC::Client.new2("http://wiki/rpc/xmlrpc").proxy("confluence1")
token = confluence.login("username", "password")

user = {
"name" => user_name,
"fullname" => full_name,
"email" => email
}

confluence.addUser(token, user, user_name)

I tested this in confluence 2.8 to 3.4 - wow that was soo much easier!

停顿的约定 2024-10-07 20:29:42

仅供参考,使用 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.”为前缀。 (运行时错误)
来自 confluence.rb:31:in
method_missing'

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)
from confluence.rb:31:in
method_missing'

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