Automatic parsing of POSTed XML into @params


#1

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
“abcdefg</token”, 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’?>abcdefg",
“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.