• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts and Axis

 
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all,

Have writing this application using Struts and now I need to provide certain functionality using Web Service. Am using Axis to do this. Now some of the functionality is to pick up data from a MYSQL database and have a datasource element in the struts-config.xml file.Using struts for the base applicaiton I pickup this datasource from the Action class.

How do I get around using this same datasource but from a class that I would like to publish as a web service

Any ideas would be deeply appreciated.

Cheers
Jack
 
jack nick
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any alternatives would do too. Really need a way out of this.
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've not used AXIS. So, surrounding it may be issues that I'm not aware of.

Using struts for the base applicaiton I pickup this datasource from the Action class.

How do I get around using this same datasource but from a class that I would like to publish as a web service


It would seem to me that you've designed the Struts application poorly. It appears that your Action is doing too much.

If your Action were simply communicating with a Business Object, and the Business Object then accessed the data(source), then you could possibly simply publish a method or methods of the Business Object for your web service. I've done this on a few occasions.

So, perhaps you could refactor some of the data(source) access responsibility out of your Action and into a Business Object, then build your web service on top of that Business Object.
 
jack nick
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank Dirk,
I see the light in what you say. But have just one problem in doing this. I normally get the datasource from the action class using

getDataSource(request,"mysql")

where in the action class provides me with the request object. Its this data source that I pass to my business object and provide all the functionality out there.

Have I to get the datasource object from the struts config file, would I not have to have a request object. Simple put how do i get the datasource from a stand alone business object .

Cheers
Jack
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you find any solution jack nick ?
I am dying for that, too. I have a wep app, using EJB hibernate annotation and struts, however I cant retrieve or store data into database( i am using mysql).
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
DontWakeTheZombies, particularly when it's a very different issue.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic