[jboss-dev-forums] [JBoss AS 7 Development] - Re: Jboss 7.1.1 Final : JAX-WS : WebServiceContext.messageContext null

Jay Kumar SenSharma do-not-reply at jboss.com
Sun Aug 26 10:44:34 EDT 2012


Jay Kumar SenSharma [https://community.jboss.org/people/jaysensharma] created the discussion

"Re: Jboss 7.1.1 Final : JAX-WS : WebServiceContext.messageContext null"

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

--------------------------------------------------------------
It's duplicate of :   https://community.jboss.org/thread/204487 *https://community.jboss.org/thread/204487*



Hi,


    You are trying to create/get the   *MessageContext*  at the time of initializing the WebService (this is due to @PostConstruct) , which is wrong because At the time of  WebService Instantiation it is in illegal state of providing you the MessageContext   Once a WebService client invokes a webservice operation then MessageContext can be retrieved.

    So remove the @PostConstruct from your init(), Because when your WebService will be constructed at that time it is wrong to expect that your webservice will receive a HttpRequest so you can not get a webservice request for a Non WebService Method.


    Also as you have mentioned the init()  method as a *NON-Web Method* by excluding it to appear in the WSDL.  Which means any WebService can not send a request to invoke it.   So if any client will not be able to invoke your init() then it is totally wrong to expect  getting a HttpRequest  inside this method.

HttpServletRequest request = (HttpServletRequest) messageContext.get(MessageContext.SERVLET_REQUEST); 



Thanks
Jay SenSharma
--------------------------------------------------------------

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

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20120826/d5f5d29b/attachment.html 


More information about the jboss-dev-forums mailing list