users@jax-rpc.java.net

Re: JAX-RPC sessions

From: Bobby Bissett - Javasoft <Robert.Bissett_at_Sun.COM>
Date: Wed, 11 Aug 2004 12:15:50 -0400

This works for me:

     private HttpSession httpSession = null;
     private ServletEndpointContext servletEndpointContext = null;

     public void init(Object context) throws ServiceException {
         ServletContext servletContext =
             ((ServletEndpointContext) context).getServletContext();
         servletEndpointContext = (ServletEndpointContext) context;
     }

     public void someLoginMethod() throws RemoteException {
         httpSession = servletEndpointContext.getHttpSession();

         // then do anything else you want with the session
     }

Seeing more of your code or the actual stack trace would be helpful if
you're still having problems.

Cheers,
Bobby



Michael Servaas wrote:
> Hi,
>
> I am working on a project which requires me to implement sessions in my
> JAX-RPC web services.
> I have tried to do this using:
>
> HttpServletRequest request;
> HttpSession mySession = request.getSession(true);
> mySession.setAttribute("sUserName", sUserName);
>
> Later on I want to retrieve the "sUserName" property using:
>
> String sUserName = (String) mySession.getAttribute("sUserName");
>
> I get NullPointerExceptions (starting at HttpSession mySession =
> request.getSession(true);)
>
> Does anybody know how to implement sessions the right way?
>
> Best Regards,
>
> Michael
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
> For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net