Hi,

   Iam using CXF version 2.2.5 and trying to implement the stateful
webservice by using @Resource annotation to inject WebServiceContext

     The code is as follows

@WebService(portName ="monitorPort" , endpointInterface =
"com.xxx.service.MonitorSEI",
        serviceName = "monitorService")
public class MonitorService implements MontitorSEI{
    @javax.annotation.Resource
    private WebServiceContext wsc;

        public List<Names> getNames(){
          HttpServletRequest req = (HttpServletRequest)
wsc.getMessageContext().get(AbstractHTTPDestination.HTTP_REQUEST);
        Cookie[] cookies=req.getCookies();
        if(cookies!=null){
                for(Cookie cookie:cookies){
                System.out.println("************ cookie:"+cookie); //iam not
getting this SOP
                }
        }
        HttpSession session = req.getSession();
        System.out.println(" ************ is new
session:"+session.isNew());//always true 
   }
 }

Iam using SOAP UI to send the request and the property "Maintain HTTP
Session" is set, i have examined the SOAP request and noticed that the
client is returning back JSESSIONID cookie properly.
      But still the server is creating a new HttpSession and obviously it is
sending new JSESSIONID in next response to the client

    I have attached the following interceptor to inbound message of service
end point to examine the value of JSESSIONID sent by the client.
  
public class HTTPHeaderInterceptor extends SoapHeaderInterceptor{

        public void handleMessage(Message message) throws Fault {
                Map<String,List<String>> map
=(Map<String,List<String>>)message.get(Message.PROTOCOL_HEADERS);
                for(String str:map.keySet()){
                        if(str.equals("Set-Cookie")){
                                System.out.println("******* cookies");
                                List<String> lst=(List<String>)map.get(str);
                                for(String cookie:lst){
                                        System.out.println(cookie);
                                }
                        }
                }
        }
}

  Can anybody suggest me whats going wrong here ?
-- 
View this message in context: 
http://old.nabble.com/Always-new-HttpSession-object-is-created-when-using-WebServiceContext-tp28287838p28287838.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to