• 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

How to create a simple webservice which returns a XML file

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can anyone please help me on this.
 
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Krizsan/William, will you please help me on this.
Thank you.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic