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

Web Service & Hibernate

 
Jessy Zhao
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I wonder if anyone can tell me some of the ways in which a web service can get access to the beans (such as a dao object) defined in the hibernate application context properties file.

Thanks in advance for any info.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The class implementing the WS is a Java class like any other, and can access all objects other classes have access to. Maybe I'm misunderstanding your question?
 
Jessy Zhao
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I saw other web apps (servlets) accessing the beans via ServletContext. But web services do not have this available. How can I get it?

Thanks
 
Pierre Henry
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

You can inject the bean as a dependance into you WS, if it's declared as a bean in Spring also.
 
Jessy Zhao
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Pierre,

I currently use Weblogic's JwscTask to compile the web service code. So a servlet instance is configured in the web.xml file by the jwsc task. Do you mean to add a parameter to the constructor of the web service and manually provide the bean into the servlet instance in the web.xml file?

By the way, could you recommend what is the popular way to create web service? From WSDL to java or from java to WSDL?

Thanks
Jessy
 
Pierre Henry
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jessy,

Yes, it could be that, if you have the bean initialized in the web.xml

For the creation of WS , as a java programmer I prefer to create from java to WSDL, particularly with axis.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic