6

I'm trying to consume Sharepoint webservices with ruby. I've basically given up trying to authenticate with NTLM and temporarily changed the Sharepoint server to use basic authentication. I've been successful getting a WSDL using soap4r but still cannot authenticate when attempting to use an actual web service call.

Has anyone had any experience getting ruby and Sharepoint to talk?

1
  • 2
    Please don't put a "solved" in the headline, but mark an answer as accepted and vote it up (as you did). That's the formal way here, to mark a problem solved. Thank you. Commented Mar 15, 2012 at 19:52

4 Answers 4

4

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.

I've been able to download the sharepoint xml from lists specified (below) using the List GUID and the List View GUID.

Edit (May 23, 2011). I should have pointed out that this code requires the 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

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')
Sign up to request clarification or add additional context in comments.

Comments

1

How did you change the SP server to use Basic Auth? Did you just configure the site via IIS, or did you do it through SP Central Admin?

If you're using SP 2007/MOSS, you need to change it via Central Admin; if 2003, you need to do it via IIS.

What error do you get when the request fails?

Comments

1

NTLM is not supported by soap4r somehow, eventhough httpclient does support it.

When enabling basic auth is not an option, you could consider using kerberos i.e. negotiate auth method. Enabling this in sharepoint is a bit tricky, but basically comes down to doing the following on the commandline of the server:

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.

Comments

0

This may not help but micorosoft just release the toolkit for Sharepoint and WSRP, http://blogs.msdn.com/sharepoint/archive/2008/12/15/announcing-the-wsrp-toolkit-for-sharepoint.aspx, since RoR supports that standard it may provide an easier method of getting the data.

1 Comment

Really? I can't find any evidence of Rails supporting WSRP.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.