# HTTP POST of XML

**URL:** <https://www.ruby-forum.com/t/http-post-of-xml/99697>\
**Category:** Rails\
**Created:** [February 1, 2006, 2:02pm UTC](https://www.ruby-forum.com/t/http-post-of-xml/99697 "2006-02-01T14:02:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![marksbrain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/6bbea6/32.png) [@marksbrain](https://www.ruby-forum.com/u/marksbrain)\
**Post date:** [February 1, 2006, 2:02pm UTC](https://www.ruby-forum.com/t/http-post-of-xml/99697/1 "2006-02-01T14:02:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![marksbrain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/6bbea6/32.png) [@marksbrain](https://www.ruby-forum.com/u/marksbrain)\
**Post date:** [February 1, 2006, 2:38pm UTC](https://www.ruby-forum.com/t/http-post-of-xml/99697/2 "2006-02-01T14:38:13Z")

</div>

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](http://rails.app/my/query?val%5Ba%5D=foo&val%5Bb%5D=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…

---

<div class="post-metadata">

**Author:** ![marksbrain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/6bbea6/32.png) [@marksbrain](https://www.ruby-forum.com/u/marksbrain)\
**Post date:** [February 1, 2006, 5:14pm UTC](https://www.ruby-forum.com/t/http-post-of-xml/99697/3 "2006-02-01T17:14:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![marksbrain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/6bbea6/32.png) [@marksbrain](https://www.ruby-forum.com/u/marksbrain)\
**Post date:** [February 1, 2006, 5:18pm UTC](https://www.ruby-forum.com/t/http-post-of-xml/99697/4 "2006-02-01T17:18:06Z")

</div>

Mark W. wrote:

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