我有Web服务URL,登录名和密码,但我无法理解这是SOAP或REST服务。
我知道SOAP是一种协议,REST只是一种架构,但我无法理解它们的机制之间的区别。
谢谢。
SOAP是一组用于Web服务协议的W3C specifications。简单来说,这些协议定义了用于提供和使用Web服务的XML“包装器”。
REST是一种不同的概念(如您所述); Wikipedia将其定义为“分布式系统的架构”;对于Web开发人员来说,这是一种配置URI方案以检索和更新资源的便捷方式。 HTTP GET到服务器/ customers / 1获取有关客户1的信息,HTTP PUT到相同的URI更新该客户。
在口语方面,REST是SOAP的轻量级替代品。也许您不需要SOAP提供的所有头,安全性和架构;或者你可能在带宽敏感的区域(如移动网络)工作,在那里你不需要所有的开销。 REST是引用该备用范例的简便方式,并且倾向于与其他技术(如JSON和AJAX)混为一谈,即使它们在技术上并不相关。
SOAP VS REST SOAP is a protocol. REST is an architectural style. SOAP stands for Simple Object Access Protocol. REST stands for REpresentational State Transfer. SOAP can't use REST because it is a protocol. REST can use SOAP web services because it is a concept and can use any protocol like HTTP, SOAP. SOAP uses services interfaces to expose the business logic. REST uses URI to expose business logic. SOAP defines standards to be strictly followed. REST does not define too much standards like SOAP. SOAP defines its own security. RESTful web services inherits security measures from the underlying transport. SOAP permits XML data format only. REST permits different data format such as Plain text, HTML, XML, JSON etc.