cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject RE: Always new HttpSession object is created when using WebServiceContext
Date Wed, 21 Apr 2010 04:42:54 GMT

Hi Daniel,

   The service is setup in war and deployed on Websphere application
server 6.1. Could you please let me know what iam missing here ?


-----Original Message-----
From: Daniel Kulp [] 
Sent: Tuesday, April 20, 2010 7:42 PM
Cc: Arif pasha Mohammed (WT01 - Telecom Equipment)
Subject: Re: Always new HttpSession object is created when using

Is your service a service setup as a war or similar running in tomcat or
is it some sort of standalone "main method" type thing?  If standalone,
for how to turn on the session support for the embedded jetty.


On Tuesday 20 April 2010 7:09:30 am Arif Mohd wrote:
> 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 = 
> "",
>         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
> 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
> 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>
> 				for(String cookie:lst){
> 					System.out.println(cookie);
> 				}
> 			}
> 		}
> 	}
> }
>   Can anybody suggest me whats going wrong here ?

Daniel Kulp

Please do not print this email unless it is absolutely necessary. 

The information contained in this electronic message and any attachments to this message are
intended for the exclusive use of the addressee(s) and may contain proprietary, confidential
or privileged information. If you are not the intended recipient, you should not disseminate,
distribute or copy this e-mail. Please notify the sender immediately and destroy all copies
of this message and any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should check this email
and any attachments for the presence of viruses. The company accepts no liability for any
damage caused by any virus transmitted by this email.

View raw message