Return-Path: X-Original-To: apmail-cxf-issues-archive@www.apache.org Delivered-To: apmail-cxf-issues-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EBDD71079B for ; Mon, 30 Sep 2013 05:43:38 +0000 (UTC) Received: (qmail 38040 invoked by uid 500); 30 Sep 2013 05:43:35 -0000 Delivered-To: apmail-cxf-issues-archive@cxf.apache.org Received: (qmail 37944 invoked by uid 500); 30 Sep 2013 05:43:32 -0000 Mailing-List: contact issues-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list issues@cxf.apache.org Received: (qmail 37886 invoked by uid 99); 30 Sep 2013 05:43:28 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Sep 2013 05:43:28 +0000 Date: Mon, 30 Sep 2013 05:43:28 +0000 (UTC) From: "Noman ali abbasi (JIRA)" To: issues@cxf.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (CXF-5298) Session is not maintaining MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CXF-5298?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13781613#comment-13781613 ] Noman ali abbasi edited comment on CXF-5298 at 9/30/13 5:42 AM: ---------------------------------------------------------------- Hi daniel Kulp, This issue has been fixed by adding messageContext.put(Message.MAINTAIN_SESSION, Boolean.TRUE); in every request and in struts app i have configured a httpsessionlistener and stored a client on each user session, eventually its working fine now. HTTPSessionListener in Struts1 app: public void sessionCreated(HttpSessionEvent httpSessionEvent) { HttpSession httpSession = httpSessionEvent.getSession(); MarsWebClient client = new MarsWebClient(); if(httpSession.getAttribute(httpSession.getId()) == null){ httpSession.setAttribute(httpSession.getId(), client); System.out.println("sessionId: " + httpSession.getId()); } } Struts1 action HttpSession httpSession = request.getSession(); Client client = (Client) httpSession.getAttribute(httpSession.getId()); Web Service Implementation Class: public String getUserInfo() { HTTPSession httpSession = getHttpSession(context); return "logged-in: user: " + httpSession.get(SESSION_USER) + " id: " + httpSession.getSession().getId(); } protected HTTPSession getHttpSession(WebServiceContext webServiceContext){ messageContext = webServiceContext.getMessageContext(); messageContext.put(Message.MAINTAIN_SESSION, Boolean.TRUE); HttpServletRequest httpServletRequest = HttpServletRequest)messageContext.get(AbstractHTTPDestination.HTTP_REQUEST); HTTPSession httpSession = new HTTPSession(httpServletRequest); return httpSession; } was (Author: engr.nomiabbasi@gmai.com): Hi daniel Kulp, This issue has been fixed by adding messageContext.put(Message.MAINTAIN_SESSION, Boolean.TRUE); in every request and in struts app i have configured a httpsessionlistener and stored a client on each user session, eventually its working fine now. HTTPSessionListener in Struts1 app: public void sessionCreated(HttpSessionEvent httpSessionEvent) { HttpSession httpSession = httpSessionEvent.getSession(); MarsWebClient client = new MarsWebClient(); if(httpSession.getAttribute(httpSession.getId()) == null){ httpSession.setAttribute(httpSession.getId(), client); System.out.println("sessionId: " + httpSession.getId()); } } Web Service Implementation Class: public String getUserInfo() { HTTPSession httpSession = getHttpSession(context); return "logged-in: user: " + httpSession.get(SESSION_USER) + " id: " + httpSession.getSession().getId(); } protected HTTPSession getHttpSession(WebServiceContext webServiceContext){ messageContext = webServiceContext.getMessageContext(); messageContext.put(Message.MAINTAIN_SESSION, Boolean.TRUE); HttpServletRequest httpServletRequest = HttpServletRequest)messageContext.get(AbstractHTTPDestination.HTTP_REQUEST); HTTPSession httpSession = new HTTPSession(httpServletRequest); return httpSession; } > Session is not maintaining > --------------------------- > > Key: CXF-5298 > URL: https://issues.apache.org/jira/browse/CXF-5298 > Project: CXF > Issue Type: Bug > Affects Versions: 2.7.5 > Reporter: Noman ali abbasi > Fix For: NeedMoreInfo > > > i m always getting new session id on each request, i m using apache cxf 2.7.5 version, i have also tried various solutions like, > Map properties = new HashMap(); > properties.put("thread.local.request.context", Boolean.TRUE); > properties.put("org.apache.cxf.message.Message.MAINTAIN_SESSION",Boolean.TRUE); > > factory = new JaxWsProxyFactoryBean(); > factory.getInInterceptors().add(new LoggingInInterceptor()); > factory.getOutInterceptors().add(new LoggingOutInterceptor()); > factory.setServiceClass(MarsWebService.class); factory.setAddress("http://localhost:8080/HelloWorld/ws/HWebService?wsdl"); > but no luck, i have also bind an user with session id and set web service client at session level like > HTTP Session Listner > if(webServiceClient.get(httpSession.getId()) == null){ > Client client = new Client(); > httpSession.setAttribute(httpSession.getId(), client); > } > Struts1 action > HttpSession httpSession = request.getSession(); > Client client = (Client) httpSession.getAttribute(httpSession.getId()); -- This message was sent by Atlassian JIRA (v6.1#6144)