简体   繁体   English

我们如何通过设计识别SOAP / REST服务?

[英]How can we identify SOAP/REST services by design?

There are number of resources available on line, but I would like to hear a clear idea, on how we can differentiate a service as SOAP/REST by looking at service design? 在线上有很多可用资源,但是我想听到一个明确的想法,即如何通过查看服务设计来区分服务是SOAP / REST还是? (not with wsdl/wadl) (不适用于wsdl / wadl)

How they differ in the architecture? 它们在架构上有何不同?

As an experienced user, you have probably read all the technical answers to similar questions already, such as this and this , so I will try a different kind of answer, a more metaphorical one. 作为有经验的用户,您可能已经阅读了类似问题的所有技术答案, 例如thisthis ,因此我将尝试另一种答案,比喻更隐喻。

Indeed, we can rephrase the REST vs SOAP debate, by looking at what is the main notion for each of them: 的确,我们可以通过看看REST SOAP的主要概念来改写REST SOAP的争论:

  • SOAP is about sending messages through a post office box, whatever the application domain is. 无论应用程序域是什么,SOAP都是通过邮政信箱发送消息。 The most important thing is that the envelope is valid. 最重要的是信封是有效的。 The other aspects (body of the message, location and number of "post offices", way to send it to the box) are secondary. 其他方面(邮件的正文,“邮局”的位置和数量,将其发送到邮箱的方式)是次要的。
  • REST is about doing things with resources ( aka "stuff" that can be identified in your application domain). REST是关于做的事情与资源又名 “东西”,可以在你的应用领域来确定)。 Because the actions are generic (create, read, update, delete), the most important things is the identification of resources (URIs), and their representation (in XML, JSON or whatever format). 因为操作是通用的(创建,读取,更新,删除),所以最重要的是识别资源(URI)及其表示形式(采用XML,JSON或任何格式)。

As an example, let's consider a book delivery service: 例如,让我们考虑一本书交付服务:

  • a SOAP version could provide a service endpoint to send: SOAP版本可以提供服务端点来发送:
    • book search requests 书籍搜寻要求
    • book detail requests 书籍详细要求
    • book order requests 预订订单要求
    • book order cancellation requests 预订订单取消请求
    • book order status requests 订单状态请求
    • book invoice requests 预订发票申请
  • a REST version would provide linked representations of: REST版本将提供以下内容的链接表示:
    • lists of books 书籍清单
    • details of a book 一本书的细节
    • orders/invoices of books 书籍订单/发票

With SOAP, you are defining endpoints for actions. 使用SOAP,您可以定义操作的端点。 With REST, you provide endpoints for things. 使用REST,您可以提供事物的端点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM