• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Exposing a service as both Restful and Soap

 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need to expose a functionality as a restful service as well as provide a SOAP interface.
I have implemented rest using JBOSS resteasy .
The rest service exposed is test which was implemented as below to support form and xml requests.


What is the best way to expose the test method as a SOAP service? I have implemented this as an Axis service by defining a method as below but is this the best approach?
Is there some functionality of rest easy that I can leverage to get this working?



Thanks in advance!
 
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 simplest way is to use a Java-first approach according to, for instance, the following tutorial: http://www.netbeans.org/kb/docs/websvc/jax-ws.html
You should pay attention to separate things related to the different services in one layer, the service layer, and common request processing code in another layer, the processing layer.
I suspect it will mean more work to reuse part(s) from the REST service in the SOAP service. The only candidate(s) I can think of would be JAXB bean classes.
When doing Java-first SOAP web service development, artifacts will be generated at deploy time, so you may never see them. The container will take care of these things for you, so I don't think there is anything to gain from writing it yourself, and thus no need to try to use RESTEasy when implementing the SOAP web service.
Hope this helps and best wishes!
 
Cindy Jones
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How about using Apache CXF? Someone recommended this as an alternate solution.
 
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 again!
Yes, Apache CXF can do both REST and SOAP web services. I have used it to write REST web services and liked it.
Best wishes!
 
The only thing that kept the leeches off of me was this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic