Hey All, I have a few simple operations offered as web services (just a plain web appliction, not NetBeans..) using Glassfish. Does anyone know how I can find out the client's IP address? Thanks!
Printable View
Hey All, I have a few simple operations offered as web services (just a plain web appliction, not NetBeans..) using Glassfish. Does anyone know how I can find out the client's IP address? Thanks!
Have a look at these tutorials and see if you come up with something. Do post your solution, if get one - or post some almost-solutions if you get stuck.
Thanks! I have by now swiched from Glassfish to Tomcat, because Apache's Axis2 produces a slightly prettier WSDL file. Also, I found a solution for my client IP problem that's Apache-based:
MessageContext messageContext = new MessageContext();
ip = (String)messageContext.getProperty(MessageContext. REMOTE_ADDR);
I haven't really tested it, though - don't know if it works reliably.
For anyone finding this post while researching Axis2: I found it to be a little flaky. I worked with the current release and nightly build, couldn't get objects to be returned, nor arrays beyond a single dimension. So it's useful for simple stuff..
by using
MessageContext messageContext = new MessageContext();
ip = (String)messageContext.getProperty(MessageContext. REMOTE_ADDR);
i got the ip address like following value:
0:0:0:0:0:0:0:1
anyone knows how can i get it in a right format like ipv4?