web服务和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.
其他回答
基本上,webservice是两台机器之间的一种通信方法,而API是一个公开的层,允许你对某些东西进行编程。
你可以有一个API,而与该API交互的主要方法是通过web服务。
技术定义(维基百科提供)是:
API
应用程序编程接口(API)是库和/或操作系统服务提供的一组例程、数据结构、对象类和/或协议,以支持应用程序的构建。
网络服务
Web服务(也称为Web服务)被W3C定义为“一种旨在支持网络上可互操作的机器对机器交互的软件系统”。
API是基于代码的集成,而web服务是基于消息的集成,与具有WSDL等契约的可互操作标准进行集成。
把Web服务看作Web api。API现在是一个通用术语,因此web服务是功能的接口,通常与业务相关,您可以通过各种协议从网络获得它。
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.
API是一个已发布的接口,它定义了组件a如何与组件B通信。
例如,Doubleclick发布了一个Java API,允许用户查询数据库表以获得有关其在线广告活动的信息。
例如,调用GetNumberClicks(用户名)
要实现API,必须将双击.jar文件添加到类路径中。这是本地呼叫。
web服务是API的一种形式,其中接口是通过WSDL定义的。这允许通过HTTP远程调用接口。
如果Doubleclick将其接口实现为web服务,那么他们将在Tomcat中使用类似Axis2的东西。
远程用户将调用web服务
例如调用GetNumberClicksWebService(用户名)
GetNumberClicksWebService服务将在本地调用GetNumberClicks。