The difference between Web API and Web Service

 First, Web API Web Service is evolved, the relationship between the two is that they are all Web Service API, but not all are API Web Service. Secondly, both conducive to the transmission of information, but more flexible than the Web API Web Service. Finally, we look at the specific differences between them, and how we go distinction.

What is WEB Service?

      Quote a definition that is WebService call technical remote programming languages ​​and operating system platforms across a cross. Mainly it depends on the XML-RPC and SOAP (Simple Object Access Protocol) and other standards, interact through HTTP protocol. (Examples)

What is the Web API?

      API is a set of rules specified interactions between the application or the protocol can communicate with each other between software applications via the API. Web API can use any type of communications protocol, data exchange format XML and JSON. (Examples)

Web API and Web Service What are the differences?

      Web API and Web Service are achieved RPC (Remote Procedure Call) means of communication. Both support data transfer XML-based format, but in the actual production process Web API of common data type format mainly JSON.

When the Web Service and Web API to compare, or in both ways when RPC to choose, there is a key reference value, ie the caller and the provider of workload data serialization and de-serialization (packing and unpacking) of. JSON for serialization and de-serialization requires much more effort than usual XML serialization and de-serialization of less than XML and JSON is more lightweight, which is what makes parsing JSON faster rate in terms of demands on bandwidth lower.

      In addition, Web API client system (the caller) and service systems (providers) independently of one another, the caller can easily use different languages ​​(Java, Python, Ruby, etc.) call the API. Web Service is usually only in the interaction between the two systems, almost always relies on a similar XML-RPC interface to communicate with each other, and different clients in each browser parses XML inconsistent way, you need to repeat a lot of code.

      To summarize, Web Service to provide more suitable services for end to end scenarios, Web API is more suitable for the application to provide service application scenarios. This may also explain why the C / S (Client / Server) architecture program is still in use Web Service, and the B / S (browser / server) architecture rarely seen. Of course, whether you want Web API to achieve what, Web Service can do the same, after all, before the Web API Web Service has not yet born would be able to play the leading role of.

Guess you like

Origin www.cnblogs.com/realaction/p/11429253.html