# Web Service

**URL:** <https://www.ruby-forum.com/t/web-service/110323>\
**Category:** Rails\
**Created:** [July 25, 2007, 11:21am UTC](https://www.ruby-forum.com/t/web-service/110323 "2007-07-25T11:21:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Iain\_A](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/6bbea6/32.png) [@Iain\_A](https://www.ruby-forum.com/u/Iain_A)\
**Post date:** [July 25, 2007, 11:21am UTC](https://www.ruby-forum.com/t/web-service/110323/1 "2007-07-25T11:21:50Z")

</div>

Hi,

I am writing a ruby on rails web service that needs to be accessed  
from a mobile phone. There is a mobile phone plugin that has been  
developed that will call the web service. Now the real trouble is that  
I need to access the HTTP headers from the webservice request. There  
is a header variable HTTP\_X\_WAP\_PROFILE, which is present. Does anyone  
know how to access these headers? Also this is assuming that the  
webservice will be able to recieve normal HTTP requests and that the  
mobile phone will make this kind of request. I don’t really understand  
if the HTTP headers will be present.

---

<div class="post-metadata">

**Author:** ![Iain\_A](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/6bbea6/32.png) [@Iain\_A](https://www.ruby-forum.com/u/Iain_A)\
**Post date:** [July 25, 2007, 2:00pm UTC](https://www.ruby-forum.com/t/web-service/110323/2 "2007-07-25T14:00:50Z")

</div>

Okay turns out I was going about this the wrong way. You can simply  
have the controller as a normal controller  
, create a new route that passes the HTTP post params. Then just  
return an XML page

---

<div class="post-metadata">

**Author:** ![Iain\_A](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/6bbea6/32.png) [@Iain\_A](https://www.ruby-forum.com/u/Iain_A)\
**Post date:** [July 26, 2007, 12:17am UTC](https://www.ruby-forum.com/t/web-service/110323/3 "2007-07-26T00:17:48Z")

</div>

For example, request.env[“HTTP\_USER\_AGENT”]

I actually wrote something to parse the wurfl xml file, store it in a  
db, and then make it easy to access. Its been a while since I looked  
at the code, but I can post it if a few people are interested. Might  
have to clean it up a bit first.

---

<div class="post-metadata">

**Author:** ![Iain\_A](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/6bbea6/32.png) [@Iain\_A](https://www.ruby-forum.com/u/Iain_A)\
**Post date:** [July 27, 2007, 5:06pm UTC](https://www.ruby-forum.com/t/web-service/110323/4 "2007-07-27T17:06:08Z")

</div>

Dusty that would be great, thanks alot
