This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
How to create a simple webservice which returns a XML file.
Basically i want to create a webservice by using EJB 2.and i want to deploy the same in weblogic 8 server.
Tried browsing so many sites, but i was unable to find any useful info. :-((
Appreciate your help on this.Thanks
First of all, do you want to use a SOAP web service?
If so, do you want to return the XML file inside the SOAP body or as an attachment?
Finally, if you want to return the XML file inside the SOAP body, have you considered implementing an EJB with a method that returns a string and then exposing it as a web service?
Joined: Aug 07, 2008
Thanks a lot for your response Krizsan.
Yes, I am planning to use SOAP webservice.
And my EJB should return XML file as a String.
There are two possible approaches to this. Either using JEE's in-built facilities for making EJBs accessible through web services; that would result in a SOAP service. Search for "exposing EJB as web service" to find more information.
Or the WS class could just get hold of a session bean and take it from there. That would allow the service to take whichever shape you desire, SOAP or REST.
Joined: Oct 04, 2006
The newest in new is that EJBs also can be exposed as RESTful web services using JAX-RS annotations, see the link in my previous posting.
Thus, en EJB can be exposed either as a SOAP or a REST web service.