Results 1 to 4 of 4
  1. #1
    goodjonx is offline Member
    Join Date
    Nov 2007
    Posts
    4
    Rep Power
    0

    Default Client IP Address

    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!

  2. #2
    CaptainMorgan's Avatar
    CaptainMorgan is offline Moderator
    Join Date
    Dec 2007
    Location
    NewEngland, US
    Posts
    835
    Rep Power
    8

    Default

    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.
    Vote for the new slogan to our beloved Java Forums! (closes on September 4, 2008)
    Want to voice your opinion on your IDE/Editor of choice? Vote now!
    Got a little Capt'n in you? (drink responsibly)

  3. #3
    goodjonx is offline Member
    Join Date
    Nov 2007
    Posts
    4
    Rep Power
    0

    Default

    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..

  4. #4
    infozeit is offline Member
    Join Date
    Sep 2009
    Posts
    1
    Rep Power
    0

    Default

    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?

Similar Threads

  1. How to get IP Address of the client
    By Java Tip in forum java.net
    Replies: 0
    Last Post: 04-05-2008, 11:14 AM
  2. JSP getting IP address
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-29-2008, 10:05 AM
  3. Identify Client in Socket Client Server Application
    By masadjie in forum Networking
    Replies: 1
    Last Post: 12-20-2007, 10:18 AM
  4. Getting host name/address
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 11-19-2007, 05:34 PM
  5. I am not able to print Address
    By Albert in forum New To Java
    Replies: 1
    Last Post: 07-13-2007, 04:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •