Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WSDL vs REST Pros and Cons

Related:

Why would one use REST instead of Web services?

When deciding whether to implement a web service using SOAP or REST (by which I mean HTTP/XML in a RESTful manner) what should I be aware of and what should I be thinking of? I presume that this isn't a one size fits all thing so how do I choose which to use.

like image 308
Howard May Avatar asked May 08 '09 16:05

Howard May


People also ask

What is the difference between WSDL and REST API?

SOAP uses WSDL for communication between consumer and provider, whereas REST just uses XML or JSON to send and receive data. WSDL defines contract between client and service and is static by its nature.

Is REST API better than SOAP?

REST is a better choice for simple, CRUD-oriented services, because of the way REST repurposes HTTP methods (GET, POST, PUT, and DELETE). It is also popular because it's lightweight and has a smaller learning curve. SOAP, on the other hand, has standards for security, addressing, etc.

Do we need WSDL for REST?

All operations on a resource are supposed to be represented that way. POST is used as a catch all for when you can't express your business logic in a way that fits into the other three. That is why there isn't really a WSDL for a REST service since you only ever have 4 methods on the resource.


2 Answers

The two protocols have very different uses in the real world.

SOAP(using WSDL) is a heavy-weight XML standard that is centered around document passing. The advantage with this is that your requests and responses can be very well structured, and can even use a DTD. The downside is it is XML, and is very verbose. However, this is good if two parties need to have a strict contract(say for inter-bank communication). SOAP also lets you layer things like WS-Security on your documents. SOAP is generally transport-agnostic, meaning you don't necessarily need to use HTTP.

REST is very lightweight, and relies upon the HTTP standard to do it's work. It is great to get a useful web service up and running quickly. If you don't need a strict API definition, this is the way to go. Most web services fall into this category. You can version your API so that updates to the API do not break it for people using old versions(as long as they specify a version). REST essentially requires HTTP, and is format-agnostic(meaning you can use XML, JSON, HTML, whatever).

Generally I use REST, because I don't need fancy WS-* features. SOAP is good though if you want computers to understand your webservice using a WSDL. REST specifications are generally human-readable only.

like image 77
Kekoa Avatar answered Dec 17 '22 20:12

Kekoa


The following links provide useful information about WSDL vs REST including Pros and Cons

A couple of key points are that

1) SOAP was designed for a distributed computing environment where as REST was designed for a point to point environment.

2) WADL can be used to define the interface for REST services.

http://www.ajaxonomy.com/2008/xml/web-services-part-1-soap-vs-rest
http://ajaxonomy.com/2008/xml/web-services-part-2-wsdl-and-wadl

like image 32
Howard May Avatar answered Dec 17 '22 20:12

Howard May