Hi Deepal

I am back to work, hopefully joint, on this burning issue.

To say is, that when we setup service.xml according to documentation at
http : //www.developer.com/java/web/print.php/3620661 and
that scope=" sopasession" does not bring back the serviceGroupContextID
but  scope="soapsession"  will bring you bak the  serviceGroupContextID

Just 3 days to figure out that.

Now, I am ready and send you the code and the .xml's to help you re-create the 
problem.



After the initial call, SOAPClient #1 uses the same sender in thread 
SOAPClient-#1 for each subsequent call and axis2 passes the 
serviceGroupContextId.

After the 2. initial call, sent by SOAPClient #2 running in thread 
SOAPClinet-#2, it uses the same sender in the thread SOPAClient-#2 for each 
subsequent call. BUT axis2 THEN calles destroy() and init() on MyService and 
axis2 has created a new serviceGroupContextId AND this makes obviously 
SOAPClient-#1 fail with an exception.

See files attached as first working examples using scope="soapsession" but 
second, raising an exception when client no 2 starts in its thread.





Diving into axis2 code: the "serviceimpl" object created by 
RawXMLInOutMessageReceiver.makeNewServiceObject( mc ), creates an instance of 
"CODE" (MyService) including some "STATE" keept at MyService, in a private 
static "sDate" variable, beeing an example for the creation time stamp. As far 
as I can figure out, this instance of "CODE", the implservice object, once 
created, is stored in an instance of "serviceContext" under a property 
"ServiceContext.SERVICE_OBJECT".

In short I like to say: the LINK (COMBINATION) of an instance of 
"ServiceContext" to an instance of "implservice" can bee seen as an OBJECT in 
the traditional sense where implservce keeps the CODE and ServiceContext stores 
the STATE. As such the TWO should have a lifecycle and we should be able to 
reference each of it by a session.


The question is then: 
How can I create multiple instances of this "COMBINATION"?

Where are REFERENCES to this "COMBINATIONS" stored?

How do I retreive a key, a reference, the OBJECT with CODE and STATE from 
AXIS2? 


I need for every SESSION, better for every CLIENT IN A THREAD an instance of a 
"CODE"/"STATE" COMBINATION where the STATE for every session, better ever 
thread must be unique?



I am new to axis2 and please tell us what I have to see differently from the 
traditional object world, in particular, how is the state stiored and retreived 
among sessions or better client threads?




Deepal, I like to answer your questions and comment embedded in    ++  .... ++ .



-----Ursprüngliche Nachricht-----
Von: Deepal Jayasinghe [mailto : [EMAIL PROTECTED]
Gesendet: Dienstag, 12. Dezember 2006 06:37
An: [email protected]
Betreff: Re: AW: sesion managment, scope=soapsession


Hi  Stadelmann ;

>
>My client #1 runs continously, and sends arround 40 msg a second to the 
>server. 
>When the second client starts, cline t#1 is still sending messages and so we 
>do 
>not have a time-out condition. client #1 never times out.
>
>BUT as I decribe, using the code shown, when client #2 starts 
>MyService.destroy() 
>is called followed by MyService.init() which has the effect that client #1 
>fails 
>thereafter with an "invalid group context id exception"
>  
>
hmmm, can you please help me to re-create the problem. If you can send
me the sample services and clients that will be very helpful for me to
fix the issue.

++ YES, attached below ++

>
>I would appreciate an example on how to have a scenario as I describe.
>When I read literature about tomcat, retriving a session object from the 
>clients request object, it seems that internals are figuring out which client 
>is calling and the rigth session object which acts as data store for the
>session is returned/created. 
>
>How is that with AXIS2-1.1?
>  
>
Will write a sample soon .


++ OK, that would be fine, because I am still not certain that 
scope="soapsession"
is what I need for a login, ..., ..., ..., logout, for a long lasting seesions, 
where 
each session has it's own instance of a service object. ++



>When the MyService Object gets created I store the creation time for the
>instance in a instance variable. And when multiple clients run without
>scope=soapsession set, all clients return the same time stamp. So that
>means for me! client #1 makes axis2 creating a first instance of a class,
>and places the creation timestamp.
>  
>
That can not happen , there should be a separate service impl class for
each client, Im 100% sure about that since I have tested that. :)

++ Maybe after using my code, you can see this differently. ++


>This is called an object, and client #2 sends his message to the same instance
>the same object. When the call to client 2 returns, client #2 finds the same 
>time stamp as client #1 has. But when client #2 starts 10 seconds after client 
>#1,
>I would expect that client #2 has a different object-creation-timestamp
>then client #1 unless we talk to the same instance (which I cant use).
>Josef
>  
>
Are u keeping your value as a static ? I mean are u storing your value
in a static variable  ?

++ yes, look at my code in "userguide.example4.MyService" ++


>Again - my clients 1 to 20 do continously send messages, each client in
>its thread - I am using NetBeans and I am just launching more then one
>client. So each client is fully busy sending. But each client gets 
>responses from the same server object instance. And we have not a time-out
>condition as each client continously sends. Once we come to real clients
>where usesers invoke messages we wil care about timeouts. But as long as
>client code jsut loops in a for() we do not have time-outs, even not with
>20 sessions, but in our example using scope=soapsession, we do not get that
>far, as client #1 runs until client #2 starts, which makes client #1 fail
>with "invalid service group context id"
>Josef
>  
>
Are you sending service group id in each request , or you juts send as new req 
? 

++ the same sender is used and the rest is axis2 minique in the deep of axis2 
as per docu. ++
 
If you want to go into same soapsession , then you need to send the 
serviceGroupID

++ according tp documentation at http : 
//www.developer-com/java/web/print-php/10935_3620661_2 stating at: "To make 
life easier, Axis2 has the built-in capability ....

So - I use options.setManageSession(true); and after the initial call returns, 
I just use the same sender object with each call and have axis2 do the rest of
sniffing into the soap header all items required to get go with the same 
serviceGroupContextID. ++




>>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
>
>
>
>So where is a new articel reflecting the same topic?
>What values does this articel have among well undestood generics when
>I can not count on the little code fragments given. Also a previous
>mail has lead me to this articel. So how far is it outdated?
>Josef
>
>  
>
I will update that and publish soon.


++ if SOAPClient starts in a first thread, a session is created. 

question: Is there a second session created if I start SOAPClient in a second 
thread 
while the first SOPAClient still runs. That is what I in fact expect and need. 
Each client running in a thread must get it's own session and be able to talk 
to an instance 
of a service object of the same class. 



"Hypernate" and "ehcache" where mentioned severla times. 
Where do I get it, including a working example? Please help me. 


Thanks and regards
Josef Stadelmann ++



Thanks
Deepal



 

Attachment: SOAPClient.java
Description: SOAPClient.java

<service name="MyService4" scope="soapsession">
    <description>
        This is a sample Web Service with 3 operations, start, echo and ping.
    </description>
    <module ref="addressing"/>
    <parameter name="ServiceClass" locked="false">userguide.example4.MyService</parameter>
    <operation name="start">
        <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
        <actionMapping>urn:start</actionMapping>
    </operation>
    <operation name="echo">
        <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
        <actionMapping>urn:echo</actionMapping>
    </operation>
    <operation name="ping">
        <messageReceiver class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
        <actionMapping>urn:ping</actionMapping>
    </operation>
</service>

Attachment: MyService.java
Description: MyService.java

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

Reply via email to