small medium large xlarge

Generic-user-small
26 Jun 2008, 16:52
Stephen Beck (1 post)

I bought the book hoping to see more on REST, hope it makes it to the final copy.

I need to create XML in Rails and POST to a remote service. I have researched on the Web and see all sorts of good info, but nothing covering this scenario. I found a blog on comsuming via REXML and Xpath, which is ok I guess for parsing response, but I want to generate the request first, obviously :-).

ActiveResource does it if you are staying inside Ruby, but I’m not. I need to send a RESTful XML doc via HTTP POST to a remote point. How do I define the XML, populate it and POST? I created a db with XML elements close to what the remote point is expecting as a prototype, but RoR dinks with the element names and the XML schema is not exactly the same.

Thanks, Steve

Samr_small_pragsmall
21 Jul 2008, 13:01
Sam Ruby (634 posts)

Having myself been caught up in the Web Services and SOAP craze a few years back, I understand the appeal of having your requests “generated” for you. But I’ve since reformed, and co-authored a book on REST and strongly suggest to everybody who will listen that they resist that urge.

Generating XML is easy using “builder”:http://builder.rubyforge.org/

There are no separate schemas to worry about, and you have full control over the element names.

You must be logged in to comment