File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes Web Service & Hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Web Service & Hibernate" Watch "Web Service & Hibernate" New topic
Author

Web Service & Hibernate

Jessy Zhao
Greenhorn

Joined: Dec 28, 2006
Posts: 15
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
Marshal

Joined: Mar 22, 2005
Posts: 42930
    
  68
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

Joined: Dec 28, 2006
Posts: 15
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

Joined: Oct 01, 2003
Posts: 31
Hello,

You can inject the bean as a dependance into you WS, if it's declared as a bean in Spring also.


"A good method shouldn't bypass one screen long"<br />"genius is the knowledge left when one has forgotten everything"
Jessy Zhao
Greenhorn

Joined: Dec 28, 2006
Posts: 15
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

Joined: Oct 01, 2003
Posts: 31
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Web Service & Hibernate