Sergey,
thank you, that is exactly what i was looking for.
It is working correctly now.
here is what i did in my impl class:
@Resource WebServiceContext jaxwsContext;
@Resource MessageContext jaxrsContext;
and the method where i get the ip address:
private String getIpAddress() {
String ipAddress = " unknown";
HttpServletRequest request = null;
if (jaxrsContext != null) {
request = (HttpServletRequest)
jaxrsContext.get(AbstractHTTPDestination.HTTP_REQUEST);
} else if (jaxwsContext != null) {
request = (HttpServletRequest)
jaxwsContext.getMessageContext().get(MessageContext.SERVLET_REQUEST);
} else {
// TODO can not get ip address
// should we through and exception
}
if (request != null){
if
(StringUtils.isNotBlank(request.getHeader("X-Forwarded-For"))) {
ipAddress =
request.getHeader("X-Forwarded-For");
} else {
ipAddress = request.getRemoteAddr();
}
}
// System.out.println("IP ADDRESS: " + ipAddress);
return ipAddress;
}
thanks again,
Chris
--
View this message in context:
http://cxf.547215.n5.nabble.com/Getting-the-IP-Address-of-SOAP-Clients-works-for-REST-clients-but-not-for-SOAP-clients-tp4476334p4476721.html
Sent from the cxf-user mailing list archive at Nabble.com.