users@jax-rpc.java.net

Re: Session state

From: Helen Hunter <hhunter73_at_HOTMAIL.COM>
Date: Fri, 29 Nov 2002 12:47:25 +0000

Kevin,
Yes, I think I'm doing the same. I am setting the following at the client:

stub._setProperty(Stub.USERNAME_PROPERTY, "test1");
stub._setProperty(Stub.PASSWORD_PROPERTY, "test1");
stub._setProperty(Stub.SESSION_MAINTAIN_PROPERTY, Boolean.TRUE);


On the server-side I have the following:

public class MyServiceImpl implements MyServiceIF, ServiceLifecycle {
private ServletEndpointContext endpointContext;

public void init(java.lang.Object context) throws ServiceException {
    endpointContext=(ServletEndpointContext)context;
}

public method1() {
     HttpSession session = endpointContext.getHttpSession();
     if (session != null) {
        session.setAttribute("CURRENCY","USA");
     }

      etc ....
}

public method2() {
     HttpSession session = endpointContext.getHttpSession();
     if (session != null) {
          currency = (String)session.getAtribute("CURRENCY");
     }
     etc ...
}
}

In the client's main method I call :

stub.method1();
stub.method2();


The log shows that the value is set for currency in method 1 and
null is retrieved in method 2.

thank you.

--hh

>From: Kevin Jones <kevinj_at_DEVELOP.COM>
>Reply-To: Public discussion on JAX-RPC <JAXRPC-INTEREST_at_JAVA.SUN.COM>
>To: JAXRPC-INTEREST_at_JAVA.SUN.COM
>Subject: Re: Session state
>Date: Fri, 29 Nov 2002 11:26:25 -0000
>
>What value did you set the property too?
>
>stub._setProperty(Stub.SESSION_MAINTAIN_PROPERTY, new Boolean(true));
>
>works for me,
>
>Kevin Jones
>Developmentor
>www.develop.com
>
> > -----Original Message-----
> > From: Public discussion on JAX-RPC
> > [mailto:JAXRPC-INTEREST_at_JAVA.SUN.COM] On Behalf Of Helen Hunter
> > Sent: 28 November 2002 18:10
> > To: JAXRPC-INTEREST_at_JAVA.SUN.COM
> > Subject: Session state
> >
> >
> > Hi all,
> > I am trying to maintain a session b/w my client and service.
> > I set the maintain_session_property on the client stub and use the
> > ServiceEndpointContext to getHttpSession. The getHttpSession
> > returns a new
> > session for each request. Is there anything that I am
> > missing? Does the
> > latest implementation of jax-rpc support this? Can someone
> > please help.
> >
> > thank you.
> >
> > --helen
> >
> > _________________________________________________________________
> > Help STOP SPAM with the new MSN 8 and get 2 months FREE*
> > http://join.msn.com/?page=features/junkmail
> >


_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail