aspose file tools*
The moose likes Web Services and the fly likes How to create a simple webservice which returns a XML file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "How to create a simple webservice which returns a XML file" Watch "How to create a simple webservice which returns a XML file" New topic
Author

How to create a simple webservice which returns a XML file

Ajay Pinnaka
Greenhorn

Joined: Aug 07, 2008
Posts: 15
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
Ajay Pinnaka
Greenhorn

Joined: Aug 07, 2008
Posts: 15
Can anyone please help me on this.
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
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?
Best wishes!
Ajay Pinnaka
Greenhorn

Joined: Aug 07, 2008
Posts: 15
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.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12781
    
    5
Creating a service that simply returns an XML resource would be very easy in RESTful style.

If there is not some overriding reason to use SOAP you should look into REST. We now have a whole bunch of toolkits to choose from but I would recommend Jersey - the Sun supported tools or Restlet.

I reviewed the REST versus SOAP story (sorry about the registration thing but it is painless.)

Bill
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
Have you seen this example?
http://www.java-tips.org/java-ee-tips/enterprise-java-beans/developing-web-services-using-ej.html
Best wishes!

P.S. If you want to go REST, as mr Brogden advocates, you can still use an EJB and expose it as a web service:
http://www.adam-bien.com/roller/abien/entry/simplest_possible_ejb_3_13
Ajay Pinnaka
Greenhorn

Joined: Aug 07, 2008
Posts: 15
Ivan Krizsan wrote:Hi!
Have you seen this example?
http://www.java-tips.org/java-ee-tips/enterprise-java-beans/developing-web-services-using-ej.html
Best wishes!

P.S. If you want to go REST, as mr Brogden advocates, you can still use an EJB and expose it as a web service:
http://www.adam-bien.com/roller/abien/entry/simplest_possible_ejb_3_13



Thanks William & Krizsan.

Yeah i have already seen this example.
http://www.java-tips.org/java-ee-tips/enterprise-java-beans/developing-web-services-using-ej.html
This is developed with EJB3 & GlassFish, But i'm looking for a sample webservice developed with EJB2 & Weblogic8.
Ajay Pinnaka
Greenhorn

Joined: Aug 07, 2008
Posts: 15
Krizsan/William, will you please help me on this.
Thank you.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41815
    
  62
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.


Ping & DNS - my free Android networking tools app
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
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.
Best wishes!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to create a simple webservice which returns a XML file