Hello,

Your parameters are not seen as xml content.

You should put your xml content on a file an send it with : curl -d
@file_to_send ...

In this case you will automatically get your xml as a map on the params map.

Mickael

On 16 August 2010 06:32, MarkB <[email protected]> wrote:

> I am trying to add a controller method that will take an XML post with
> a schema not related to an existing model and parse it as a hash of
> parameters.  I create apis_controller.rb:
>
> class ApisController < ApplicationController
>  def create
>    puts "**** API INVOKED ****"
>    puts params[:name]
>  end
> end
>
> Then...
>
> curl --data-urlencode "<name>Foo</name>" -H "Content-Type:application/
> xml" http://localhost:3000/apis.xml
>
> I get the following error:
>
>  Status: 500 Internal Server Error
>  undefined method `name' for nil:NilClass
>
> Is there a way for "puts params[:name]" to display "Foo" upon
> receiving the XML post?
>
> Thanks in advance!
> Mark
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<rubyonrails-talk%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to