# How to determine remote IP address in ActionWebService API's

**URL:** <https://www.ruby-forum.com/t/how-to-determine-remote-ip-address-in-actionwebservice-apis/131289>\
**Category:** Rails\
**Created:** [March 7, 2008, 6:06pm UTC](https://www.ruby-forum.com/t/how-to-determine-remote-ip-address-in-actionwebservice-apis/131289 "2008-03-07T18:06:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rf-vsv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/3da27b/32.png) [@rf-vsv](https://www.ruby-forum.com/u/rf-vsv)\
**Post date:** [March 7, 2008, 6:06pm UTC](https://www.ruby-forum.com/t/how-to-determine-remote-ip-address-in-actionwebservice-apis/131289/1 "2008-03-07T18:06:52Z")

</div>

Hello all!

I trying to create XMLRPC service with ActionWebService plugin and  
Rails 2.0.2. I use conventional layered based API.

This is my controller:  
class RpcController \< ApplicationController  
skip\_before\_filter :verify\_authenticity\_token  
web\_service\_dispatching\_mode :layered  
web\_service :user, UserRpcService.new  
end

And service:  
class UserRpcService \< ActionWebService::Base  
web\_service\_api UserRpcAPI  
def auth(login, passwd)  
user = User::find(:first, :conditions =\> {:login =\> login, :passwd  
=\> passwd})  
raise UserAuthException, “Auth failed” unless user.instance\_of?  
(User)  
true  
end  
end

In method UserRpcService.auth i need to know from which remote IP this  
RPC call is come (for logging or restrictions etc.).
