Hi Robert
 
But when I have to implement finding the correswponding instance of a class (an 
object) myself, belonging to the incoming session request object, then I would 
consider axis2-1.1 not beeing able to keep sessions appart from each other. And 
again back to what I write. Why is the service group context id destroyed when 
a second client calls MyService in scope=soapsession? Which makes in gact 
client #1 fail with "invalid service group context id"
 
When I read literatur about tomcat, the session object is where instance data 
can be stored, and it is up to tomcat to return the correct session object from 
request.getSession(true). Does axis2-1.1 not support that?
 
Also, where can I learn about how WS-addressing supports sessions? Or is 
WS-addressing not supporting sessions? Does WS-addressing not supporting the 
addressing to unique session based instances of a service class object? (where 
each session has its unique instance of a service class object).
 
What is the correct approach/code to have for each session exactly one instance 
of a service class object established?  
 
Josef
 
 
 
 
 
 

-----Ursprüngliche Nachricht-----
Von: robert lazarski [mailto:[EMAIL PROTECTED]
Gesendet: Donnerstag, 30. November 2006 13:12
An: [email protected]
Betreff: Re: sesion managment, scope=soapsession


Stadelmann, Deepal describes well what Axis2 does and my recommendation is to 
use axis2 for your session management if possible. You may find, however, that 
it does not match your business case. 

If it does not, you may consider rolling your own via something like UUID - 
which WS-Addressing does in its own way - and your own ehcache or the like 
storage. Its pretty easy and I've done it for many clients. The idea is simple: 
you login, pass back a UUID, pass it back in for subsequent calls and use it as 
the key to put / get your objects out of ehcache. Logout would invalidate the 
session which ehcache can do itself after a choosen timeout. ehcache is used 
with Hibernate and is simple and effective. Oh yeah - just ignore the idea if 
that doesn't fit what you need. 

HTH,
Robert 


On 11/29/06, Deepal Jayasinghe < [EMAIL PROTECTED]> wrote: 

Hi Stadelmann ;
pls see my comments below;

> Hi session-managers,
>
>
> I'm running my client and server with modules addressing-1.1, logging,
> soapmonitor-1.1 engaged and have set scope=soapsession 
>
> MyService.java got the additional methods
>
>    public void init(ServiceContext sCtx) {
>         this.sc = sCtx;
>         this.log.info(sc.toString()+" init() called "); 
>     }
>
>     public void destroy(ServiceContext sCtx) {
>         if(!this.sc.toString().equals(sCtx.toString())){
>             this.log.error("ServiceContext on init() and destroy() not
> equal in ");
>         }
>         this.log.info(sc.toString()+" destroy() called ");
>     }
>
>     public void setOperationContext(OperationContext oCtx) { 
>         this.oc = oCtx;
>         this.log.info(oc.toString()+" setOperationContext() called
> ");
>     }
>
We have removed this method (it was there in Axis2 1.0 , but we removed 
that from Axis2 1.1), so we are no longer going to call this method . If
you want to get access to operation context , then you can do that as
follows;
MessageContext msgCtx = MessageContext.getCurrentContext ();

from msgCtx you can access any of the contexts you want .

>
>
> I start client #1 which has the effect that MyService.init() is
> called; so far so right!
> Client #1 then loops and sends continously messages to MyService.echo()
> I start client #2 which has the effect that MyService.destroy() is
> called followed by MyService.init()
> This has the effect that client #1 fails with an "invalid group
> context id exception" 
>
> Is this a bug?
>
Nope. That is not a bug , soapsession has concept of time out , so once
it gets time out you will get that exception.

>
>
> I have studied the architecture of axis2 and have drilled down in code 
> and I came down to where alle the service objects are finally called
> at "invokeBusinessLogic" (inCtx, outCtx)  with it's call to
> "method.invoke" ( . . . )
>
good .

> All reading in code and documentation did not answer my questions ***
> How does Axis2 manage / support long-lasting-sessions to
> server-objects bound to this session ? ***
>
> Do I have to implement this myself on top of Axis2? 
>
No , you can get support from Axis2 session management. If you have
Axis2 1.1 distribution there you can find a sample called Library sample
, which help you to understand most of the important factors.

>
> 1. I want to have a client-object exchanging OMElements with it's
> service-class-object.
>
yes , doable

> 2. when the client starts the session, up on receiving the first
> message, a unique instance of the service-class-object shall be 
> created at the server.
>
yes , that is what happen.

> 2a) 20 client objects shall mean we have instantiated 20
> dedicated-server-objects
>
yes.

> 3. as long as this 20 service-class-object exists, in fact 20 
> wrapper-object to 20 external server process, and as long as this 20
> external process exist it shall not be allowed that one single
> service-class-object dies. for that reasioon the server-objects must 
> exist until it's dedicated client terminates the session esplicitly by
> calling logout() on the server-object.
>
Nope , the behavior of soapsession is not like that. It has a notion of
time out. If the user does not touch the service for about 30s (time 
interval is configurable) , then the session will be automatically
terminated.

> 4. every message sent by a client has to reach exact the same instance
> of the service-class-object as the previous message did, anything else 
> would be considerd a security risk, a fault, an error.
>
yes , we are mapping to the same session using special header parameter
called "ServiceGroupID"

>
>
> I have read in a dcoument about axis session managment @ 
> http://www.developer.com/java/web/print.php/3620661 "that axis2 is
> meant to be an enterprise web service engine, so it has to support 
> session management."
>
The article is little bit out dated , since we had few changes from
Axis2 1.0 to 1.1

> I have read all related e-mails and implemented soap-sessions which
> work nicely with one client and one server. But they die when the 
> second client starts as descibed above. the second client creates a
> new service-group-id when and the old one gets lost. THis happens in
> my mind because destry is called implicit. So client-1 then fails as 
> it's known service-group-id does no longer exist.
>
>
>
> I have not found in all the e-mail of the past 3 months a clear idea
> or an answer to this often asked questions about "how to implement 
> sessions to such server side obejcts".
>
> I must admit, I do not understand how ws-addressing supports my demand.
>
> Can I managment my sessions with axis2 in an elegant way or do I have 
> to fall-back to servlets and tomcat?
>
> I would really appreciate any answers and thank you very much to
> answer my burning question not only for my own satisfaction. Thank you.
>
> Josef 
>

--
Thanks,
Deepal
................................................................
"The highest tower is built one brick at a time"




--------------------------------------------------------------------- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]  <mailto:[EMAIL PROTECTED]> 




Reply via email to