# Getting Raw Request XML

**URL:** <https://www.ruby-forum.com/t/getting-raw-request-xml/106874>\
**Category:** Rails\
**Created:** [June 14, 2007, 10:01pm UTC](https://www.ruby-forum.com/t/getting-raw-request-xml/106874 "2007-06-14T22:01:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 14, 2007, 10:01pm UTC](https://www.ruby-forum.com/t/getting-raw-request-xml/106874/1 "2007-06-14T22:01:49Z")

</div>

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 =\> ‘bobsmith\</  
last-name\>’

Thanks!

Steve

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 15, 2007, 6:02pm UTC](https://www.ruby-forum.com/t/getting-raw-request-xml/106874/2 "2007-06-15T18:02:31Z")

</div>

removed\_email\_address@domain.invalid 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
