This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Web Services and the fly likes REST and Sharepoint 2010 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "REST and Sharepoint 2010" Watch "REST and Sharepoint 2010" New topic

REST and Sharepoint 2010

Brian Mulholland
Ranch Hand

Joined: Mar 12, 2009
Posts: 61
I know this isn't the ideal place for this, but I am writing a REST client to talk to Sharepoint 2010's REST API (ListData.svc). The URL works when simply typed into the address bar of IE and returns XML of the collections. But in Firefox, Poster, RESTClient, and my code (using Jersey's rest client) I get 400 Bad Request. The URL is identical, and running a GET being typed into the address bar of IE. I tried sending accept headers asking for text/xml and not doing so. 400 every time.

Does anyone have any idea what gives?
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
I don't know "what gives", but I have a few hints that may help you solve the issue:
- A nice, and free, test tool for both SOAP and RESTful web services is soapUI:
- Use a packet sniffer, like for instance WireShark, to examine the successful requests from your browser.
As an additional exercise, compare with the unsuccessful requests. There is bound to be a difference.
Best wishes!

My free books and tutorials:
Brian Mulholland
Ranch Hand

Joined: Mar 12, 2009
Posts: 61
Reasonable suggestions all. We eventually found this which advised us to switch away from anonymous authentication. Once done, it works in everything! Except my code. But at least now that all browsers, Poster and RESTClient, I can now at least know the problem is in my code.

I suspect that the new problem is differences in how I am presenting authentication credentials. I am using Jersey's rest client.

A simplistic test, but this ought to work, yes? That is how I pass my basic authentication credentials, right?
Brian Mulholland
Ranch Hand

Joined: Mar 12, 2009
Posts: 61
Found some articles saying that HTTPBasicAuthFilter used to have a bug that made it not work, but I am using 1.10, and they claim it should be fixed.
jQuery in Action, 2nd edition
subject: REST and Sharepoint 2010
Similar Threads
How can i hide the address bar?
Page Redirection in a JSP
any java code for - window.location.href
Combine JAXB + JPA?
The requested resource () is not available