全部博文(214)
分类:
2007-09-06 11:07:56
REST=REpresentational State Transfer (代表性状态传输)
SOAP=Simple Object Access Protocol (简单对象访问协议)
REST就是用URI来代表资源,通过HTTP协议的Get, Post, Put, Delete方法来对资源进行操作。
下面是文章:REST vs. SOAP: The Battle of the Web Service Titans中对两者的总结:
REST
Messages are represented in plain XML HTTP is used for the transfer protocol HTTP verbs are used for access/manipulation commands URIs are used to uniquely identify resources in message HTTP authentication provides security There is no formal method for expressing the interface contract
SOAP
Messages are represented in a standardized XML SOAP "envelope" Can be bound to various protocols including HTTP and SMTP Access to and manipulation of data are application specific Security is not described by SOAP and is to be provided by the developer XML schemas are used to define the contract between client and service 如果不是企业级应用,还是REST好,简单易读、轻量级、高性能、没有那么多标准限制,看看下面这个图片就会明白为啥了:)