Skip to main content

@Resource injection

2 replies [Last post]
oilagan
Offline
Joined: 2007-12-07
Points: 0

I do hope this is the right area for this question.

I'm trying to retrieve the client's IP address in my webservice endpoint but for it to work I need to retrieve the WebServiceContext. Problem is its always null. Has anyone ever successfully retrieved the WebServiceContext from a webservice endpoint?

- Owen

my code

@WebService public class MyService {
@Resource WebServiceContext wsContext;
@WebMethod public String doService(){
if (wsContext == null)
return "wsContext is null";
else
return "wsContext not null";
}
}

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
ramapulavarthi
Offline
Joined: 2004-06-01
Points: 0

It should have worked.
On what container are you deploying the Web Service?

oilagan
Offline
Joined: 2007-12-07
Points: 0

I am using glassfish v2 b58g for Unix platforms. And I borrowed from the helloservice jaxws example from javaee-5-doc-tutorial-1.0_04.