stevemolitor-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jun-14 20:00 UTC
Getting Raw Request XML
I''m writing a RESTful services application that receives XML in its POST and PUT requests. It''s great that Rails parses out the XML into the params hash, but occasionally I''d rather deal with the raw request XML instead. How do I get at that? Also, when writing functional tests for controllers is there a way to send in the raw XML instead of the hash? In other words, something like this: def test_create post :xml => ''<person><first-name>bob</first-name><last-name>smith</ last-name></person>'' Thanks! Steve --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
stevemolitor-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> I''m writing a RESTful services application that receives XML in its > POST and PUT requests. It''s great that Rails parses out the XML into > the params hash, but occasionally I''d rather deal with the raw request > XML instead. How do I get at that?This might not help but I wanted to get the same thing from an xml-rpc client and did it like this: require ''xmlrpc/client'' # add a method to he lib to allow accesss to the raw # return data class XMLRPC::Client def mycall(method, *args) request = create().methodCall(method, *args) data = do_rpc(request, false) end end server = XMLRPC::Client.new2(SERVER_URL) data = server.mycall(blah) puts data -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---