Hi everybody,
i´ve implemented a web service using JAX-WS/JBoss 5.1.0. Inside the web service i used a javax.annotation.Resource annotation to get the javax.xml.ws.WebServiceContext.
Up to now it works fine but then i had to chang the web service to a stateless one via javax.ejb.Stateless annotation. Now i get a NullPointerException whenever i try to use the WebserviceContext. Where am i wrong? I also tried to use a setter method with a Resource annotation but it also didn´t work.
Part of my code:
import javax.annotation.Resource;
import javax.ejb.Stateless;
import javax.jws.HandlerChain;
import javax.jws.WebService;
import javax.xml.ws.Holder;
import javax.xml.ws.WebServiceContext;
@HandlerChain(file = "/HandlerDefinition.xml")
@WebService(serviceName = "webService", endpointInterface = "com.webService", targetNamespace = "http://server/webService")
public class WebServiceImpl implements WebService {
@Stateless
@Resource
WebServiceContext wsContext;
public void doWork(RequestData data, Holder<ResponseData> data0)
throws ExceptionMessage{
String uuid = (String) wsContext.getMessageContext().get(STARTTIME);
[...]
}
}