Solved

When to use SOAP based web service and when to use REST based web services in JEE

Posted on 2014-03-04
9
350 Views
Last Modified: 2016-02-26
When to use SOAP based web service and when to use REST based web services in JEE ?
While designing an application,which factors to should be considered for decision making and how one compare SOAP and REST in such cases ?
0
Comment
Question by:mrayandutta
9 Comments
 

Author Comment

by:mrayandutta
ID: 39915380
Any update from anuybody ?
0
 
LVL 25

Accepted Solution

by:
apeter earned 168 total points
ID: 40001459
Both are platform independent protocols. Both can support xml and json types

If you are planning to support mobile/tablet devices then rest based calls will be useful since they are light weight.
0
 

Author Comment

by:mrayandutta
ID: 40001671
Hi,
Thanks for your reply .
As you mentioned botha can support xml and json and rest is lightweight .
By lightweight what actually you mean in this context ? Is it the required library dependency for soap based frameworks ? Why I am asking this is because if both support json and xml then in terms of output the response is same .
I want to know the specific reason how REST based web services are lighter compared to Soap based once .
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 16

Expert Comment

by:Valeri
ID: 40001721
read the last section of this article SOAP vs REST...
http://blog.manishchhabra.com/2013/04/rest-and-soap-web-services-analogy/
REST based web services are lighter because they don't have a lot of extra markups in the XML, the protocol is not strongly defined (like it's in SOAP) and it's up to you how to represent the data and how to serialize objects to xml and back again.
0
 
LVL 33

Assisted Solution

by:Slick812
Slick812 earned 166 total points
ID: 40001917
Hi  mrayandutta, , there are many references about both Soap and Rest server exchanges on the web. And just saying that a Rest is " lighter compared to Soap", does not give any useful info,

So you ask -
"I want to know the specific reason how REST based web services are lighter compared to Soap based once ?"

My opinion is that if you do NOT have experience in the very difficult task of setting up a functional "Soap" exchange, you should try and do a the Rest exchange.

In a Rest, you have an API page that tells the developers what Page Request to send to your server, the necessary parameters and format of that request (a POST or GET or other), and then it will explain what to expect in the return, and what FORMAT the data "Text" (json, xml, other) will be in, ,  and the Function (actually request calls) return data from your server, most all of this can be custom designed by the server developers.

However, in a Soap exchange, it is REQUIRED the the Page Request be in a Formal XML Soap format, The Soap XML has function AND Object "NameSpace Definitions" that uses xmlns:  to retrieve the correct the Soap Function calls,  You can use a NameSpace to define ARRAYS with Structures, and or DataTypes.
As the name SOAP (Simple Object Access Protocol) implies, programming Object- Properties - Methods can be set and you can "bind" to Objects within their DataTypes.

Unlike the Rest, the Soap sets up a Data-Type, Function, Object-Method API definition set in the XML, and setting up this Wacky-Confusing Soap-Specification XML nameSpace for accuall use, is NOT EASY! ! You will have to test and debug, again and again in development, Because you can have poor code in the XML namespace, your the XML function calls, or your server code. You will likely have to show examples on HOW to use your Server Soap API in several different server-side languges (ASP, JSP, PHP).

But that just my opinion.
0
 

Assisted Solution

by:dantanala giribabu
dantanala giribabu earned 166 total points
ID: 40219284
Prefer SOAP if:

If you need end-to-end kind of services (not point-to-point)
         
end-to-end: client->destination1->destination2->destination3->endpoint
         
point-to-point:client->endpoint
If your request/response derived from schema (xml)
If you need support of different transportation protocols (HTTP, SMTP, TCP, UDP, or JMS),
If you need message level security (check ws - security)
If you are concern more about standards
SOAP is enterprise application ready

Prefer REST if

Point-to-Point services
Supports different formats (XML, JSON etc)
Supports only http and https (and its methods)
Very light weight (no need to pass schema prefixes, schema locations etc) (please refer how SOAP reqeust/response and JSON request and response, you well get an idea how much heavy is SOAP req/resp)
Supports only transportation level security (i.e. https)

Please let me know if you need anything more, so i can provide.

Thanks,
Dantanala
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These instructions are based on installing Owncloud on your new raspberry pi connected with a usb HDD. What do you need Part A? A Raspberry Pi, model B. A boot SD card for the Raspberry Pi. A usb HDD An Ethernet cable to connect to the lo…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question