Prev | Current Page 348 | Next

Brad Ediger

"Advanced Rails"

xml to load the list of products:
Processing ProductsController#index (for 127.0.0.1 at 2007-09-14
14:30:38) [GET]
Session ID: 04bc0d4b88c250a9cd50fb481991e2d9
Parameters: {"format"=>"xml", "action"=>"index",
"controller"=>"products"}
Product Load (0.000591) SELECT * FROM products
Completed in 0.15692 (6 reqs/sec) | Rendering: 0.00255 (1%)
| DB: 0.00059 (0%) | 200 OK [http://localhost/products.xml]
We can see the XML wire protocol that ActiveResource uses by querying the web
service directly??”just navigate to http://localhost:4000/products.xml. The response is
generated by the ActiveRecord XmlSerializer, via @products.to_xml:



2007-09-08T14:06:08-05:00
Description of the T-shirt
1
Organic cotton T-shirt
18.5
15


Of course, real-world applications will be more complicated than this. The real problems
come from the complexity involved in integrating different systems. In this
example, we were greatly assisted by having a monoculture??”making Rails talk to
Rails is easier than, say, making a J2EE system talk to Rails.
However, the advantage of a RESTful architecture lies in its constraints. Agreeing on
RESTful principles narrows the universe of discourse??”it pares down the space in
which two systems can disagree and still call themselves RESTful.


Pages:
336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360