The answer from petiex above assume some things about the SOAP library you are using and that you are using HTTP as the transport. Let me first ask that: what SOAP library are you using and what is the transport?
The answer is essentially correct though: you need to get access to you transport protocol (usually HTTP) and get it from there.
Main Topics
Browse All Topics





by: petiexPosted on 2007-07-31 at 20:02:12ID: 19605988
Inject a WebServiceContext instance into your WebService class, and use it in each WebMethod to get the current request's MessageContext Map. Get the SERVLET_REQUEST item from that, cast as an HttpServletRequest. From that HttpServletRequest, you can invoke getRemoteAddr() to get the client's IP.
; t.get(Mess ageContext .SERVLET_R EQUEST);
e/message. jspa?messa geID=21327 2
@WebService
public class MyService{
@Resource
WebServiceContext wsCtxt;
@WebMethod
public void myWebMethod(){
MessageContext msgCtxt = wsCtxt.getMessageContext()
HttpServletRequest req = (HttpServletRequest)msgCtx
String clientIP = req.getRemoteAddr();
}
see:
http://forums.java.net/jiv