简体   繁体   English

Ruby / Rails和Sharepoint Web服务

[英]Ruby/Rails and Sharepoint Web Services

I'm trying to consume Sharepoint webservices with ruby. 我正在尝试使用ruby来使用Sharepoint webservices。 I've basically given up trying to authenticate with NTLM and temporarily changed the Sharepoint server to use basic authentication. 我基本上放弃了尝试使用NTLM进行身份验证,并暂时更改了Sharepoint服务器以使用基本身份验证。 I've been successful getting a WSDL using soap4r but still cannot authenticate when attempting to use an actual web service call. 我已成功使用soap4r获取WSDL,但在尝试使用实际的Web服务调用时仍无法进行身份验证。

Has anyone had any experience getting ruby and Sharepoint to talk? 有没有人有过使用ruby和Sharepoint进行交流的经验?

I'm a total newb. 我是个新手。 But after a lot of time and with some help from more experience coders, I was able to get ruby working with Sharepoint 2010. The code below requires the 'ntlm/mechanize' gem. 但是经过很多时间并且在更多经验编码器的帮助下,我能够使用Sharepoint 2010获得ruby。下面的代码需要'ntlm / mechanize'宝石。

I've been able to download the sharepoint xml from lists specified (below) using the List GUID and the List View GUID. 我已经能够使用List GUID和List View GUID从指定的列表(下面)下载sharepoint xml。

Edit (May 23, 2011). 编辑(2011年5月23日)。 I should have pointed out that this code requires the ruby-ntlm gem. 我应该指出这段代码需要ruby-ntlm gem。 Here's a decent link that should help. 这是一个应该有用的好的链接。 This definitely works. 这绝对有效。

http://rubydoc.info/gems/ruby-ntlm/0.0.1/file/README.markdown http://rubydoc.info/gems/ruby-ntlm/0.0.1/file/README.markdown

agent = Mechanize.new
agent.auth('domain\\USERNAME', 'PASSWORD')
page = agent.get('http://URL/DIRECTORY/SITE/LIST/_vti_bin/owssvr.dll?Cmd=Display&List={LIST_GUID}&View={VIEW_GUID}&XMLDATA=TRUE')

NTLM is not supported by soap4r somehow, eventhough httpclient does support it. soap4r不支持NTLM,尽管httpclient确实支持它。

When enabling basic auth is not an option, you could consider using kerberos ie negotiate auth method. 当启用基本身份验证不是一个选项时,您可以考虑使用kerberos即协商auth方法。 Enabling this in sharepoint is a bit tricky, but basically comes down to doing the following on the commandline of the server: 在sharepoint中启用它有点棘手,但基本上归结为在服务器的命令行上执行以下操作:

cscript adsutil.vbs set w3svc/1/NTAuthenticationProviders "Negotiate,NTLM"

It might have some wird concequences it seems, check this forum post for more info . 它似乎有一些奇怪的后果, 请查看此论坛帖子了解更多信息 Finally you need to set the authentication in soap4r with auth= instead of basic_auth= i think. 最后你需要在soap4r中设置身份验证,使用auth =而不是basic_auth =我认为。

How did you change the SP server to use Basic Auth? 您是如何更改SP服务器以使用Basic Auth的? Did you just configure the site via IIS, or did you do it through SP Central Admin? 您是通过IIS配置网站,还是通过SP Central Admin进行配置?

If you're using SP 2007/MOSS, you need to change it via Central Admin; 如果您使用的是SP 2007 / MOSS,则需要通过Central Admin进行更改; if 2003, you need to do it via IIS. 如果2003年,您需要通过IIS来完成。

What error do you get when the request fails? 请求失败时会出现什么错误?

这可能没有用,但micorosoft只是发布了Sharepoint和WSRP的工具包, http://blogs.msdn.com/sharepoint/archive/2008/12/15/announcing-the-wsrp-toolkit-for-sharepoint.aspx ,因为RoR支持该标准,它可以提供更简单的数据获取方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM