If you haven't already, have a look at the client section of this article here:
http://msdn.microsoft.com/en-us/magazine/cc748663.aspx If I skim that correctly ;-) it sounds like the ado.net data services client library speaks REST... -----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Jeff Sent: Friday, September 19, 2008 11:30 AM To: Ruby on Rails: Talk Subject: [Rails] Re: Non-Ruby REST client for Ruby REST server On Sep 19, 12:22 pm, Roberto <[EMAIL PROTECTED]> wrote: > Hi, > > I have a Rails 2 app and I wand to provide an API for 3rd party > applications written on any language the customer uses. > > My thoughts are that the best way of providing it is by taking > advantage of rails RESTfulness and let them perform CRUD actions on my > data through it. But I don't seem to find many information on how to > achieve this. Definitely. Your controller can provide an out-of-the-box API by examining the HTTP accept header and returning XML. Rails wraps this up for you automatically if you use the respond_to method in your controller: def index @things = Thing.find(:all) respond_to do |format| format.html # render template format.xml { render :xml => @things.to_xml } end end This example is a bit simplistic but demonstrates the principle of how you can return XML instead of HTML based on the http header. > I first want to develop .NET clients (or web service consumers) > because must of our customers use .NET. I did some prototypes and > could retrieve XML data, but I don't seem to find a way of doing > inserts, updates and deletes. > What I get is a 422 http error from the rails server and I assume has > something to do with the Header. > Where can I find more information about this. More specificlly about > what the server is expecting to receive in the header and the message. > Make sure you're setting the accept and content-type headers correctly to "text/xml" or "application/xml". That's the clue Rails needs to trigger the right action in your respond_to block. We actually have a chapter on doing this exact thing in our upcoming book, Rails for .NET Developers (http://pragprog.com/titles/cerailn). > > Also, if someone has experience on WCF and can point me out where to > find more valuable info it will be appreciated. > > Java examples will work as well. You may find our upcoming class helpful, as we touch on RESTful web service creation in Rails: http://www.purpleworkshops.com/workshops/rest-and-web-services (you can use discount code "PWRRGG" for 10% off). Hope this helps a bit? Jeff --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

