-
1. Re: How to access the request in a JAXWS webservice (JBoss 7.1.1) ?
jaysensharma Aug 26, 2012 10:55 AM (in response to mleneveut)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);
A Working Demo for the same is available for JBoss As 7.1.1 in the following link: http://middlewaremagic.com/jboss/?p=243
Thanks
Jay SenSharma
-
2. Re: How to access the request in a JAXWS webservice (JBoss 7.1.1) ?
mleneveut Aug 27, 2012 3:43 AM (in response to jaysensharma)Thanks a lot Jay