• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Invoking a servlet from a web service

 
Lillo Birillo
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 539
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Tim West
Ranch Hand
Posts: 539
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic