axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Amila Suriarachchi <amilasuriarach...@gmail.com>
Subject Re: [axis2:session]
Date Thu, 14 May 2009 05:17:05 GMT
On Wed, May 13, 2009 at 8:37 PM, Vaibhav Arya <vaibhav.arya@otssolutions.com
> wrote:

>  Hi All,
>
>
>
> When I use following code to see the session id, it always returns new
> session id.
>
>
>
> *           HttpServletResponse response = (HttpServletResponse)
> messageContext.getProperty (HTTPConstants.MC_HTTP_SERVLETRESPONSE);*
>
> *           HttpServletRequest req = (HttpServletRequest)
> messageContext.getProperty (HTTPConstants.MC_HTTP_SERVLETREQUEST);*
>
> *           HttpSession session = req.getSession (true);*
>
> *           System.out.println ("session.getId: " + session.getId ());*
>

here you directly checking the http  request object so doesn't matter what
session you have set at the server side. ( I am not sure
req.getSession(true) always gives a new session or existing one)**

So what matters is that your client has to send the request in the same http
session. you can verify this by sending messages through a tcpmon.

I have done some thing like this and has worked for me.

SampleSessionServiceStub stub =
                    new SampleSessionServiceStub(

"http://localhost:8088/axis2/services/SampleSessionService.SampleSessionServiceHttpSoap12Endpoint/");
    stub._getServiceClient().getOptions().setManageSession(true);
    for (int i = 0; i < 3; i++) {
       System.out.println("Count ==> " +  stub.getCount());
    }

the important thing here is you need to set the
setManageSession(true)
 and have to use the same service client.

thanks,
Amila.


**
>
>
>
>
>
> I have to maintain session for a client for around 30 minutes.
>
>
>
> *I did few things as follows*
>
>
>
> 1. I have already set session scope ‘soapsession’ in *services.xml,*
>
> 2.* *Options.setManageSession (true) on  client side.
>
> 3.* *in axis2.xml file I am also setting ‘ConfigContextTimeoutInterval’
> parameter according to need.* *
>
> * *
>
> *But still I don’t get same session id to mark that session is being
> maintained.*
>
>
>
> How will it be possible that web service maintains a session?
>
>
>
> Kindly send quick response.
>
>
>
> I would be highly grateful to you.
>
>
>
> Thanks & regards,
>
>
>
> *Vaibhav Kumar Arya*
>
> *Associate Software Engineer*
>
>
>
>
>
>
> ===================================================================================================
> Private, Confidential and Privileged. This e-mail and any files and
> attachments transmitted with it are confidential and/or privileged. They are
> intended solely for the use of the intended recipient. The content of this
> e-mail and any file or attachment transmitted with it may have been changed
> or altered without the consent of the author. If you are not the intended
> recipient, please note that any review, dissemination, disclosure,
> alteration, printing, circulation or Transmission of this e-mail and/or any
> file or attachment transmitted with it, is prohibited and may be unlawful.
> If you have received this e-mail or any file or attachment transmitted with
> it in error please notify OTS Solutions at info@otssolutions.com
>
> ===================================================================================================
>



-- 
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/

Mime
View raw message