Skip to main content

@Resource injection

2 replies [Last post]
Joined: 2007-12-07

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";
return "wsContext not null";

Reply viewing options

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

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

Joined: 2007-12-07

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.