• Post Reply Bookmark Topic Watch Topic
  • New Topic

NullPointerException Trying to Get RemoteIP (why?)  RSS feed

sam nit
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to get the client IP for one of the methods in the web service, but the stated directions I've found don't seem to work.
my webservice is very simple.

WebServiceContext wsContext;

public final void setWebContext(final WebServiceContext wsContext) {
System.out.println( "wsContext is null " + wsContext == null );
this.wsContext = wsContext;

public String yekMethod(String s ){
MessageContext msgCtxt =/*--> wsContext is null */wsContext.getMessageContext();
HttpServletRequest req = (HttpServletRequest) msgCtxt
String clientIP = req.getRemoteAddr();
return s;

I try to use all directions said in similar topic like this:
but the problem is not solved.
My application server is weblogic and I use ant task for generating webservice artifacts (like wsdl, web.xml).

any idea?
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!