Dec 19th, 2007, 05:44 PM
JSESSIONID and setting cookie for WebServiceTemplate
Our existing application (Documentum CMS) Web App, has it's own authenication system which authenticates users; after the initial login the JSESSIONID in the cookie is the key way in which it authenticates users. We can then work with the CMS as that user.
What I'm trying to do is call a Spring Web Service (within the same webapp), from a Page within the Documentum Web App. The Web Service I'm calling is a simple service that returns content from the CMS to the user. In order to obtain the content; we need to obtain the JSESSIONID.
However, I cannot figure out how to set the JSESSIONID in a cookie on the WebServiceTemplate's MessageSender.
The message sender is of type CommonsHttpMessageSender, on which I've obtained the HttpClient and set on the HttpState the cookies from the original request (including the JSESSIONID).
However, when the doService(...) of MessageDispatcherServlet, the request object it has access to hasn't got any cookies set on it; and the HttpSession is new, and not the session that the JSESSIONID from the originating request references.
Basically the HttpServletRequest of the MessageDispatcherServlet I which to have the same HttpSession as the one the WebServiceTemplate's marshalSendAndReceive is called from.
I'm a bit stumped on how to do it. Can anyone help?
Using Tomcat 5.5, Spring 2.5, Spring WS 1.02, Apache Http Commons 3.1