aspose file tools*
The moose likes Web Services and the fly likes Invoking a servlet from a web service Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Invoking a servlet from a web service" Watch "Invoking a servlet from a web service" New topic
Author

Invoking a servlet from a web service

Lillo Birillo
Greenhorn

Joined: Aug 04, 2005
Posts: 8
It's possible to invoke a servlet from a web service maintainig the state ?
I would call the servlet from the web service and using the session from within it. I'm using Axis.

Thanks
Lillo
Tim West
Ranch Hand

Joined: Mar 15, 2004
Posts: 539
I'm far from an expert on this, but this is my understanding of the situation:

Web service calls are inherently stateless, and there is as yet no (commonly implemented) standard for pushing sessions across Web services, or linking them to session beans.

So, you will either have to invent a mechanism for this yourself, or make your session bean stateless. I'd wager the latter would be much easier.

Still, YMMV.


-Tim
Lillo Birillo
Greenhorn

Joined: Aug 04, 2005
Posts: 8
Tim, thank you for the answer.
I dont'use any EJB.

The situation is:

CLIENT <-----> WEBSERVICE <----->SERVLET

The servlet sets some attributes in the session, I would read these attributes
from the web service in order to pass them to the client. The servlet and the Web Service are in the same Web Container.

THX.Bye
Lillo
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42601
    
  65
I think it would be easier to rewrite your servlet class so that you can instantiate it, and call the relevant methods directly from within your web service. That would save all the overhead of transforming Java objects to HTTP back to Java objects, as well as avoiding the problem you ask about.


Ping & DNS - my free Android networking tools app
Tim West
Ranch Hand

Joined: Mar 15, 2004
Posts: 539
Wow, in my tired haze (12 hours working on thesis) I read 'servlet' as 'session bean'... Dunno if any of what I said really helps then :-\


-Tim
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Invoking a servlet from a web service