Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / December 2005

Tip: Looking for answers? Try searching our database.

Creating session state without http or ejb

Thread view: 
iksrazal@gmail.com - 02 Dec 2005 12:37 GMT
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
Chris Smith - 03 Dec 2005 02:27 GMT
> 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.

Signature

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

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.