• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exposing a service as both Restful and Soap

 
Cindy Jones
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • 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!
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic