Web API(Application Programming Interface) Services
In simple a Web API is a collection of standards or protocols for exchanging information between two devices or application
There are mainly two types of web services.
- RESTful web services
- SOAP web services
RESTful web services(REST Web API)
REST stands for REpresentational State Transfer. REST is an architectural style not a protocol. REST provides a lighter weight alternative. Instead of using XML to make a request, REST relies on a simple URL in many cases. In some situations you must provide additional information in special ways, but most Web services using REST rely exclusively on obtaining the needed information using the URL approach. REST can use four different HTTP 1.1 verbs (GET, POST, PUT, and DELETE) to perform tasks.
Rest Api URl, add key='YOUR-API-KEY', data='TYPE-OF-DATA', city='NAME-OF-CITY'
Ex. Rest URL: http://api.developerstips.com/data?key=DEMOAPIKEY123&data=test&city=bhubaneswer
SOAP web services(SOAP Web API)
SOAP stands for Simple Object Access Protocol. It is a XML-based protocol for accessing web services. SOAP is a W3C recommendation for communication between two applications. SOAP is XML based protocol. It is platform independent and language independent. By using SOAP, you will be able to interact with other programming language applications.
Difference betwwen REST and SOAP
No. | SOAP | REST |
---|---|---|
1) | SOAP is a protocol. | REST is an architectural style. |
2) | SOAP stands for Simple Object Access Protocol. | REST stands for REpresentational State Transfer. |
3) | SOAP can’t use REST because it is a protocol. | REST can use SOAP web services because it is a concept and can use any protocol like HTTP, SOAP. |
4) | SOAP uses services interfaces to expose the business logic. | REST uses URI to expose business logic. |
5) | JAX-WS is the java API for SOAP web services. | JAX-RS is the java API for RESTful web services. |
6) | SOAP defines standards to be strictly followed. | REST does not define too much standards like SOAP. |
7) | SOAP requires more bandwidth and resource than REST. | REST requires less bandwidth and resource than SOAP. |
8) | SOAP defines its own security. | RESTful web services inherits security measures from the underlying transport. |
9) | SOAP permits XML data format only. | REST permits different data format such as Plain text, HTML, XML, JSON etc. |
10) | SOAP is less preferred than REST. | REST more preferred than SOAP. |