Very simple rest webservice on ruby on rails
I am trying to implement very-very simple webservice to practice with my iphone application, for example storing geolocation data and retrieving it from web. I started with Ruby on Rails, read some books and install it on my pc.
I install Ruby installer for Windows, then
gem update --system
gem source -a http://gemcutter.org
gem install rails
*then I install sqlite3*
gem install sqlite3-ruby
*and I even install webservice gem*
All working fine and I wrote some simple applications and can access it all on http://localhost:3000. Then I saw this video - h开发者_如何学运维ttp://www.youtube.com/watch?v=J6r_l3cAS9s in which you can see simple restful webservice. As I understand there are no any additional configuration to apps to be a simple webservice. I did exactly what show in this movie and install Fiddler and another rest test client to test this service. I cant get any xml from my app. Fiddler get me my html from http://localhost:3000/words and this rest client http://code.google.com/p/rest-client/ get my again my html page with content type text/html. How can I get XML to start working with this app as webservice?
I use Rails 3
yes, ruby on rails has RESTful service by default. My error was trying to access url http://localhost:3000/words in rest client. If I connect to http://localhost:3000/words.xml instead I immediately get access to my app via XML.
It shouldn't be difficult to get xml response. You might want to peak into TodoAPI and the client for this app as TodoAPIClient. The client uses HTTParty. You may get the response using Curl for terminal.
精彩评论