Forum: Ruby on Rails Automatic parsing of POSTed XML into @params

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Jeff Reese (Guest)
on 2006-03-21 01:39
(Received via mailing list)
Awhile back I was posting some XML strings to my rails 1.0 application
and I noticed - much to my surprise and delight - that the XML was
automatically parsed into nested parameter values that were available
through @params.

To be more specific, if I posted the string
"<request><token>abcdefg</token</request>", I could access the value
"abcdefg" in my controller as params[:request][:token].

For the life of me I can't get this working again on a new rails
project. Unfortunately the source code for my original HTTP client is
no longer available (written in C# using HttpWebRequest).

I've tried using different content types, including text/xml, but the
parameters always come across as one big string when I view the output
of the development.log file. For example, when posting the above XML
using a content type of text/xml I end up with the following result:

Parameters: {"<?xml
version"=">'1.0'?><request><token>abcdefg</token></request>",
"action"=>"heartbeat", "controller"=>"ws"}

Any help would be greatly appreciated in getting back to the amazingly
elegant solution that rails was giving me the first time around.
This topic is locked and can not be replied to.