web服务和API之间的区别是什么?差异是否超过了传输数据所使用的协议? 谢谢。
当前回答
API是基于代码的集成,而web服务是基于消息的集成,与具有WSDL等契约的可互操作标准进行集成。
其他回答
检查这个http://en.wikipedia.org/wiki/Web_service
正如链接所提到的,Web API是Web服务中的一种开发,它很可能与Web 2.0相关,而基于SOAP的服务则被基于REST的通信所取代。请注意,REST服务不需要XML、SOAP或WSDL服务api定义,因此这与传统web服务有很大不同。
API是基于代码的集成,而web服务是基于消息的集成,与具有WSDL等契约的可互操作标准进行集成。
基本上,webservice是两台机器之间的一种通信方法,而API是一个公开的层,允许你对某些东西进行编程。
你可以有一个API,而与该API交互的主要方法是通过web服务。
技术定义(维基百科提供)是:
API
应用程序编程接口(API)是库和/或操作系统服务提供的一组例程、数据结构、对象类和/或协议,以支持应用程序的构建。
网络服务
Web服务(也称为Web服务)被W3C定义为“一种旨在支持网络上可互操作的机器对机器交互的软件系统”。
另一个例子:谷歌地图api vs谷歌方向api web服务,前者服务(交付)javascript文件到站点(然后可以用作api来制作新功能),后者是一个Rest web服务交付数据(json或xml格式),可以处理(但不用于api意义上)。
API(应用程序编程接口),完整的形式本身表明它是一个接口,允许你在其他应用程序接口的帮助或支持下为你的应用程序编程,它公开了一些对你的应用程序有用的功能。
E.g showing updated currency exchange rates on your website would need some third party Interface to program against unless you plan to have your own database with currency rates and regular updates to the same. This set of functionality is when already available with some one else and when they want to share it with others they have to have an endpoint to communicate with the others who are interested in such interactions so they deploy it on web by the means of web-services. This end point is nothing but interface of their application which you can program against hence API.