Web Services: A Web services are any bit of services that makes it accessible over the Internet and normalizes its correspondence through XML encoding. A customer conjures web services by sending a solicitation (for the most part as an XML message), and the services send back an XML response. Web services summon communication over a network, with HTTP as the most widely recognized methods for the network between the two frameworks. Web services are equivalent to SOA (Services Oriented Architecture) and fundamentally depend on measures, for example, XML-RPC and SOAP (Simple Object Access Protocol).
Components: All the standard web services work using the following components.
- SOAP (Simple Object Access Protocol)
- UDDI (Universal Description, Discovery and Integration)
- WSDL (Web Services Description Language)
Web APIs: API stands for Application Programming Interface. It is a collection of communication conventions and subroutines used by various programs to communicate between them. A developer can utilize different API apparatuses to make its program simpler and less complex. Likewise, an API encourages the developers with a proficient method to build up their product programs. Thus, in simple terms, an API determines how programming segments ought to associate with one another. It is a set of protocols and schedules, and its reactions are returned as JSON or XML in data. APIs can utilize any kind of communication convention and are not restricted similarly as a web service is.
Difference between Web Services and APIs:
|Web Services||Web API|
|Web services are a type of API, which must be accessed through a network connection.||APIs are application interfaces, implying that one application can communicate with another application in a standardized manner.|
|Web service is used for REST, SOAP and XML-RPC for communication.||API is used for any style of communication.|
|All Web services are APIs.||APIs are not web services.|
|It doesn’t have lightweight design, needs a SOAP convention to send or receive data over the system.||It has a light-weight architecture furthermore, useful for gadgets which have constrained transmission capacity like smart phones.|
|It provides supports only for the HTTP protocol.||It provides support for the HTTP/s protocol: URL Request/Response Headers, and so on.|
|It is not open source, however, can be devoured by any customer that comprehends xml.||It is an open source and also ships with .NET framework.|
|Web service supports only XML.||API supports XML and JSON.|
|Web Services can be hosted on IIS.||Web API can be hosted only on IIS and self.|