Forum: Ruby on Rails HTTP POST of XML

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.
E78594f1f999d1bbaaaf85ea6d8fc647?d=identicon&s=25 Mark Wales (Guest)
on 2006-02-01 14:02
(Received via mailing list)
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
Ad7805c9fcc1f13efc6ed11251a6c4d2?d=identicon&s=25 Alex Young (Guest)
on 2006-02-01 14:38
(Received via mailing list)
Mark Wales 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...
E5565e2e5b83aacb8266726073d2bed5?d=identicon&s=25 Mark Wales (Guest)
on 2006-02-01 17:14
(Received via mailing list)
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
Ad7805c9fcc1f13efc6ed11251a6c4d2?d=identicon&s=25 Alex Young (Guest)
on 2006-02-01 17:18
(Received via mailing list)
Mark Wales wrote:
>
> Is this what you had in mind?
Without being precisely sure what you're inserting to, that looks about
right, yes.
This topic is locked and can not be replied to.