aspose file tools*
The moose likes Struts and the fly likes how to forward to another web service Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how to forward to another web service" Watch "how to forward to another web service" New topic
Author

how to forward to another web service

Kim Kantola
Ranch Hand

Joined: May 17, 2001
Posts: 274
Hi All,
I want to forward to another web service from my action class, not from my jsp, and am not sure how to do this. What I want to do is when the user submits the page, they go to my action class, there, I collect data from the submitted form, put it into an object, put the object into the session, and then I want to go to a reports web service running on the same server which will pull the data from the session and do its thing.
I can't just hard code the url into struts config.xml because I determine it programatically as follows:



Any pointers?

Happy Fourth of July to all!
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Originally posted by Kim Kantola:
I want to forward to another web service from my action class
This, you can do. Just create a forward with the proper URL and return it. Example:

Originally posted by Kim Kantola:
What I want to do is when the user submits the page, they go to my action class, there, I collect data from the submitted form, put it into an object, put the object into the session, and then I want to go to a reports web service running on the same server which will pull the data from the session and do its thing.

This, you cannot do. The J2EE specification does not allow for an HttpSession to be shared between more than one web application even when they're hosted on the same server. The only way to pass information from one web application to another is through query string parameters (e.g. ?parm1=foo&parm2=bar).
[ July 03, 2007: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
Kim Kantola
Ranch Hand

Joined: May 17, 2001
Posts: 274
Merrill, Thank you so much, this is a big big help.
 
Don't get me started about those stupid light bulbs.
 
subject: how to forward to another web service