This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Web Services and the fly likes Is there a chance to use both SOAP and Rest webservices in the same project ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Is there a chance to use both SOAP and Rest webservices in the same project ?" Watch "Is there a chance to use both SOAP and Rest webservices in the same project ?" New topic

Is there a chance to use both SOAP and Rest webservices in the same project ?

sree hareesh

Joined: Nov 16, 2011
Posts: 11
Hi all,
I am new to webservices. Is there a chance to use both SOAP and Rest webservices in the same project ?
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 41087
What do you mean by "is there a chance"? It's certainly possible.

Ping & DNS - my free Android networking tools app
Praful Thakare
Ranch Hand

Joined: Feb 10, 2001
Posts: 614
if you can dance then there is a chance ..

As Ulf replied, yes its possible.


All desirable things in life are either illegal, banned, expensive or married to someone else !!!
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 12760
My suggestion, don't get into SOAP unless you absolutely have to. RESTful style services are much easier.

amit punekar
Ranch Hand

Joined: May 14, 2004
Posts: 511
Hi there,
SOAP is one of the protocols for messages used to communicate with webservices. By this I meant, the request and response messages shall adhere to SOAP standards.
Whereas REST is a architectural pattern to implement webservices in which you define URIs to access your webservices according to REST standards. For e.g. GET/POST etc. I am sure you must have read what is REST before you encountered this question. There is this Article by Martin Fowler on REST, it will be certainly helpful to you.
As William mentioned RESTful style is much easier as you can employ the webservices request and response in JSON (other formats like XML are also okay) format which I believe is easier to handle than SOAP. This also requires less boilerplate code than SOAP webservices.

Hikari Shidou
Ranch Hand

Joined: Jan 22, 2013
Posts: 88
I have done exactally that today, to develop a SOAP x REST benchmark. I talk about it at RESTlet slower than Axis2.

Jackson + RESTlet + RESTlet built-in HTTP client had really really bad results, both in stability and performance, compared to Axis2 and its built-in XML marshaller and HTTP client. Basically, Axis2 has all we need and can make dozens of thousands of sequential calls with ease and have 3-5 milisecs overhead on each, while Jackson + RESTlet + RESTlet built-in HTTP client timeout hangs after a couple hundred calls and have 4-6 milisecs overhead on each. With stability issues and worse performance, it's hard to advocate for REST, and with a few milisecs of overhead, Axis2 is very lightweigth for the features and flexibility it provides.

To do what you want, using Axis2, RESTlet and a unique Eclipse project, basically:

1) Create Axis2 WebService as normal, using Eclipse for automating it
2) Manually create RESTlet ServerResource, as Eclipse has no automation features (RESTlet seems to have an Eclipse plugin, but I was unable to install it and didn't need at all)
3) When routing URLs in RESTlet Resource, be careful to not use Axis2 paths
4) Together with Axis2 and RESTlet you can also develop traditional Servlets, just when creating them in Eclipse be careful to not conflict their paths with Axis2 and RESTlet ones
5) In WEB-INF/web.xml you'll need to bind RESTlet routes manually, tomorrow I can post an example of it, it's not hard
6) Export war file normally from Eclipse project, it will have (1), (2) and (4) all together
7) Deploy war file in Tomcat and test all URL paths you have created, testing their parameters and responses
8) Run many tests with thousands of calls in your RESTlet client, I had A LOT of issues in it!!
I agree. Here's the link:
subject: Is there a chance to use both SOAP and Rest webservices in the same project ?
Similar Threads
SOAP request as HTTP GET
what is difference between SOAP and REST webservices ?
REST and SOAP based Services
Load xml string into DOM ?