Topic
4 replies Latest Post - ‏2012-03-30T16:09:43Z by SystemAdmin
joaocgf
joaocgf
3 Posts
ACCEPTED ANSWER

Pinned topic Log web service caller ip address

‏2011-02-22T14:51:20Z |
Hi,

Im developing web services with WebSphere ESB and i need to log the ip address of the client making the call to the web services. I have created a custom logger in my mediations but i dont know i can i get the information i need.

Any help would be greatly appreciated

João
Updated on 2012-03-30T16:09:43Z at 2012-03-30T16:09:43Z by SystemAdmin
  • ultras
    ultras
    1 Post
    ACCEPTED ANSWER

    Re: Log web service caller ip address

    ‏2011-02-22T15:26:20Z  in response to joaocgf
    You can try creating a handler and associate it with your web service export (using the deployment editor). In the handler "handleRequest" method you can add something like context.getProperty("remoteaddr"). This should give you the IP address of the client.
    • mmalc
      mmalc
      74 Posts
      ACCEPTED ANSWER

      Re: Log web service caller ip address

      ‏2011-02-23T07:19:08Z  in response to ultras
      Take care if you come through some sort of a web proxy that the value you're getting is the value that you really want.

      Cheers
      marvin
  • joaocgf
    joaocgf
    3 Posts
    ACCEPTED ANSWER

    Re: Log web service caller ip address

    ‏2011-02-23T14:55:19Z  in response to joaocgf
    ultras pointed me in the right direction. I've created a handler for the webservice wich gave me acces to a context where i could extract the info i needed.

    public boolean handleMessage(SOAPMessageContext context) {
    WASAxis2HttpServletRequestImpl servletRequest =(WASAxis2HttpServletRequestImpl) context.get(MessageContext.SERVLET_REQUEST);

    ....

    }
    • SystemAdmin
      SystemAdmin
      289 Posts
      ACCEPTED ANSWER

      Re: Log web service caller ip address

      ‏2012-03-30T16:09:43Z  in response to joaocgf
      I am facing the same problem. Is it possible to get more detailed info how to do it?