Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Dimitrios Karageorgopoulos
Obtain external client IP from web service
June 22, 2012 5:55 AM
Answer

Dimitrios Karageorgopoulos

Rank: New Member

Posts: 18

Join Date: June 1, 2012

Recent Posts

Dear all,

I have implemented a web service using Service Builder in Liferay 6.0.

I want to obtain the extrnal client's IP addressin my *ServiceImpl class where the implementation of my web service methods reside.

I've seen that PortalUtil has a getHttpServletRequest that can lead to a getRemoteAddr funtion but getHttpServletRequest requires a PorletRequest object as input parameter that I do not know how I can get it from
Andew Jardine
RE: Obtain external client IP from web service
June 22, 2012 6:30 PM
Answer

Andew Jardine

Rank: Regular Member

Posts: 118

Join Date: December 22, 2010

Recent Posts

The ServiceContext object has a getRemoteAddr() method on it as well. Can you use that one?
Dimitrios Karageorgopoulos
RE: Obtain external client IP from web service
June 25, 2012 1:41 AM
Answer

Dimitrios Karageorgopoulos

Rank: New Member

Posts: 18

Join Date: June 1, 2012

Recent Posts

Hi Andrew,

do you know how I can get a reference to the ServiceContext from my *ServiceImpl.java where my web services reside?
Dimitrios Karageorgopoulos
RE: Obtain external client IP from web service
July 1, 2012 1:46 AM
Answer

Dimitrios Karageorgopoulos

Rank: New Member

Posts: 18

Join Date: June 1, 2012

Recent Posts

I tried a com.liferay.util.axis.ServletUtil which has a getRequest that returns an HttpServletRequest that has a getRemoteAddr() but did not work .
I got a org.apache.catalina.loader.WebappClassLoader.loadClass exception for com.liferay.util.axis.ServletUtil
Giuseppe Pantaleo
RE: Obtain external client IP from web service
August 8, 2012 6:21 AM
Answer

Giuseppe Pantaleo

Rank: New Member

Posts: 15

Join Date: June 18, 2012

Recent Posts

Hi Dimitrios,
have you found a solution for this issue?