0

I saw these two links:

1.SOAP vs REST

  1. SOAP vs REST 2

I understood the difference between the two. But I also heard about WADL (https://wadl.java.net/), which are used along with REST to provide a contract ( similar to SOAP WSDL does)

Now I have two questions:

  1. REST is also adheres to the data type that is going to receive or transmit by WADL, which now acts very similar to SOAP ( with WSDL ).
  2. If REST with WADL and SOAP are similar, which one to use?

Thanks in advance.

Community
  • 1
  • 1
batman
  • 3,125
  • 3
  • 16
  • 36
  • "which are used along with REST to provide a contract" I've never seen an example of WADL being used in a real project. –  Dec 12 '14 at 10:57

2 Answers2

1

RESTful and SOAP WebServices are fundamentally different.

In short - SOAP is a typical RPC based call where you hide your request action and details within the XML document of the SOAP body. Wheras pure RESTful webservie totally rely on HTTP methods to perform an action on server.

Although WADL is not yet widely adopted and not really a standard but the theory behind it is to simply help tools to generate some code, and it aims to promote reuse of applications beyond the basic use in a web browser i.e. machine-to-machine communication (still using HTTP protocol).

JSS
  • 1,805
  • 1
  • 17
  • 23
1

SOAP (Simple Object Access Protocol)

REST (Representation State Transfer)

SOAP and REST can’t be compared directly, since the first is a protocol and the second is an architectural style.

The main difference between SOAP and REST is the degree of coupling between client and server implementations. SOAP works like a custom desktop application, tightly coupled to server. There is rigid contract between client and server and everything seem like breaking is any of the side is changed. But, REST client is more like a browser. It’s a generic client that knows how to use a protocol and standardized methods. If done right, there would be less coupling. A client is supposed to enter into REST without prior knowledge of the API, except for the entry point and the media type. In SOAP, the clients need to have the prior knowledge of everything it will be using.

REST is protocol independent. It’s not coupled to HTTP. We can use it for any protocol for which there is standardized URI scheme. But, SOAP itself is a protocol.

SOAP only supports XML, but REST supports different format like text, JSON, XML etc. And we know if we use JSON then definitely we will be in better place in terms of payload.

SOAP can use any generic transport (HTTP / HTTPS) or RPC (Remote Procedural Call). But, REST uses only HTTP/HTTPS

SOAP can’t use REST. But, REST can use SOAP similar to HTTP or any other protocols

SOAP used services interfaces to expose the business logic. REST used URI to expose the business logic

In Java, JAX-WS is for SOAP web services. But, Java JAX-RS is for REST web services

SOAP defines the standards to be strictly followed. REST doesn’t define any standards like SOAP

SOAP requires more bandwidth and resource than REST. REST required less bandwidth and resources.

SOAP defines its own security. REST inherits security measures from underlying transport

SOAP is less preferred these days as compared to REST