I use IBM WebSphere Application Developer to create a Web Service implemented as a Java bean in a Web project. WebSphere creates a servlet as the service endpoint. Now I want to get the client's calling IP address to validate the its access to the service. But the container shields off the servlet so I can not use getRemoteAddr() method from the ServletRequest object. Is there a way I can retrieve the IP address?
I don't have a solution for IBM, but BEA Weblogic offers the web service context. From there you can get the remote ip. Websphere might offer something similar.
IBM WAS is turning me into a blind.
Try using a servlet filter that is configured to filter path of the web service. There you will be able to get the ip of the client.
Thanks for your responses.
It's the IBM implementation that prevents all this becoming possible. All you need to do in IBM solution is to create a Java Bean to implement all the business logic, then use the WebService wizzard to create a project based on the Bean class. All I can see in the project is my own Java Bean class - a regular Java class. And IBM has the nerve to declare my Java Bean class as a "Servlet". WebSpehere hides all the WebService functions completely from users - it has all the WebService functions developed inside, not a single function you know that it's out there. Only when it needs your business functions, it calls your Bean object to get them.
In short, WAS has its WebService container entirely built in and not exposing a single interface or a function!!!
How about using SOAP Handlers and capturing IP address of client. I've tried this in weblogic, but it didn't work as expected. Not sure if IBM has any way.
This message chain is a bit old, but I thought it would hurt to ask anyway.
I am using WAS 6.1, but couldn't find a way to get the client's ip address.
Did anyone find a solution to get client's IP address in a Websphere web service ?