You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by jonah <li...@gmail.com> on 2009/09/15 08:21:01 UTC

how to get client ip?

Hi,all.I'm baby to axi2.I want to write a axis2 module to log client request
information.
I use method like follow:
public static String getRemoteIp()
 {
     String remoteIp = "IP Unknown";
     MessageContext   context   =
MessageContext.getCurrentMessageContext();
     HttpServletRequest   request   =   (HttpServletRequest)
context.getProperty(HTTPConstants.MC_HTTP_SERVLETREQUEST);
      remoteIp = request.getRemoteAddr();
      System.out.println("remote   ip:   "   +   remoteIp);
      return remoteIp;
 }

But it don't work correctly like I want:In InFlowPhrase,I can not get
request ip;while in OuntFlowPhrase,I can get request ip.why?

Thank you