Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 397
  • Last Modified:

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

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
mrayandutta
Asked:
mrayandutta
3 Solutions
 
mrayanduttaAuthor Commented:
Any update from anuybody ?
0
 
apeterCommented:
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
 
mrayanduttaAuthor Commented:
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
Automating Your MSP Business

The road to profitability.
Delivering superior services is key to ensuring customer satisfaction and the consequent long-term relationships that enable MSPs to lock in predictable, recurring revenue. What's the best way to deliver superior service? One word: automation.

 
ValeriCommented:
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
 
Slick812Commented:
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
 
dantanala giribabuCommented:
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now