axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Deepal Jayasinghe <dee...@opensource.lk>
Subject Re: SOAP session - How to get the SessionContext?
Date Tue, 11 Nov 2008 01:24:33 GMT
Hi Manuel,
> Hi,
>
> I am trying to setup a web service using transport or soap scope session.
> When using transport scope session everything is working fine. My
> service get called the first time with a null session, I create one
> and save it.
You mean at the server side , if so you do not need to . If you deploy
the service in transport session Axis2 will automatically create that
for you.
> Then, the next time the service is called I get the old session and
> print the call #:
>
>     public void ping() {
>         MessageContext msgctx = MessageContext.getCurrentMessageContext();
>         SessionContext session = msgctx.getSessionContext();
>         System.out.println("Got session " + session);
>         if (session == null) {
>             session = new SessionContext();
>             msgctx.setSessionContext(session);
>         }
>
>         Integer callNo = (Integer) session.getProperty("callNo");
>         if (callNo == null) {
>             callNo = 0;
>         }
>
>         System.out.println("This is call # " + callNo);
>         session.setProperty("callNo", callNo + 1);
>     }
>
> However, when I use soap scope, the session is always null. I enabled
> addressing on both client and server.
> The TCPMon log show valid serviceGroupIDExchange.
Yes that is true , when you deploy in the soap session you will not get
the Session object.
Actually if you deploy in any given session , the best place to keep
your session data is either inside the service context or service group
context.
If you do so you will not have any of the problem.

-- 
Thank you!


http://blogs.deepal.org


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Mime
View raw message