Solved

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

Posted on 2014-03-04
9
342 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
Comment Utility
Any update from anuybody ?
0
 
LVL 25

Accepted Solution

by:
apeter earned 168 total points
Comment Utility
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
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 16

Expert Comment

by:Valeri
Comment Utility
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
Comment Utility
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
Comment Utility
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

In order to have all security and back ups taken care of, WordPress users can sign up for services with WP Engine.
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…

762 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now