I m planning on using Sinatra for a new tiny webservice (WS) that I need to put together for a client.
The WS will only have two methods, one accessed via GET and one via POST. For the POST method, the client will send an XML packet to the sinatra WS which will parse the data and issue either a 200 OK HTTP response or a 40x error code.
My question is how do I parse the incoming POSTed XML packet in Sinatra?
Here is an example of what the incoming data packet will look like:
<?xml version="1.0" encoding="utf-8" ?>
<Counts>
<OccupiedCount>300</OccupiedCount>
<ReservedCount>40</ReservedCount>
<VacantCount>160</VacantCount>
<TotalCount>500</TotalCount>
<Checksum>0777d5c17d4066b82ab86dff8a46af6f</Checksum>
<Timestamp>2009-11-21T14:06:19Z</Timestamp>
<ApiKey>1234567890qwerty</ApiKey>
</Counts>
Is there someway to access the data packet via the Sinatra params object so that I can parse it with something like Crack XML? Or do I need to use some kind of Rack variable to get at the whole XML data packet that was POSTed to my WS?