users@jax-rpc.java.net

Re: JAX-RPC and Session Management

From: Arun Gupta <arun.gupta_at_sun.com>
Date: Mon, 22 Sep 2003 09:26:07 -0700

Hi Mete,

On the client side ...
- On "stub", invoke _setProperty as ...
   stub._setProperty(javax.xml.rpc.Stub.SESSION_MAINTAIN_PROPERTY,
Boolean.valueOf("true"));

On the server side ...
- Make sure your service endpoint also implements
javax.xml.rpc.server.ServiceLifeCycle interface
- In the init(Object context) method, get a handle to servlet context as ...
    javax.xml.rpc.server.ServletEndpointContext servletEndpointContext =
(javax.xml.rpc.server.ServletEndpointContext)context;
- In your method implementation, you can get a reference to HttpSession
as ...
    javax.servlet.http.HttpSession httpSession =
servletEndpointContext.getHTTPSession();

This should get you started. Let me know if you need any further
information.

Thanks for your interest in JAX-RPC.

Regards,
-Arun

Mete Kural wrote:

>Hello again,
>
>Right now I am reading the JAX-RPC spec in order to learn more about session management with JAX-RPC. But it seems like the spec is a little too technical for me. Are there any JAX-RPC tutorials out there that you know of which teach session management as well? In the web services pack tutorial on java.sun.com I couldn't find any information about session management with JAX-RPC. Do you know if there is any such information there?
>
>Thanks,
>Mete
>
>---------- Original Message ----------------------------------
>From: "Mete Kural" <metek_at_touchtonecorp.com>
>Reply-To: <metek_at_touchtonecorp.com>
>Date: Wed, 17 Sep 2003 14:33:40 +0100
>
>
>
>>Hello all,
>>
>>We want to develop a web service to be consumed by a Java applet. This Java applet is an application that will be used based on "concurrent licenses" per company. We want to keep track of concurrent licenses using a web service that our Java applet will transparently connect to, authenticate the user of the applet after getting the username/password from the user, and increment the number of concurrent licenses for the company that the user belongs to. After that point, the applet will send a request to the web service every minute to let the web service know that the user is still active. Then, when the user logs off, or if the user's session has expired because of five minutes of inactivity (no requests being received by the web service), the web service will decrement the number of concurrent licenses for that company.
>>
>>Would it be practical to implement such a web service using JAX-RPC? If not, what other alternative for developing such a service would you recommend?
>>
>>In JAX-RPC, would it be possible to count the number of active client sessions that share a specific property such as "companyId" in the UserPrincipal that is associated with the session?
>>
>>Thank you very much in advance,
>>Mete
>>
>>
>>
>>

--
=============================================
There is only one me, I must live myself!
There is only one today, I must live itself!
=============================================
http://members.tripod.com/~apgupta/index.html
=============================================