Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HttpServletResponse object in webservice

 
Bob Green
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I have a web application that calls a webservice and from the webservice, I need to get the HttpServletResponse object so that I can redirect to another page of my web application. My question is how to get the HttpServletResponse object from the webservice.

TIA,
Bob
 
Abelard Chow
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bob,

I am sorry, but I don't think it is possible. By all means, HttpServletResponse is from the Servlet architecture; while, WebSerive is another kind of animal that use another set of libraries.

You can't use library A and try to find class X in there, where class X belongs to library B.

Anyone, if I am wrong, please correct me. Thanks

Abelard Chow
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
While I agree that this is not possible, the reasons are different from the ones mentioned above. Most WS implementations are built on top of servlets, and at least some allow access to HttpServletRequest and Response objects. In Axis, e.g., the code for that would be something like this:


The problem is that WS clients do not expect to be sent redirect messages on an HTTP level, and certainly will not resubmit to a different URL if they get one. The proper thing to do is to send back an error message in the SOAP content which mentions that the WS has moved, and where it can now be found.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic