First question: 什么是RESTful
?
The word rest is from Roy Thomas Fielding in his 2000 doctoral dissertation. Interested to see the paper here ', who is fielding? Click on the previous name to learn.
RESTful
What the hell is that? In a nutshell, it is: 一种架构设计风格,提供了设计原则和约束条件
, not architecture. The application or design that satisfies these constraints and principles is the RESTful
architecture or service.
Recommended reading: Zhang Shanyu Blog--rest Introduction
infoq--in Layman's rest
Second question:到底 REST 和 SOAP、RPC 有何区别?
The problem is bigger, you know what the difference between them first need to understand, they are what?
REST
The above is a simple explanation of what it is.
SOAP
What is a simple Object access protocol? SOAP是一种数据交换协议规范,是一种轻量的、简单的、基于XML的协议
the specification. What advantages does it have? A simple summary is: 易用,灵活,跨语言,跨平台
.
Ease of use: because its messages are based on xml
and encapsulated as compliant http
protocols, it conforms to the requirements of any router, firewall, or proxy server.
Flexible: Highly scalable, soap eliminates the need to disrupt existing applications, and SOAP clients, servers, and protocols can evolve themselves. And soap is a great way to support intermediate media and hierarchical architectures.
Cross-language: soap
It can be done in any language, as long as the correct request is sent soap
.
Cross-platform: soap
Service-based services can be used without modification on any platform.
RPC(远程调用框架)
is a mechanism that allows distributed applications to invoke services available on different computers on the network. Do not have much to dabble in, omit 256 words at a moment. There are familiar friends that can be added in the comments and then I will revise to that content to go
From the above we can see, REST 和 SOAP、RPC 有何区别
what? There is no big difference, their essence is to provide a basic service that can support distributed, the biggest difference is the different application scenarios brought by their respective characteristics.
REST
Can be looked at is a http
direct application of the protocol, the default based on json
as a transmission format, easy to use, learning cost inefficient, ~ ~ But the security is lower ~ ~, and SOAP
can be looked at is a heavyweight protocol, based on xml
, SOAP
in the security of the use XML-Security
of and XML-Signature
two specifications made up WS-Security
to achieve security control, has been supported by various manufacturers,. NET, PHP, Java has been very good support. This is a REST
weak place.
What is a PC (remote procedure Call)
- In a nutshell, RPC invokes a function or method (collectively referred to as a service) on the other machine (the server) on a machine (client), which is passed as a parameter, and results are returned.
- RPC hides the underlying communication details (no need to process socket or HTTP traffic directly)
- RPC is a request response model. The client initiates the request and the server returns a response (similar to how HTTP works)
- RPC calls a remote function (or method) as if it were called a local function (or method).
- Each has its own usage scenarios. If you create a distributed service that requires good security, you can consider soap if you require strong customization for the underlying implementation such as transport, and if the design implementation is simple, generally security requirements are not high enough to consider rest. This is only a general case, but the use of rest for resource-oriented services has a natural advantage.
What is the difference between REST and SOAP, RPC?