-
1. Re: Reading cookies in a web service
perrucci Aug 13, 2006 11:03 AM (in response to djhititup)On jsr181 ws you can implement javax.xml.rpc.server.ServiceLifecycle and use this code in init(Object object) method:
context = (ServletEndpointContext) object;
httpSession = context.getHttpSession();
httpServletRequest = (HttpServletRequest) context.getMessageContext().getProperty("javax.xml.ws.servlet.request");
httpServletResponse = (HttpServletResponse) context.getMessageContext().getProperty("javax.xml.ws.servlet.response");
Paolo -
2. Re: Reading cookies in a web service
djhititup Aug 14, 2006 10:55 AM (in response to djhititup)Could you not use ( or in anothe way how is this used) when using the @Resource annotation like in the example below:
import java.rmi.RemoteException;
import java.util.Map;
import javax.annotation.Resource;
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.ws.handler.MessageContext;
import javax.xml.ws.WebServiceContext;
@WebService(name="TestWebService", targetNamespace="http://www.co mpany.com/department/testwebservice/", serviceName="TestWebService")
@SOAPBinding(style = SOAPBinding.Style.RPC)
public class TestWebService {
@Resource
WebServiceContext wsContext;
@WebMethod
public String hello(String name) throws RemoteException {
MessageContext context = wsContext.getMessageContext();
Map requestHeaders = (Map) context.get(MessageContext.HTTP_REQUEST_HEADERS) ;
return "Hello "+name+"!";
}
} -
3. Re: Reading cookies in a web service
cnbs Aug 15, 2006 2:02 AM (in response to djhititup)JBoss threw an exception when i tried to use this:
@Resource
WebServiceContext wsctx;
Initially Jboss doesn't know anything about this interface, its library jbossws-client.jar is allocated in jboss/client directory.. I copied it in jboss/server/all/lib and it threw a NoClassDefFoundError error in a deplyment time..
And i think it is not right to use libraries from /client directory, am i wrong? -
4. Re: Reading cookies in a web service
cnbs Aug 15, 2006 2:08 AM (in response to djhititup)"cnbs" wrote:
JBoss threw an exception when i tried to use this:
@Resource
WebServiceContext wsctx;
Initially Jboss doesn't know anything about this interface, its library jbossws-client.jar is allocated in jboss/client directory.. I copied it in jboss/server/all/lib and it threw a NoClassDefFoundError error in a deplyment time..
And i think it is not right to use libraries from /client directory, am i wrong?
I've made a mistake.
NoClassDefFoundError was thrown before i placed jbossws-client.jar in the jboss/client directory. After placing it there deployment fails with another exception... -
5. Re: Reading cookies in a web service
djhititup Aug 15, 2006 9:21 AM (in response to djhititup)It deploys with no errors for me. When I call the "hello" web service I get a null exception due to the wsContext being null b/c JBoss (I assume) is not loading this resource into the web service OR I am using it incorrectly.
Is there anyone who can shed some light on this? -
6. Re: Reading cookies in a web service
thomas.diesler Sep 1, 2006 3:04 AM (in response to djhititup)http://jira.jboss.org/jira/browse/JBWS-1022
Note, this is resolved in 2.0Beta -
7. Re: Reading cookies in a web service
djhititup Sep 13, 2006 11:58 AM (in response to djhititup)Thomas,
Will this be resolved in any of the next releases of JBossWS? Like version 1.0.3 or 1.0.4? If it helps any I'd like to say this would be awesome for me if it could be fixed by 1.0.4. thanks. -
8. Re: Reading cookies in a web service
thomas.diesler Sep 19, 2006 4:59 PM (in response to djhititup)WebServiceContext is JAXWS specific, it'll not go in jbossws-1.x