Creating session state without http or ejb

Discussion in 'Java' started by iksrazal@gmail.com, Dec 2, 2005.

  1. Guest

    Hi all,

    I want to duplicate a feature I used in an ejb-based web service, in an
    non-ejb tomcat-based web service. I want to allow a user to login via a
    web service, on successful authentication return a session id String,
    and on future call pass in the session id:

    public ReturnWeb_Login web_Login(
    String user_name,
    String user_password) throws RemoteException {

    soap_session_id = serviceLocator.getSoapSession_Id(soapSession);
    if (athenticate(user_name,user_password)) {
    return new ReturnWeb_Login (soap_session_id, user_name);
    }
    }

    The idea here is that soap_session_id is generated from a Stateful
    Session bean, and times out. Once logged in, subsequent calls are like:

    public ReturnWeb_Base doSomething(
    String soap_session_id) throws RemoteException {

    //check authorization
    SoapSession soapSession = checkAuthorization(soap_session_id);
    if(soapSession!=null) {
    //do something
    }
    }

    The above works without messing around with the internal servlet the
    web service uses, axis in this case.

    My question is simple, though the answer may be difficult: How can I
    create a session id that times out, independent of http or ejb ?

    iksrazal
     
    , Dec 2, 2005
    #1
    1. Advertising

  2. Chris Smith Guest

    <> wrote:
    > The above works without messing around with the internal servlet the
    > web service uses, axis in this case.
    >
    > My question is simple, though the answer may be difficult: How can I
    > create a session id that times out, independent of http or ejb ?


    You absolutely can't create a session without HTTP. I doubt that your
    code in your EJB container would have worked outside of HTTP as a
    transport protocol, and you can't write the code yourself in Tomcat/Axis
    without referencing the classes HttpServletRequest and HttpSession.

    You'll also need to use one Axis-specific class, namely MessageContext.
    This will be used to get the HttpServletRequest in the first place.

    --
    www.designacourse.com
    The Easiest Way To Train Anyone... Anywhere.

    Chris Smith - Lead Software Developer/Technical Trainer
    MindIQ Corporation
     
    Chris Smith, Dec 3, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. shamanthakamani
    Replies:
    1
    Views:
    3,502
    Natty Gur
    Nov 20, 2003
  2. Not Liking Dot Net Today
    Replies:
    0
    Views:
    620
    Not Liking Dot Net Today
    Apr 21, 2004
  3. Maciek
    Replies:
    0
    Views:
    8,259
    Maciek
    Sep 15, 2005
  4. jnickfl1
    Replies:
    0
    Views:
    598
    jnickfl1
    Sep 18, 2006
  5. Raymond Schanks
    Replies:
    0
    Views:
    661
    Raymond Schanks
    Aug 3, 2010
Loading...

Share This Page