HTTP POST of XML

I am new to Rails so hopefully not asking stupid questions, but I would
appreciate any help on the following:

What is the easiest (least hassle) way for my Rails application to
accept XML input? I know that I can use WSDL, but is there any default
or easily modified way to simply do an HTTP POST of the parameters I
want to pass in?

Also, I have tried coding a client to do an HTTP POST of what appeared
to be the parameters to some simple RAILS applications (like recipe from
InstantRails) and it appears that Rails expects a nested name-value
pair - something my client software can’t currently do. Can someone
explain why Rails does this and if there are any work-arounds?

-Mark

Mark W. wrote:

Also, I have tried coding a client to do an HTTP POST of what appeared
to be the parameters to some simple RAILS applications (like recipe from
InstantRails) and it appears that Rails expects a nested name-value
pair ? something my client software can?t currently do. Can someone
explain why Rails does this and if there are any work-arounds?
Rails actually does some magic query-key parsing to make that work. As
long as you can submit key-value pairs with arbitrary keys, you should
be able to get the nested values to work. Something like:

http://rails.app/my/query?val[a]=foo&val[b]=bar

should give you a params array like:

params = {:val =>{:a=>‘foo’, :b=>‘bar’}}

I don’t know if that’s enough to get your client to work, though…

I just wanted to clarify what you are suggesting. If I want to attain
this:

Parameters: {"commit"=>"Create",

“category”=>{“name”=>“Test”},…

I should insert the following pairs of Strings:

"commit", "Create"
"category[name]", "Test"

Is this what you had in mind?

-Mark

Mark W. wrote:

Is this what you had in mind?
Without being precisely sure what you’re inserting to, that looks about
right, yes.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs