Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts and WebServices

 
Frosty One
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can Struts integrate with WebServices and SOAP? Can anyone give a brief synopsis of how this is accomplished?
 
Brian McCallister
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is not Struts specific, but the easiest way I have found to add webservices to any java app is Axis ( http://xml.apache.org/axis/ ).
If you want to act as a web service client - put the call wheveer it belongs (probably in the model oart), if you want to export functionality of your Struts app to a web service, make sure you are well layerd, then add a seperate web service interface to the application (basically alongside struts, using the same model underneath).
-Brian
 
Matthew Phillips
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Frosty One,
We don't have many rules at Javaranch, but our naming policy is one of them. Please read this policy and change your display name to comply with it if you wish to continue posting. Thanks.
You can change your display name here.
 
Ted Husted
Author
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As Brian said, you can access a web service from Struts in the same way you would access any application model -- via the Action. Instead of calling a method that returns a result from a database, you would call a method that returns a result for a web service.
Ideally, you should try and encapsulate your business tier behind a facade. The Action doesn't need to know where the data comes from. It just knows it needs to call this method with these parameters. The Action can then return the result to the view (via the request context).
The Artimus application bundled with Struts in Action makes calls to both a database and the Lucene search engine. But all calls are behind a consistent facade so that the Action doesn't know where the result comes from. This makes it easy to add another persistance device, like a web service.
HTH, Ted.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic