Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2014-03-04
9
355 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
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.

 
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 34

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

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SHA2 certs for IIS AND Java? 2 113
maven module vs maven project 3 46
TSQL Query Into Specific XML Format w/ Multiple Groupings 6 33
Add to XML (Powershell) 1 28
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…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
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 …

839 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