Get Remote IP Address In Axis SOAP Server
Obtain remote IP from ServletRequest (Axis 1.0 only)
import javax.servlet.http.HttpServletRequest;
import org.apache.axis.MessageContext;
import org.apache.axis.transport.http.HTTPConstants;
public static String getSOAPRemoteIP() {
MessageContext context = MessageContext.getCurrentContext();
String address = null;
if(context!=null &&
context.containsProperty(HTTPConstants.MC_HTTP_SERVLETREQUEST))
{
HttpServletRequest servletReq = (HttpServletRequest)
context.getProperty(HTTPConstants.MC_HTTP_SERVLETREQUEST);
if (servletReq != null)
address = servletReq.getRemoteAddr();
}
return address;
}
Comments
because i tried but it does not work, if you can have a way to help please..
MessageContext context = MessageContext.getCurrentMessageContext();
HttpServletRequest servletReq = (HttpServletRequest) context.getProperty(HTTPConstants.MC_HTTP_SERVLETREQUEST);
System.out.println(BomenApp.now("yyyy.MM.dd '-' hh:mm:ss ") + "Request from client " + servletReq.getRemoteAddr() );