[jboss-user] [JBoss Web Services] - Stateless WS -> WebServiceContext is null

web.leo do-not-reply at jboss.com
Thu Nov 15 08:37:58 EST 2012


web.leo [https://community.jboss.org/people/web.leo] created the discussion

"Stateless WS -> WebServiceContext is null"

To view the discussion, visit: https://community.jboss.org/message/776669#776669

--------------------------------------------------------------
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://ribs.telekom.de/ikf/2011/11/service/schreibenSachstand 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);
****          [...]
**    ** }
****}
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/776669#776669]

Start a new discussion in JBoss Web Services at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20121115/61d821d2/attachment.html 


More information about the jboss-user mailing list