SOAP vs REST

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SOAP vs REST相关的知识,希望对你有一定的参考价值。

SOAP: Simple Object Access Protocol, it‘s protocol.

REST: Representational State Transfer, it‘s architecture style.

 

SOAP supports many transport protocols: HTTP, SMTP etc. only support XML.

REST also supports many transport protocols, not only HTTP/HTTPS. support XML, JSON etc.

 

SOAP is like desktop-application, we need to define WSDL(IDDL) for client and server to communicate. XML-RPC. Client should have the knowledge.SOAP has additional pre-built WS-Security support. JAX-WS. Since it uses XML, the payload is somewhat larger.

REST is like broswer, we just need to know URI and resource. Resource + Methods. Client has no knowledge about details. Stateless, server will not save any state info. REST uses the security in HTTP if REST over HTTP. JAX-RES

Common HTTP Method: Get/Put/Post/Delete. These methods are not mapping to CRUD for DB.

Post: not only for create resource, but also for update, and any other non-standardized operations.

Put: replace resource, just ignore the current state. Replace the whole resource.

Patch: partial update, it will base on current state to just apply diff.

REST must adhere to HATEOAS(Hypermedia as the engine of application state). The available operations are returned in link instead of documentation. Client enters a REST application through a simple URL instead of fixed interfaces or WSDL.

 

以上是关于SOAP vs REST的主要内容,如果未能解决你的问题,请参考以下文章

SOAP知识点

JAVA 如何解析soap

SOAP1.1 VS SOAP1.2

soap-学习

elang(基于 yaws_soap_lib)soap 客户端的问题

2.SOAP 语法