From the MessageContext you can get the HttpServletRequest and from that the IP:

HttpServletRequest req = (HttpServletRequest) msgContext.getProperty(org.apache.axis.transport.http.HTTPConstants.MC_HTTP_SERVLETREQUEST);

String ip = req.getRemoteAddr();

However, keep in mind that the IP address may be misleading if the client is going through a proxy or you have a load balancer in front of your server or a caching server, etc. I know in a real production system you will most likely get a local IP address. Also, if you want to do security based on the IP address, keep in mind that IP addresses can be easily spoofed. For this reason I find relying on the IP address to be a bad plan.

Tim



Robert Gombotz wrote:

Hi!


I would need to obtain the IP address of clients/consumers that make calls to my Web services, preferably using a SOAP handler. So far, I have not found a way of achieving this. The MessageContext seems to be the only data I have in a handler, and from what I understand it does not contain the client's IP.

Any hints and ideas are greatly appreciated.


Rob






Reply via email to