Skip to main content

State management in a Web Service?

No replies
krasman
Offline
Joined: 2009-03-29

I'm wanting to wrap some functionality of a 3 party api into a Web Service so it can be accessible portably by others not using Java.
This library requires an authentication process whose result includes session context of the client. This context must be consistent and match the caller's context for each subsequent call or it throws out an authentication error.
This is straight forward in a session based environment, but I'm not sure how of if I can support this in a Web Service system.
I've resorted to connecting/disconnecting on each and every interface call that uses this 3rd party module. Would seem a waste of time (literally) doing this, but it's been the only reliable design so far.
I've attempted defining the service in the context of a @Stateful EJB, initializing the connection point during the @Init and @PostActivate methods, but this doesn't seem to work, I'm getting connection errors when accessing remotely. Is there an obvious practice to achieve what I want to do or am I SOL?