This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one 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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "REST and Sharepoint 2010" Watch "REST and Sharepoint 2010" New topic
Author

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
    
    1
Hi!
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: http://www.soapui.org
- 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: http://www.slideshare.net/krizsan
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.
 
Consider Paul's rocket mass heater.
 
subject: REST and Sharepoint 2010