The difference between the Web Service - API, WSDL, SOAP, REST, Simply that the farmers understand :)💻
Tags: api, rest, webdev, soap
Published: 2020-04-18 08:38:17

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/c6q0vsbz6zrqawkqplqt.jpg)
<center>###❤️Provide API with programing language❤️</center>

## **Differences between web services and the API**
 

- All Web Services are APIs, but not all Web Services. 

 

- Web Service restricts operations on HTTP. It does not work on operating systems or other environments, but the API can operate in all operating systems and environments 

 

- There are only a few communication types in the Web Service such as SOAP, REST and XML-RPC, but the API can use a variety of communication types. 

 

- The Web Service requires a network to work, but the API can operate both over the network and not over the network. 

 

- The API can communicate with various parts. Directly. As for the Web Service, communication goes through many steps. Including data conversion to XML or JSON before sending data And have to convert data back to be used again in the system 

 
<h2><strong >WSDL is</strong ></h2>
Web Services Description Language, or WSDL, is an XML document used to describe the function of a web service. It has a file (.wsdl) that can be read by both humans and machines, indicating the nature of the web service. What parameters must be put and the structure of the response going? The WSDL reads WIS-TAO.
Currently, the version of WSDL is WSDL2.0. The meaning of abbreviations has changed from version 1.1, where D stands for "Definition".
Functions of WSDL
WSDL is used to describe the endpoint services provided in the XML format document. It is often used in conjunction with SOAP to provide XML Schema data or Web services on the Internet. The client program connects to web service to read the WSDL file information and analyze the commands that can be used on the server. Special necessary datatype data is also included in the WSDL file, allowing the client to use SOAP to send commands from the data set in WSDL file over HTTP
For the current version 2.0, all HTTP commands will be accepted, including GET, PUT, POST, DELETE (not just GET, POST in version1.1). Of course, this will be better supported by the RESTful web services. Still difficult for existing software packages because most of them support WSDL 1.1.

<strong><h2> What is SOAP? </h2> </strong>
SOAP stands for Simple Object Access Protocol. Established in 1998, the goal is to use it in the enterprise market. In particular, SOAP has to create application logic as a service. The goal is to be a new communication protocol.
<strong> Advantages </strong>
- able to work on any protocol
- Explain service with WDSL (Web Service Description Language)
- Reliable When a problem occurs, it can be retried.
- Security already exists, both authentication, authorization and data encryption.

<strong> Disadvantages </strong>
- Difficult to develop. Making it popular for web and Mobile
- supported data formats, XML alone
- because it is a standard, there is the limitation, but
- because of its many parts have overhead or need for bandwidth is higher than the REST

<strong> when they should. Use SOAP</strong>
- when managing transactions when working with multiple systems.
- When connecting to a strict connection between client/server
- When, for example, Finacial service and Telecommunication service,

so it's not strange that Why are these large organizations used SOAP so much

<strong><h2> What is REST?</h2></strong>
REST stands for Representational State Transfer, which has been established since 2000. The goal is to be one of the open web technology designs that want to put the data in the form of a resource. The actions follow the HTTP Verb or HTTP Method ( GET, POST, PUT, DELETE) and Stateless.

<strong> Advantages</strong>
- It is based on HTTP and conforms to HTTP standards, so it can be easily developed.
- Supports many data formats such as XML, JSON, Plain Text and many others.
- Support for Easy to expand the system
- Good performance
- Supports caching of data.

<strong>Disadvantages</strong>
- It works only with HTTP protocol.
- There is no built-in security and reliability, so do it yourself
- data formats sent between client-server There are no restrictions.

<strong>When to use REST</strong>
- when you want to reduce the amount of data and the amount of bandwidth used
- when needed when working on the web and mobile systems, for example, Social media service, Web Chat service,
so it's not strange why web and API systems Via web, therefore, is REST
This simple

For example how can start creating an application, including the necessary API calls
by JS
```javascript
fetch("https://covid3.p.rapidapi.com/", {
	"method": "POST",
	"headers": {
		"x-rapidapi-host": "covid3.p.rapidapi.com",
		"x-rapidapi-key": "1ed6c06b12mshea082b6e5cad417p1e4b9bjsn7c9153b73837",
		"content-type": "application/x-www-form-urlencoded"
	},
	"body": {}
})
.then(response => {
	console.log(response);
})
.catch(err => {
	console.log(err);
});
```