[{"createTime":1735734952000,"id":1,"img":"hwy_ms_500_252.jpeg","link":"https://activity.huaweicloud.com/cps.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=V1g3MDY4NTY=&utm_medium=cps&utm_campaign=201905","name":"华为云秒杀","status":9,"txt":"华为云38元秒杀","type":1,"updateTime":1735747411000,"userId":3},{"createTime":1736173885000,"id":2,"img":"txy_480_300.png","link":"https://cloud.tencent.com/act/cps/redirect?redirect=1077&cps_key=edb15096bfff75effaaa8c8bb66138bd&from=console","name":"腾讯云秒杀","status":9,"txt":"腾讯云限量秒杀","type":1,"updateTime":1736173885000,"userId":3},{"createTime":1736177492000,"id":3,"img":"aly_251_140.png","link":"https://www.aliyun.com/minisite/goods?userCode=pwp8kmv3","memo":"","name":"阿里云","status":9,"txt":"阿里云2折起","type":1,"updateTime":1736177492000,"userId":3},{"createTime":1735660800000,"id":4,"img":"vultr_560_300.png","link":"https://www.vultr.com/?ref=9603742-8H","name":"Vultr","status":9,"txt":"Vultr送$100","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":5,"img":"jdy_663_320.jpg","link":"https://3.cn/2ay1-e5t","name":"京东云","status":9,"txt":"京东云特惠专区","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":6,"img":"new_ads.png","link":"https://www.iodraw.com/ads","name":"发布广告","status":9,"txt":"发布广告","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":7,"img":"yun_910_50.png","link":"https://activity.huaweicloud.com/discount_area_v5/index.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=aXhpYW95YW5nOA===&utm_medium=cps&utm_campaign=201905","name":"底部","status":9,"txt":"高性能云服务器2折起","type":2,"updateTime":1735660800000,"userId":3}]
<>WebAPI :
1. 无状态,开源,部署在IIS和应用程序上 2. 基于HTTP协议,数据格式为纯文本,Response可以被Web
API的MediaTypeFormatter转换成任何格式,常用Json格式 3. 基于HTTP构建的一个轻量级框架。非常适合移动端客户端服务 4.
api类似于cs架构,用的协议和端口,是根据开发人员定义的。 需要同时开发客户端API和服务器端程序
<>WebService :
1. 有状态,不开源,只能部署在IIS上 2. 基于Soap协议,只支持HTTP协议,数据格式为XML, 3.
类似于bs架构,只需要开发服务器端,不需要开发客户端,客户端只要遵循soap协议,就可以调用
<>注:
1. 所有的WebService都是WebAPI,但所有的WebAPI并不是WebService。 Web
API的客户端系统(调用者)和服务系统(提供者)彼此独立,调用者可以轻易的使用不同的语言(Java,Python,Ruby等)进行API的调用。Web
Service通常仅在两个系统之间交互,几乎总是依赖于类似XML-RPC的接口来相互通信,并且不同的客户端下各浏览器对XML的解析方式不一致,需要重复编写很多代码
2. Web Service更加适合为端到端的场景提供服务,Web API则更加适合为应用到应用的场景提供服务。
这也可以解释为什么C/S(客户机/服务器)架构的程序还在沿用Web Service,而B/S(浏览器/服务器)架构几乎很少见到。当然,无论您想通过Web
API实现什么,Web Service同样也能做到,毕竟在Web API还没有诞生以前Web Service就已经可以独挑大梁了
3.名词解释
有状态:有数据存储功能。 有状态对象,就是有实例化的对象,可保存数据,是非线程安全,在不同方法调用间不保留任何状态。
无状态:一次性操作, 不能保存数据。无状态对象,就是没有实例化变量的对象,不能保存数据,是不变类,是线程安全的