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 testwhich 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?
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!
Joined: Oct 08, 2002
How about using Apache CXF? Someone recommended this as an alternate solution.
Joined: Oct 04, 2006
Yes, Apache CXF can do both REST and SOAP web services. I have used it to write REST web services and liked it.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Exposing a service as both Restful and Soap