On 7/9/07, Michael W. <mswatson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> [snip]
> Note that I''ve read that ActionWebService is being removed from
the
> Rails core in the next release of Rails, but is supposed to still be
> available as a plugin or somesuch.
> [/snip]
One of the key reasons this is happening is because RESTful web
services are becoming the most popular way to do "web services" in
Rails. A good starting point is a white paper "RESTful Rails
Development"[1], and a recent O''Reilly book "RESTful Web
Services"[2]
covers this territory as well, although it covers a lot more than just
Rails implementations of web services (servers or clients).
If you want to follow where Rails itself is going in this regard,
start googling for "ActiveResource", which will be a component of
Rails 2.0 that (from the viewpoint of your application) acts a lot
like ActiveRecord, but is in reality a wrapper for a remote web
service, which could be implemented in Rails or anything else.
Or, if you want to just experiment a bit with your own applications,
add something like this to the "index" method of one of your existing
application''s controllers:
def index
@customers = Customer.find(:all) # or whatever to select the relevant rows
respond_to do |format|
format.html
format.xml { render :xml = @customers.to_xml }
end
Now, a URI like "/customers" will return the usual HTML page, but
"/customers.xml" will return the underlying data in XML format. You
can extend this concept to support (for example) JSON based Ajax
clients as well. The key message is you do *not* necessarily have to
invent a new application to return your data as a simple web service,
in addition to it being available to browser based HTML clients.
Craig McClanahan
[1] http://www.b-simple.de/documents
[2] http://www.oreilly.com/catalog/9780596529260/
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---