SOAP还是Web服务的REST ?

时间:2022-12-03 19:33:45

Is REST a better approach to doing Web Services or is SOAP? Or are they different tools for different problems? Or is it a nuanced issue - that is, is one slightly better in certain arenas than another, etc?

REST是做Web服务的更好方法还是SOAP?或者它们是针对不同问题的不同工具?或者这是一个微妙的问题——也就是说,在某些领域,一个比另一个更好,等等?

Bounty-Edit:

Bounty-Edit:

Now, almost three years later I would like to ask this question again - offering a bounty to encourage an indepth answer. I would especially appreciate information about those concepts and their relation to the PHP-universe and also modern high-end web-applications.

现在,差不多三年后,我想再次问这个问题——提供一笔赏金,来鼓励一个不确定的答案。我尤其希望了解这些概念及其与PHP-universe和现代高端web应用程序的关系。

28 个解决方案

#1


548  

I built one of the first SOAP servers, including code generation and WSDL generation, from the original spec as it was being developed, when I was working at Hewlett-Packard. I do NOT recommend using SOAP for anything.

在我在惠普工作的时候,我建立了第一批SOAP服务器,包括代码生成和WSDL生成。我不建议使用SOAP做任何事情。

The acronym "SOAP" is a lie. It is not Simple, it is not Object-oriented, it defines no Access rules. It is, arguably, a Protocol. It is Don Box's worst spec ever, and that's quite a feat, as he's the man who perpetrated "COM".

缩写“SOAP”是一个谎言。它不是简单的,它不是面向对象的,它定义了没有访问规则。可以说,这是一种协议。这是唐·博克史上最糟糕的天赋,这是一个相当了不起的成就,因为他是犯下“COM”的人。

There is nothing useful in SOAP that can't be done with REST for transport, and JSON, XML, or even plain text for data representation. For transport security, you can use https. For authentication, basic auth. For sessions, there's cookies. The REST version will be simpler, clearer, run faster, and use less bandwidth.

SOAP中没有什么有用的东西是不能用REST进行传输的,JSON、XML甚至是纯文本进行数据表示的。对于传输安全性,可以使用https。进行验证,基本认证。对于会话,有饼干。REST版本将更简单、更清晰、运行得更快、使用更少的带宽。

XML-RPC clearly defines the request, response, and error protocols, and there are good libraries for most languages. However, XML is heavier than you need for many tasks.

XML-RPC明确地定义了请求、响应和错误协议,并且对于大多数语言都有很好的库。但是,XML比许多任务所需要的要重。

#2


193  

REST is an architecture, SOAP is a protocol.

REST是一个体系结构,SOAP是一个协议。

That's the first problem.

这是第一个问题。

You can send SOAP envelopes in a REST application.

您可以在REST应用程序中发送SOAP信封。

SOAP itself is actually pretty basic and simple, it's the WSS-* standards on top of it that make it very complex.

SOAP本身实际上是非常基本和简单的,它上面的WSS-*标准使它非常复杂。

If your consumers are other applications and other servers, there's a lot of support for the SOAP protocol today, and the basics of moving data is essentially a mouse-click in modern IDEs.

如果您的消费者是其他应用程序和其他服务器,那么现在有很多对SOAP协议的支持,移动数据的基础本质上就是现代ide中的鼠标点击。

If your consumers are more likely to be RIAs or Ajax clients, you will probably want something simpler than SOAP, and more native to the client (notably JSON).

如果您的客户更可能是ria或Ajax客户端,那么您可能需要比SOAP更简单的东西,并且更适合于客户端(特别是JSON)。

JSON packets sent over HTTP is not necessarily a REST architecture, it's just messages to URLs. All perfectly workable, but there are key components to the REST idiom. It is easy to confuse the two however. But just because you're talking HTTP requests does not necessarily mean you have a REST architecture. You can have a REST application with no HTTP at all (mind, this is rare).

通过HTTP发送的JSON数据包不一定是REST架构,它只是指向url的消息。所有这些都是完全可行的,但是REST习语有一些关键的组件。然而,很容易将两者混淆。但是,仅仅因为您正在谈论HTTP请求,并不一定意味着您拥有一个REST架构。您可以有一个完全没有HTTP的REST应用程序(注意,这很少见)。

So, if you have servers and consumers that are "comfortable" with SOAP, SOAP and WSS stack can serve you well. If you're doing more ad hoc things and want to better interface with web browsers, then some lighter protocol over HTTP can work well also.

因此,如果您的服务器和消费者对SOAP、SOAP和WSS堆栈感到“舒适”,那么它们可以很好地为您服务。如果您正在做更多的特别的事情,并且想要更好地与web浏览器进行交互,那么在HTTP上的一些轻量级协议也可以很好地工作。

#3


100  

REST is a fundamentally different paradigm from SOAP. A good read on REST can be found here: How I explained REST to my wife.

REST是与SOAP完全不同的范例。这里有一篇关于休息的好文章:我是如何向我的妻子解释休息的。

If you don't have time to read it, here's the short version: REST is a bit of a paradigm shift by focusing on "nouns", and restraining the number of "verbs" you can apply to those nouns. The only allowed verbs are "get", "put", "post" and "delete". This differs from SOAP where many different verbs can be applied to many different nouns (i.e. many different functions).

如果你没有时间阅读,这里有一个简短的版本:休息是一种范式转换,主要集中在“名词”上,并限制你可以应用于这些名词的“动词”的数量。唯一允许使用的动词是“get”、“put”、“post”和“delete”。这与SOAP不同,SOAP可以将许多不同的动词应用于许多不同的名词(即许多不同的函数)。

For REST, the four verbs map to the corresponding HTTP requests, while the nouns are identified by URLs. This makes state management much more transparent than in SOAP, where its often unclear what state is on the server and what is on the client.

在REST中,这四个动词映射到相应的HTTP请求,而名词由url标识。这使得状态管理比SOAP中透明得多,SOAP中常常不清楚服务器上的状态和客户机上的状态。

In practice though most of this falls away, and REST usually just refers to simple HTTP requests that return results in JSON, while SOAP is a more complex API that communicates by passing XML around. Both have their advantages and disadvantages, but I've found that in my experience REST is usually the better choice because you rarely if ever need the full functionality you get from SOAP.

在实践中,虽然大多数都失败了,但是REST通常只引用返回JSON结果的简单HTTP请求,而SOAP是通过传递XML进行通信的更复杂的API。两者都有各自的优缺点,但是我发现在我的经验中REST通常是更好的选择,因为您很少需要从SOAP获得的全部功能。

#4


56  

Quick lowdown for 2012 question:

快速了解2012年的问题:

Areas that REST works really well for are:

休息真正有效的领域是:

  • Limited bandwidth and resources. Remember the return structure is really in any format (developer defined). Plus, any browser can be used because the REST approach uses the standard GET, PUT, POST, and DELETE verbs. Again, remember that REST can also use the XMLHttpRequest object that most modern browsers support today, which adds an extra bonus of AJAX.

    有限的带宽和资源。记住,返回结构实际上是任何格式(开发人员定义的)。另外,任何浏览器都可以使用,因为REST方法使用标准的GET、PUT、POST和DELETE谓词。同样,请记住REST也可以使用大多数现代浏览器支持的XMLHttpRequest对象,这增加了AJAX的额外好处。

  • Totally stateless operations. If an operation needs to be continued, then REST is not the best approach and SOAP may fit it better. However, if you need stateless CRUD (Create, Read, Update, and Delete) operations, then REST is it.

    完全无状态的操作。如果需要继续操作,那么REST不是最好的方法,SOAP可能更适合它。但是,如果您需要无状态CRUD(创建、读取、更新和删除)操作,那么REST就是它了。

  • Caching situations. If the information can be cached because of the totally stateless operation of the REST approach, this is perfect.That covers a lot of solutions in the above three.

    缓存的情况。如果由于REST方法的完全无状态操作,可以缓存信息,那么这是完美的。这涵盖了上面三种方法中的许多解决方案。

So why would I even consider SOAP? Again, SOAP is fairly mature and well-defined and does come with a complete specification. The REST approach is just that, an approach and is wide open for development, so if you have the following then SOAP is a great solution:

那么,我为什么还要考虑使用SOAP呢?同样,SOAP是相当成熟和定义良好的,并且附带完整的规范。REST方法就是这样一种方法,对开发是开放的,所以如果您有以下内容,那么SOAP就是一个很好的解决方案:

  • Asynchronous processing and invocation. If your application needs a guaranteed level of reliability and security then SOAP 1.2 offers additional standards to ensure this type of operation. Things like WSRM – WS-Reliable Messaging.

    异步处理和调用。如果您的应用程序需要一个有保证的可靠性和安全性级别,那么SOAP 1.2提供了额外的标准来确保这种类型的操作。诸如WSRM - ws - reliability的消息传递。

  • Formal contracts. If both sides (provider and consumer) have to agree on the exchange format then SOAP 1.2 gives the rigid specifications for this type of interaction.

    正式的合同。如果双方(提供者和使用者)都必须同意交换格式,那么SOAP 1.2为这种类型的交互提供了严格的规范。

  • Stateful operations. If the application needs contextual information and conversational state management then SOAP 1.2 has the additional specification in the WS* structure to support those things (Security, Transactions, Coordination, etc). Comparatively, the REST approach would make the developers build this custom plumbing.

    有状态操作。如果应用程序需要上下文信息和会话状态管理,那么SOAP 1.2在WS*结构中有额外的规范来支持这些内容(安全性、事务、协调等等)。相对而言,REST方法将使开发人员构建这种自定义管道。

http://www.infoq.com/articles/rest-soap-when-to-use-each

http://www.infoq.com/articles/rest-soap-when-to-use-each

#5


44  

SOAP currently has the advantage of better tools where they will generate a lot of the boilerplate code for both the service layer as well as generating clients from any given WSDL.

SOAP目前具有更好的工具,它们将为服务层生成大量的样板代码,并从任何给定的WSDL生成客户端。

REST is simpler, can be easier to maintain as a result, lies at the heart of Web architecture, allows for better protocol visibility, and has been proven to scale at the size of the WWW itself. Some frameworks out there help you build REST services, like Ruby on Rails, and some even help you with writing clients, like ADO.NET Data Services. But for the most part, tool support is lacking.

REST更简单,因此更容易维护,位于Web架构的核心,允许更好的协议可见性,并且已经被证明可以在WWW本身的大小上伸缩。有些框架可以帮助您构建REST服务,如Ruby on Rails,有些甚至可以帮助您编写客户机,如ADO。净数据服务。但是在大多数情况下,工具支持是缺乏的。

#6


40  

SOAP is useful from a tooling perspective because the WSDL is so easily consumed by tools. So, you can get Web Service clients generated for you in your favorite language.

从工具的角度来看,SOAP是有用的,因为工具很容易使用WSDL。因此,您可以使用您喜欢的语言生成Web服务客户端。

REST plays well with AJAX'y web pages. If you keep your requests simple, you can make service calls directly from your JavaScript, and that comes in very handy. Try to stay away from having any namespaces in your response XML, I've seen browsers choke on those. So, xsi:type is probably not going to work for you, no overly complex XML Schemas.

REST在AJAX web页面上运行良好。如果您让请求保持简单,您可以直接从JavaScript进行服务调用,这非常方便。尽量不要在响应XML中使用任何名称空间,我曾看到浏览器在这些名称空间上出现问题。因此,xsi:type可能不会适合您,没有过于复杂的XML模式。

REST tends to have better performance as well. CPU requirements of the code generating REST responses tend to be lower than what SOAP frameworks exhibit. And, if you have your XML generation ducks lined up on the server side, you can effectively stream XML out to the client. So, imagine you're reading rows of database cursor. As you read a row, you format it as an XML element, and you write that directly out to the service consumer. This way, you don't have to collect all of the database rows in memory before starting to write your XML output - you read and write at the same time. Look into novel templating engines or XSLT to get the streaming to work for REST.

休息往往也有更好的表现。生成REST响应的代码的CPU需求往往低于SOAP框架所显示的。而且,如果您的XML生成鸭子在服务器端排列,您可以有效地将XML流到客户端。假设您正在读取数据库光标的行。在读取一行时,将其格式化为XML元素,并将其直接写入服务使用者。这样,在开始编写XML输出之前,您不必收集内存中的所有数据库行——您可以同时读写。请查看新的模板引擎或XSLT,以使流在REST中工作。

SOAP on the other hand tends to get generated by tool-generated services as a big blob and only then written. This is not an absolute truth, mind you, there are ways to get streaming characteristics out of SOAP, like by using attachments.

另一方面,SOAP往往是由工具生成的服务作为一个大的blob生成,然后才写入。注意,这并不是绝对的事实,有一些方法可以从SOAP中获取流特性,比如使用附件。

My decision making process is as follows: if I want my service to be easily tooled by consumers, and the messages I write will be medium-to-small-ish (10MB or less), and I don't mind burning some extra CPU cycles on the server, I go with SOAP. If I need to serve to AJAX on web browsers, or I need the thing to stream, or my responses are gigantic, I go REST.

我的决策过程如下:如果我想让我的服务易于被消费者使用,并且我所写的消息将是中等到小(10MB或更小),并且我不介意在服务器上消耗一些额外的CPU周期,我使用SOAP。如果我需要在web浏览器上为AJAX服务,或者我需要流数据,或者我的响应很大,我就休息一下。

Finally, there are lots of great standards built up around SOAP, like WS-Security and getting stateful Web Services, that you can plug in to if you're using the right tools. That kind of stuff really makes a difference, and can help you satisfy some hairy requirements.

最后,围绕SOAP构建了许多很棒的标准,如WS-Security和获取有状态Web服务,如果您使用了正确的工具,您可以插入这些标准。这些东西真的很重要,可以帮助你满足一些棘手的要求。

#7


29  

I know this is an old question but I have to post my answer - maybe someone will find it useful. I can't believe how many people are recommending REST over SOAP. I can only assume these people are not developers or have never actually implemented a REST service of any reasonable size. Implementing a REST service takes a LOT longer than implementing a SOAP service. And in the end it comes out a lot messier, too. Here are the reasons I would choose SOAP 99% of the time:

我知道这是个老问题,但我得把我的答案贴出来——也许有人会觉得它有用。我不敢相信有多少人推荐休息而不是肥皂。我只能假设这些人不是开发人员,或者从来没有实现过任何合理大小的REST服务。实现REST服务要比实现SOAP服务花费的时间长得多。最后,它也变得更加混乱。以下是99%的时候我选择肥皂的原因:

1) Implementing a REST service takes infinitely longer than implementing a SOAP service. Tools exist for all modern languages/frameworks/platforms to read in a WSDL and output proxy classes and clients. Implementing a REST service is done by hand and - get this - by reading documentation. Furthermore, while implementing these two services, you have to make "guesses" as to what will come back across the pipe as there is no real schema or reference document.

1)实现REST服务比实现SOAP服务要花费无限长的时间。所有现代语言/框架/平台都可以在WSDL和输出代理类和客户端中读取工具。实现REST服务是手工完成的,通过阅读文档来实现。此外,在实现这两个服务时,您必须“猜测”管道中返回的内容,因为没有真正的模式或引用文档。

2) Why write a REST service that returns XML anyway? The only difference is that with REST you don't know the types each element/attribute represents - you are on your own to implement it and hope that one day a string doesn't come across in a field you thought was always an int. SOAP defines the data structure using the WSDL so this is a no-brainer.

为什么要编写一个返回XML的REST服务呢?唯一的区别是,在休息你不知道每个元素/属性代表类型——你自己实现它,希望有一天,一个字符串不遇到一个领域你认为总是int。使用WSDL SOAP定义了数据结构这是显而易见的。

3) I've heard the complaint that with SOAP you have the "overhead" of the SOAP Envelope. In this day and age, do we really need to worry about a handful of bytes?

我听人抱怨说,用肥皂你有肥皂信封的“开销”。在这个时代,我们真的需要担心一些字节吗?

4) I've heard the argument that with REST you can just pop the URL into the browser and see the data. Sure, if your REST service is using simple or no authentication. The Netflix service, for instance, uses OAuth which requires you to sign things and encode things before you can even submit your request.

4)我听过这样的说法:REST可以将URL弹出到浏览器中并查看数据。当然,如果您的REST服务使用简单或不使用身份验证。例如,Netflix服务使用OAuth,它要求你在提交请求之前先进行签名和编码。

5) Why do we need a "readable" URL for each resource? If we were using a tool to implement the service, do we really care about the actual URL?

5)为什么每个资源都需要一个“可读”的URL ?如果我们使用工具来实现服务,我们真的关心实际的URL吗?

Need I go on?

我需要继续吗?

#8


19  

Most of the applications I write are server-side C# or Java, or desktop applications in WinForms or WPF. These applications tend to need a richer service API than REST can provide. Plus, I don't want to spend any more than a couple minutes creating my web service client. The WSDL processing client generation tools allow me to implement my client and move on to adding business value.

我编写的大多数应用程序是服务器端c#或Java,或WinForms或WPF中的桌面应用程序。这些应用程序往往需要比REST提供的更丰富的服务API。另外,我不想花超过几分钟来创建我的web服务客户机。WSDL处理客户端生成工具允许我实现我的客户端并继续添加业务价值。

Now, if I were writing a web service explicitly for some javascript ajax calls, it'd probably be in REST; just for the sake knowing the client technology and leveraging JSON. In my opinion, web service APIs used from javascript probably shouldn't be very complex, as that type of complexity seems to be better handled server-side.

现在,如果我为一些javascript ajax调用显式地编写web服务,它可能会处于REST中;只是为了了解客户端技术并利用JSON。在我看来,从javascript使用的web服务api可能不应该非常复杂,因为这种复杂性似乎可以更好地处理服务器端。

With that said, there some SOAP clients for javascript; I know jQuery has one. Thus, SOAP can be leveraged from javascript; just not as nicely as a REST service returning JSON strings. So if I had a web service that I wanted to be complex enough that it was flexible for an arbitrary number of client technologies and uses, I'd go with SOAP.

也就是说,javascript有一些SOAP客户机;我知道jQuery有一个。因此,可以从javascript使用SOAP;只是没有REST服务返回JSON字符串那么好。因此,如果我有一个web服务,我希望它足够复杂,能够灵活地用于任意数量的客户端技术和使用,那么我将使用SOAP。

#9


17  

I'd recommend you go with REST first - if you're using Java look at JAX-RS and the Jersey implementation. REST is much simpler and easy to interop in many languages.

我建议您首先使用REST—如果您使用Java,请查看JAX-RS和Jersey实现。在许多语言中,REST更简单、更容易交互。

As others have said in this thread, the problem with SOAP is its complexity when the other WS-* specifications come in and there are countless interop issues if you stray into the wrong parts of WSDL, XSDs, SOAP, WS-Addressing etc.

正如这个线程中其他人所说的,SOAP的问题在于当其他WS-*规范出现时它的复杂性,如果您误入WSDL、xsd、SOAP、WS- addressing等的错误部分,就会遇到无数的互操作问题。

The best way to judge the REST v SOAP debate is look on the internet - pretty much all the big players in the web space, google, amazon, ebay, twitter et al - tend to use and prefer RESTful APIs over the SOAP ones.

判断REST v SOAP辩论的最好方法是看互联网——几乎所有web空间的大玩家,谷歌、amazon、ebay、twitter等都倾向于使用REST api,而不是SOAP。

The other nice approach to going with REST is that you can reuse lots of code and infratructure between a web application and a REST front end. e.g. rendering HTML versus XML versus JSON of your resources is normally pretty easy with frameworks like JAX-RS and implicit views - plus its easy to work with RESTful resources using a web browser

使用REST的另一个好方法是,您可以重用web应用程序和REST前端之间的大量代码和基础结构。在使用JAX-RS和隐式视图等框架时,呈现HTML和XML相对于JSON是相当容易的,而且使用web浏览器可以轻松地使用RESTful资源。

#10


16  

I'm sure Don Box created SOAP as a joke - 'look you can call RPC methods over the web' and today groans when he realises what a bloated nightmare of web standards it has become :-)

我确信Don Box创造了SOAP作为一个笑话——“看,你可以通过web调用RPC方法”,今天当他意识到它已经成为一个多么膨胀的web标准噩梦时,他呻吟道:

REST is good, simple, implemented everywhere (so more a 'standard' than the standards) fast and easy. Use REST.

休息是好的,简单的,在任何地方都可以实现(所以比标准更像是一个“标准”),快速和容易。使用REST。

#11


15  

I think that both has its own place. In my opinion:

我认为两者都有自己的位置。在我看来:

SOAP: A better choice for integration between legacy/critical systems and a web/web-service system, on the foundation layer, where WS-* make sense (security, policy, etc.).

SOAP:对遗留/关键系统和web/web服务系统集成的更好的选择,在基础层上,WS-*有意义(安全性、策略等)。

RESTful: A better choice for integration between websites, with public API, on the TOP of layer (VIEW, ie, javascripts taking calls to URIs).

RESTful:在网站间集成公共API的更好选择。

#12


13  

One thing that hasn't been mentioned is that a SOAP envelope can contain headers as well as body parts. This lets you use the full expressiveness of XML to send and receive out of band information. REST, as far as I know, limits you to HTTP Headers and result codes.

还没有提到的一点是SOAP信封可以包含头部和身体部分。这使您可以使用XML的全部表达性来发送和接收带外信息。据我所知,REST限制您使用HTTP头和结果代码。

(otoh, can you use cookies with a REST service to send "header"-type out of band data?)

(otoh,您是否可以使用带有REST服务的cookie来发送“header”——带外数据类型?)

#13


10  

Answering the 2012 refreshed (by the second bounty) question, and reviewing the today's results (other answers).

回答了2012年的问题(第二个赏金),并回顾了今天的结果(其他答案)。


SOAP, pros and cons

About SOAP 1.2, advantages and drawbacks when comparing with "REST"... Well, since 2007 you can describe REST Web services with WSDL, and using SOAP protocol... That is, if you work a little harder, all W3C standards of the web services protocol stack can be REST!

关于SOAP 1.2,与“REST”相比的优缺点……自2007年以来,您可以使用WSDL和SOAP协议来描述REST Web服务……也就是说,如果您稍微努力一点,那么web服务协议栈的所有W3C标准都可以是REST!

It is a good starting point, because we can imagine a scenario in which all the philosophical and methodological discussions are temporarily avoided. We can compare technically "SOAP-REST" with "NON-SOAP-REST" in similar services,

这是一个很好的起点,因为我们可以想象一个场景,在这个场景中,所有哲学和方法上的讨论都暂时避免了。我们可以将技术上的“SOAP-REST”与类似服务中的“非SOAP-REST”进行比较,

  • SOAP-REST (="REST-SOAP"): as showed by L.Mandel, WSDL2 can describe a REST webservice, and, if we suppose that exemplified XML can be enveloped in SOAP, all the implementation will be "SOAP-REST".

    SOAP-REST (="REST-SOAP"):如L所示。Mandel、WSDL2可以描述REST web服务,如果我们假设示例的XML可以封装在SOAP中,那么所有的实现都将是“SOAP-REST”。

  • NON-SOAP-REST: any REST web service that can not be SOAP... That is, "90%" of the well-knowed REST examples. Some not use XML (ex. typical AJAX RESTs use JSON instead), some use another XML strucutures, without the SOAP headers or rules. PS: to avoid informality, we can suppose REST level 2 in the comparisons.

    非SOAP-REST:任何不能是SOAP的REST web服务…也就是说,“90%”的良好的REST示例。有些不使用XML(例如,典型的AJAX rest使用JSON),有些使用另一个XML结构,没有SOAP头或规则。PS:为了避免不拘礼节,我们可以在比较中假设休息等级2。

Of course, to compare more conceptually, compare "NON-REST-SOAP" with "NON-SOAP-REST", as different modeling approaches. So, completing this taxonomy of web services:

当然,要在概念上进行比较,请将“非rest - soap”与“非soap - rest”进行比较,因为建模方法不同。因此,完成web服务的分类:

  • NON-REST-SOAP: any SOAP web service that can not be REST... That is, "90%" of the well-knowed SOAP examples.

    非REST-SOAP:任何不能是REST的SOAP web服务…也就是说,“90%”的成熟的SOAP示例。

  • NON-REST-NEITHER-SOAP: yes, the universe of "web services modeling" comprises other things (ex. XML-RPC).

    非rest - neithersoap:是的,“web服务建模”的宇宙包含其他东西(例如XML-RPC)。

SOAP in the REST condictions

Comparing comparable things: SOAP-REST with NON-SOAP-REST.

比较类似的东西:SOAP-REST和非SOAP-REST。

PROS

Explaining some terms,

解释一些术语,

  • Contractual stability: for all kinds of contracts (as "written agreements"),

    合同稳定性:适用于各类合同(如“书面协议”),

    • By the use of standars: all levels of the W3C stack are mutually compliant. REST, by other hand, is not a W3C or ISO standard, and have no normatized details about service's peripherals. So, as I, @DaveWoldrich(20 votes), @cynicalman(5), @Exitos(0) said before, in a context where are NEED FOR STANDARDS, you need SOAP.

      通过使用标准:W3C堆栈的所有级别都是相互兼容的。另一方面,REST不是W3C或ISO标准,也没有关于服务外围设备的规范化细节。所以,我,@DaveWoldrich(20票),@ alman(5), @Exitos(0)之前说过,在需要标准的环境中,你需要SOAP。

    • By the use of best practices: the "verbose aspect" of the W3C stack implementations, translates relevant human/legal/juridic agreements.

      通过使用最佳实践:W3C堆栈实现的“详细方面”,翻译相关的人工/法律/法律协议。

  • Robustness: the safety of SOAP structure and headers. With metada communication (with the full expressiveness of XML) and verification you have an "insurance policy" against any changes or noise.
    SOAP have "transactional reliability (...) deal with communication failures. SOAP has more controls around retry logic and thus can provide more end-to-end reliability and service guarantees", E. Terman.

    健壮性:SOAP结构和头的安全性。使用metada通信(具有XML的完整表达能力)和验证,您就有了针对任何更改或噪音的“保险策略”。SOAP具有“事务可靠性(……)处理通信失败”。SOAP对重试逻辑有更多的控制,因此可以提供更多的端到端可靠性和服务保证。

Sorting pros by popularity,

排序优点的流行,

  • Better tools (~70 votes): SOAP currently has the advantage of better tools, since 2007 and still 2012, because it is a well-defined and widely accepted standard. See @MarkCidade(27 votes), @DaveWoldrich(20), @JoshM(13), @TravisHeseman(9).

    更好的工具(大约70张选票):SOAP目前拥有更好的工具的优势,从2007年开始一直到2012年,因为它是一个定义明确且被广泛接受的标准。参见@MarkCidade(27张选票),@DaveWoldrich(20), @JoshM(13), @TravisHeseman(9)。

  • Standars compliance (25 votes): as I, @DaveWoldrich(20 votes), @cynicalman(5), @Exitos(0) said before, in a context where are NEED FOR STANDARDS, you need SOAP.

    标准遵从性(25票):正如我、@DaveWoldrich(20票)、@犬儒主义者(5票)、@Exitos(0票)之前所说,在需要标准的环境中,您需要SOAP。

  • Robustness: insurance of SOAP headers, @JohnSaunders (8 votes).

    健壮性:SOAP header的保险,@JohnSaunders(8张选票)。

CONS

  • SOAP strucuture is more complex (more than 300 votes): all answers here, and sources about "SOAP vs REST", manifest some degree of dislike with SOAP's redundancy and complexity. This is a natural consequence of the requirements for formal verification (see below), and for robustness (see above). "REST NON-SOAP" (and XML-RPC, the SOAP originator) can be more simple and informal.

    SOAP结构更加复杂(超过300张选票):这里的所有答案,以及“SOAP vs REST”的来源,都表明了SOAP的冗余和复杂性在某种程度上的不喜欢。这是正式验证(见下面)和健壮性(见上面)需求的自然结果。“REST NON-SOAP”(和XML-RPC, SOAP发起者)可以更加简单和非正式。

  • The "only XML" restriction is a performance obstacle when using tiny services (~50 votes): see json.org/xml and this question, or this other one. This point is showed by @toluju(41), and others.
    PS: as JSON is not a IETF standard, but we can consider a de facto standard for web software community.

    “唯一的XML”限制是使用小服务时的性能障碍(~50投票):参见json.org/xml和这个问题,或另一个问题。这一点由@toluju(41)和其他人展示。PS:因为JSON不是IETF标准,但是我们可以考虑一个事实上的web软件社区标准。


Modeling services with SOAP

Now, we can add SOAP-NON-REST with NON-SOAP-REST comparisons, and explain when is better to use SOAP:

现在,我们可以添加SOAP- non - rest和非SOAP- rest比较,并解释什么时候使用SOAP更好:

  • Need for standards and stable contracts (see "PROS" section). PS: see a typical "B2B need for standards" described by @saille.

    需要标准和稳定的合同(参见“专业人员”一节)。请参见@saille所描述的典型“B2B标准需求”。

  • Need for tools (see "PROS" section). PS: standards, and the existence of formal verifications (see bellow), are important issues for the tools automation.

    需要工具(请参阅“专业人员”一节)。标准和形式验证的存在(见下面)是工具自动化的重要问题。

  • Parallel heavy processing (see "Context/Foundations" section below): with bigger and/or slower processes, no matter with a bit more complexity of SOAP, reliability and stability are the best investments.

    并行重处理(请参阅下面的“上下文/基础”部分):对于较大和/或较慢的流程,无论SOAP的复杂性有多高,可靠性和稳定性都是最好的投资。

  • Need more security: when more than HTTPS is required, and you really need additional features for protection, SOAP is a better choice (see @Bell, 32 votes). "Sending the message along a path more complicated than request/response or over a transport that does not involve HTTP", S. Seely. XML is a core issue, offering standards for XML Encryption, XML Signature, and XML Canonicalization, and, only with SOAP you can to embed these mechanisms into a message by a well-accepted standard as WS-Security.

    需要更多的安全性:当需要超过HTTPS的安全性时,并且需要额外的保护特性时,SOAP是更好的选择(参见@Bell, 32选票)。“以比请求/响应更复杂的路径或不涉及HTTP的传输方式发送消息”,S. Seely说。XML是一个核心问题,它为XML加密、XML签名和XML规范化提供了标准,而且只有使用SOAP,您才能通过公认的WS-Security标准将这些机制嵌入到消息中。

  • Need more flexibility (less restrictions): SOAP not need exact correspondence with an URI; not nedd restrict to HTTP; not need to restrict to 4 verbs. As @TravisHeseman (9 votes) says, if you wanted something "flexible for an arbitrary number of client technologies and uses", use SOAP.
    PS: remember that XML is more universal/expressive than JSON (et al).

    需要更大的灵活性(更少的限制):SOAP不需要与URI进行精确的通信;不受nedd限制为HTTP;不需要限定4个动词。正如@TravisHeseman(9票)所说,如果你想要“任意数量的客户端技术和使用的灵活性”,请使用SOAP。请记住,XML比JSON更通用/更有表现力。

  • Need for formal verifications: important to understand that W3C stack uses formal methods, and REST is more informal. Your WSDL (a formal language) service description is a formal specification of your web services interfaces, and SOAP is a robust protocol that accept all possible WSDL prescriptions.

    需要正式的验证:重要的是要理解W3C堆栈使用正式的方法,而REST则更为非正式。您的WSDL(正式语言)服务描述是web服务接口的正式规范,SOAP是一个健壮的协议,接受所有可能的WSDL解决方案。

CONTEXT

Historical

To assess trends is necessary historical perspective. For this subject, a 10 or 15 years perspective...

评估趋势是必要的历史观点。对于这个问题,从10年或15年的角度来看……

Before the W3C standardization, there are some anarchy. Was difficult to implement interoperable services with different frameworks, and more difficult, costly, and time consuming to implement something interoperable between companys. The W3C stack standards has been a light, a north for interoperation of sets of complex web services.

在W3C标准化之前,存在一些混乱。很难用不同的框架实现可互操作的服务,实现公司间可互操作的服务则更加困难、昂贵和耗时。W3C堆栈标准是一个轻量级的标准,是一套复杂web服务之间的互操作。

For day-by-day tasks, like to implement AJAX, SOAP is heavy... So, the need for simple approaches need to elect a new theory-framework... And big "Web software players", as Google, Amazon, Yahoo, et al, elected the best alternative, that is the REST approach. Was in this context that REST concept arrived as a "competing framework", and, today (2012's), this alternative is a de facto standard for programmers.

对于日复一日的任务,比如实现AJAX, SOAP是沉重的……因此,对简单方法的需求需要选择一个新的理论框架……而大型的“网络软件玩家”,如谷歌、亚马逊、雅虎等,则选择了最好的选择,那就是REST方法。在这样的背景下,REST概念作为一个“竞争框架”出现了,而今天(2012年),这个替代方案实际上是程序员的标准。

Foundations

In a context of Parallel Computing the web services provides parallel subtasks; and protocols, like SOAP, ensures good synchronization and communication. Not "any task": web services can be classified as
coarse-grained and embarrassing parallelism.

在并行计算的上下文中,web服务提供并行子任务;协议,如SOAP,确保良好的同步和通信。不是“任何任务”:web服务可以归类为粗粒度和令人尴尬的并行。

As the task gets bigger, it becomes less significant "complexity debate", and becomes more relevant the robustness of the communication and the solidity of the contracts.

随着任务变得越来越大,“复杂性辩论”就变得不那么重要了,并且变得更加贴近于通信的健壮性和合同的可靠性。

#14


9  

It's nuanced.

这是微妙的。

If you need to have other systems interface with your services, than a lot of clients will be happier with SOAP, due to the layers of "verification" you have with the contracts, WSDL, and the SOAP standard.

如果您需要与您的服务有其他系统接口,那么由于您与契约、WSDL和SOAP标准的“验证”层的关系,许多客户端将更喜欢使用SOAP。

For day-to-day systems calling into systems, I think that SOAP is a lot of unnecessary overhead when a simple HTML call will do.

对于日常的系统调用系统,我认为当一个简单的HTML调用就可以完成时,SOAP是很多不必要的开销。

#15


9  

Don't overlook XML-RPC. If you're just after a lightweight solution then there's a great deal to be said for a protocol that can be defined in a couple of pages of text and implemented in a minimal amount of code. XML-RPC has been around for years but went out of fashion for a while - but the minimalist appeal seems to be giving it something of a revival of late.

不要忽视xml - rpc。如果您只是想要一个轻量级的解决方案,那么对于一个可以在几页文本中定义并以最少的代码实现的协议来说,有很多话要说。XML-RPC已经存在多年了,但已经过时一段时间了——但是极简主义的吸引力似乎给了它某种最近的复兴。

#16


9  

I am looking at the same, and i think, they are different tools for different problems.

我也一样,我认为,它们是不同问题的不同工具。

Simple Object Access Protocol (SOAP) standard an XML language defining a message architecture and message formats, is used by Web services it contain a description of the operations. WSDL is an XML-based language for describing Web services and how to access them. will run on SMTP,HTTP,FTP etc. Requires middleware support, well defined mechanisam to define services like WSDL+XSD, WS-Policy SOAP will return XML based data SOAP provide standards for security and reliability

简单对象访问协议(Simple Object Access Protocol, SOAP)标准定义消息体系结构和消息格式的XML语言,由包含操作描述的Web服务使用。WSDL是一种基于xml的语言,用于描述Web服务以及如何访问它们。将在SMTP、HTTP、FTP等上运行。需要中间件支持,定义良好的mechanisam来定义诸如WSDL+XSD等服务,WS-Policy SOAP将返回基于XML的数据SOAP提供安全性和可靠性标准吗

Representational State Transfer (RESTful) web services. they are second generation Web Services. RESTful web services, communicate via HTTP than SOAP-based services and do not require XML messages or WSDL service-API definitions. for REST no middleware is required only HTTP support is needed.WADL Standard, REST can return XML, plain text, JSON, HTML etc

表示状态传输(RESTful) web服务。它们是第二代Web服务。基于rest的web服务,通过HTTP而不是基于soap的服务进行通信,不需要XML消息或WSDL服务api定义。对于REST,不需要中间件,只需要HTTP支持。WADL标准,REST可以返回XML、纯文本、JSON、HTML等。

It is easier for many types of clients to consume RESTful web services while enabling the server side to evolve and scale. Clients can choose to consume some or all aspects of the service and mash it up with other web-based services.

对于许多类型的客户机来说,在使用基于rest的web服务的同时允许服务器端进行演进和扩展更容易。客户端可以选择使用服务的某些或所有方面,并将其与其他基于web的服务结合起来。

  1. REST uses standard HTTP so it is simplerto creating clients, developing APIs
  2. REST使用标准的HTTP,因此它简单地创建客户机,开发api。
  3. REST permits many different data formats like XML, plain text, JSON, HTML where as SOAP only permits XML.
  4. REST允许许多不同的数据格式,如XML、纯文本、JSON、HTML,而SOAP只允许XML。
  5. REST has better performance and scalability.
  6. REST具有更好的性能和可扩展性。
  7. Rest and can be cached and SOAP can't
  8. Rest可以缓存,SOAP不能
  9. Built-in error handling where SOAP has No error handling
  10. 内置错误处理,其中SOAP没有错误处理
  11. REST is particularly useful PDA and other mobile devices.
  12. REST是非常有用的PDA和其他移动设备。

REST is services are easy to integrate with existing websites.

REST is服务很容易与现有网站集成。

SOAP has set of protocols, which provide standards for security and reliability, among other things, and interoperate with other WS conforming clients and servers. SOAP Web services (such as JAX-WS) are useful in handling asynchronous processing and invocation.

SOAP有一组协议,它们为安全性和可靠性等提供标准,并与其他符合WS的客户端和服务器进行互操作。SOAP Web服务(如JAX-WS)在处理异步处理和调用时非常有用。

For Complex API's SOAP will be more usefull.

对于复杂API, SOAP将更加有用。

#17


8  

REST is an architecture invented by Roy Fielding and described in his dissertation Architectural Styles and the Design of Network-based Software Architectures. Roy is also the main author of HTTP - the protocol that defines document transfer over the World Wide Web. HTTP is a RESTful protocol. When developers talk about "using REST Web services" it is probably more accurate to say "using HTTP."

REST是Roy Fielding发明的架构,并在他的论文架构风格和基于网络的软件架构设计中进行了描述。Roy也是HTTP的主要作者,这个协议定义了万维网上的文档传输。HTTP是一个RESTful协议。当开发人员谈到“使用REST Web服务”时,更准确的说法可能是“使用HTTP”。

SOAP is a XML-based protocol that tunnels inside an HTTP request/response, so even if you use SOAP, you are using REST too. There is some debate over whether SOAP adds any significant functionality to basic HTTP.

SOAP是一种基于xml的协议,它在HTTP请求/响应中隧道,所以即使您使用SOAP,您也在使用REST。对于SOAP是否向基本HTTP添加任何重要功能,存在一些争论。

Before authoring a Web service, I would recommend studying HTTP. Odds are your requirements can be implemented with functionality already defined in the spec, so other protocols won't be needed.

在编写Web服务之前,我建议研究HTTP。很有可能您的需求可以用规范中已经定义的功能实现,因此不需要其他协议。

#18


7  

I am looking at the same issue. Seems to me that actually REST is quick and easy and good for lightweight calls and responses and great for debugging (what could be better than pumping a URL into a browser and seeing the response).

我也在关注同样的问题。在我看来,REST实际上是快速、简单、适合轻量级调用和响应,并且非常适合调试(还有什么比在浏览器中输入URL并查看响应更好的呢)。

However where REST seems to fall down is to do with the fact that its not a standard (although it is comprised of standards). Most programming libraries have a way of inspecting a WSDL to automatically generate the client code needed to consume a SOAP based services. Thus far consuming REST based web services seems a more adhoc approach of writing an interface to match the calls that are possible. Making a manual http request then parsing the response. This in itself can be dangerous.

然而,在哪里休息似乎与它不是标准的事实有关(尽管它是由标准组成的)。大多数编程库都有检查WSDL的方法来自动生成使用基于SOAP的服务所需的客户端代码。到目前为止,使用基于REST的web服务似乎是编写接口以匹配可能的调用的一种更特别的方法。创建一个手动http请求,然后解析响应。这本身就是危险的。

The beauty of SOAP is that once a WSDL is issued then business' can structure their logic aorund that set contract any change to the interface will change the wsdl. There isnt any room for manouvre. You can validate all requests against that WSDL. However because a WSDL doesnt properly describe a REST service then you have no defined way of agreeing on the interface for communication.

SOAP的美妙之处在于,一旦发布了WSDL,业务“就可以构造它们的逻辑主动脉,设置对接口的任何更改都将更改WSDL。”没有任何施展空间。您可以验证所有针对该WSDL的请求。然而,由于WSDL不能正确地描述REST服务,所以您没有定义的方式来约定用于通信的接口。

From a business perspective this does seem to leave the communication open to interpretation and change which seems like a bad idea.

从商业的角度来看,这确实让沟通变得更容易理解和改变,这似乎是一个糟糕的想法。

The top 'Answer' in this thread seems to say that SOAP stands for Simple Object-oriented Access Protocol, however looking at wiki the O means Object not Object-oriented. They are different things.

这个线程中最上面的“答案”似乎是SOAP代表简单的面向对象访问协议,但是看wiki O表示对象而不是面向对象的。它们是不同的东西。

I know this post is very old but thought I should respond with my own findings.

我知道这篇文章很老了,但我认为我应该用我自己的发现来回应。

#19


6  

It's a good question... I don't want to lead you astray, so I'm open to other people's answers as much as you are. For me, it really comes down to cost of overhead and what the use of the API is. I prefer consuming web services when creating client software, however I don't like the weight of SOAP. REST, I believe, is lighter weight but I don't enjoy working with it from a client perspective nearly as much.

这是一个好问题……我不想把你引入歧途,所以我和你一样愿意接受别人的答案。对我来说,这主要是因为开销和API的使用。我喜欢在创建客户端软件时使用web服务,但是我不喜欢SOAP的重量。我相信,休息可以减轻体重,但我不喜欢从客户的角度来看待它。

I'm curious as to what others think.

我很好奇别人怎么想。

#20


6  

Listen to this podcast to find out. If you want to know the answer without listening, then OK, its REST. But I really do recommend listening.

请收听本期播客,找出答案。如果你想不听就知道答案,那好吧,就到此为止。但是我真的推荐大家去听。

#21


6  

My general rule is that if you want a browser web client to directly connect to a service then you should probably use REST. If you want to pass structured data between back-end services then use SOAP.

我的一般规则是,如果您希望浏览器web客户端直接连接到服务,那么您应该使用REST。如果希望在后端服务之间传递结构化数据,那么使用SOAP。

SOAP can be a real pain to set up sometimes and is often overkill for simple web client and server data exchanges. Unfortunately, most simple programming examples I've seen (and learned from) somewhat reenforce this perception.

SOAP有时设置起来确实很麻烦,对于简单的web客户端和服务器数据交换来说,它通常是多余的。不幸的是,我所见过(并从中学到的)的大多数简单的编程示例都在某种程度上强化了这种感觉。

That said, SOAP really shines when you start combining multiple SOAP services together as part of a larger process driven by a data workflow (think enterprise software). This is something that many of the SOAP programming examples fail to convey because a simple SOAP operation to do something, like fetch the price of a stock, is generally overcomplicated for what it does by itself unless it is presented in the context of providing a machine readable API detailing specific functions with set data formats for inputs and outputs that is, in turn, scripted by a larger process.

也就是说,当您开始将多个SOAP服务组合在一起,作为数据工作流驱动的更大流程的一部分时(请考虑企业软件),SOAP确实很出色。这是许多SOAP编程示例无法传达的,因为一个简单的SOAP操作,如获取股票的价格,它本身通常是复杂的,除非它的上下文中提出了提供一个机器可读的API详细说明特定功能和设置数据格式的输入和输出,反过来,通过更大的化的过程。

This is sad, in a way, as it really gives SOAP a bad reputation because it is difficult to show the advantages of SOAP without presenting it in the full context of how the final product is used.

这在某种程度上是令人遗憾的,因为它确实给SOAP带来了不好的名声,因为如果不在最终产品如何使用的完整上下文中展示SOAP的优点,就很难展示它。

#22


4  

SOAP embodies a service-oriented approach to Web services — one in which methods (or verbs) are the primary way you interact with the service. REST takes a resource-oriented approach in which the object (or the noun) takes center stage.

SOAP体现了面向服务的Web服务方法——其中方法(或动词)是与服务交互的主要方式。REST采用面向资源的方法,对象(或名词)处于中心位置。

#23


4  

In sense with "PHP-universe" PHP support for any advanced SOAP sucks big time. You will end up using something like http://wso2.com/products/web-services-framework/php/ as soon as you cross the basic needs, even to enable WS-Security or WS-RM no inbuilt support.

从某种意义上来说,PHP对任何高级SOAP的支持都很糟糕。一旦跨越基本需求,您最终将使用http://wso2.com/products/web服务-framework/php/之类的内容,甚至可以启用WS-Security或WS-RM no内置支持。

SOAP envelope creation I feel is lot messy in PHP, the way it creates namespaces, xsd:nil, xsd:anytype and old styled soap Services which use SOAP Encoding (God knows how's that different) with in SOAP messages.

我觉得在PHP中创建SOAP信封很麻烦,它在SOAP消息中创建名称空间、xsd:nil、xsd:any类型和旧风格的SOAP服务(天知道有什么不同)的方式。

Avoid all this mess by sticking to REST, REST is nothing really big we have been using it since the start of WWW. We realized only when this http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm paper came out it shows how can we use HTTP capabilities to implement RESTFul Services. HTTP is inherently REST, that doesn't mean just using HTTP makes your services RESTFul.

通过坚持休息来避免这些混乱,休息并不是什么大问题,我们从WWW开始就一直在使用它。我们只有在这个http://www.ics.uci.edu/~fielding/pub /dissertation/top.htm论文发表时才意识到,它展示了如何使用HTTP功能实现RESTFul服务。HTTP本质上是REST,这并不意味着仅使用HTTP就可以使服务RESTFul。

SOAP neglects the core capabilities of HTTP and considers HTTP just as an transport protocol, hence it is transport protocol independent in theory (in practical it's not the case have you heard of SOAP Action header? if not google it now!).

SOAP忽略了HTTP的核心功能,并将HTTP视为传输协议,因此它在理论上是独立于传输协议的(实际上不是这样的,您听说过SOAP操作头吗?)如果不是谷歌现在!)

With JSON adaption increasing and HTML5 with javascript maturing REST with JSON has become the most common way of dealing with services. JSON Schema has also been defined can be used for enterprise level solutions (still in early stages) along with WADL if needed.

随着JSON适应能力的提高,HTML5和javascript的成熟,REST和JSON已经成为处理服务的最常见方式。还定义了JSON模式,可以用于企业级解决方案(仍然处于早期阶段),如果需要的话还可以使用WADL。

PHP support for REST and JSON is definitely better than existing inbuilt SOAP support it has.

PHP对REST和JSON的支持肯定优于现有的内置SOAP支持。

Adding few more BUZZ words here SOA, WOA, ROA

在这里添加更多的术语SOA, WOA, ROA

http://blog.dhananjaynene.com/2009/06/rest-soa-woa-or-roa/

http://blog.dhananjaynene.com/2009/06/rest-soa-woa-or-roa/

http://www.scribd.com/doc/15657444/REST-White-Paper

http://www.scribd.com/doc/15657444/REST-White-Paper

by the way I do love SOAP especially for the WS-Security spec, this is one good spec and if someone thinking in Enterprise JSON adaption definetly need to come with some thing similar for JSON, like field level encryption etc.

顺便说一下,我非常喜欢SOAP,尤其是WS-Security规范,这是一个很好的规范,如果有人认为企业JSON适配器一定需要提供一些类似于JSON的东西,比如字段级加密等等。

#24


3  

One quick point - transmission protocol and orchestration;

一个快速点——传输协议和编排;

I use SOAP over TCP for speed, reliability and security reasons, including orchestrated machine to machine services (ESB) and to external services. Change the service definition, the orchestration raises an error from the WSDL change and its immediately obvious and can be rebuilt/deployed.

出于速度、可靠性和安全性的考虑,我使用了TCP之上的SOAP,包括编排好的机器到机器服务(ESB)和外部服务。更改服务定义,业务流程会从WSDL更改中引发错误,并立即明显,可以重新构建/部署。

Not sure you can do the same with REST - I await being corrected or course! With REST, change the service definition - nothing knows about it until it returns 400 (or whatever).

我不确定你是否可以用休息来做同样的事情——我在等待被纠正或纠正!使用REST,更改服务定义——直到它返回400(或其他)时才知道它。

#25


2  

If you are looking for interoperability between different systems and languages, I would definately go for REST. I've had a lot of problems trying to get SOAP working between .NET and Java, for example.

如果您正在寻找不同系统和语言之间的互操作性,那么我肯定会休息一下。例如,我在。net和Java之间使用SOAP时遇到了很多问题。

#26


2  

i create a benchmark for find which of them are faster! i see this result:

我创建了一个基准来查找其中哪个更快!我看到这个结果:

for 1000 requests :

1000个请求:

  • REST took 3 second
  • 剩下3秒
  • SOAP took 7 second
  • SOAP 7秒

for 10,000 requests :

10000个请求:

  • REST took 33 second
  • 其他33秒
  • SOAP took 69 second
  • 肥皂花了69秒

for 1,000,000 requests :

1000000个请求:

  • REST took 62 second
  • 剩下62秒
  • SOAP took 114 second
  • 肥皂花了114秒

#27


0  

An old question but still relevant today....due to so many developers in the enterprise space still using it.

一个老问题,但仍有关今天....由于许多开发人员仍在使用它。

My work involves designing and developing IoT (Internet of Things) solutions. Which includes developing code for small embedded devices that communicate with the Cloud.

我的工作包括设计和开发物联网解决方案。这包括为与云通信的小型嵌入式设备开发代码。

It is clear REST is now widely accepted and useful, and pretty much the defacto standard for the web, even Microsoft has REST support included throughout Azure. If I needed to rely on SOAP I could not do what I need to do, as is just too big, bulky and annoying for small embedded devices.

很明显,REST现在已经被广泛接受,并且非常有用,而且几乎是web的实际标准,甚至微软也在Azure中包含了REST支持。如果我需要依赖SOAP,我就不能做我需要做的事情,因为它太大、太笨重,而且讨厌小型嵌入式设备。

REST is simple and clean and small. Making it ideal for small embedded devices. I always scream when I am working with a web developer who sends me a WSDLs. As I will have to begin an education campaign about why this just isn't going to work and why they are going to have to learn REST.

休息简单、干净、小。使其成为小型嵌入式设备的理想选择。当我与一个向我发送wsdl的web开发人员一起工作时,我总是会尖叫。因为我将不得不开始一场教育运动,关于为什么这是行不通的,为什么他们要学习休息。

#28


0  

1.From my experience. I would say REST gives you option to access the URL which is already built. eg-> a word search in google. That URL could be used as webservice for REST. In SOAP, you can create your own web service and access it through SOAP client.

1。从我的经验。我想说REST让你选择访问已经构建好的URL。>在谷歌中的单词搜索。该URL可以用作REST的webservice。在SOAP中,您可以创建自己的web服务并通过SOAP客户机访问它。

  1. REST supports text,JSON,XML format. Hence more versatile for communicating between two applications. While SOAP supports only XML format for message communication.
  2. 其他支持文本、JSON、XML格式。因此,在两个应用程序之间进行通信时更加灵活。而SOAP只支持消息通信的XML格式。

#1


548  

I built one of the first SOAP servers, including code generation and WSDL generation, from the original spec as it was being developed, when I was working at Hewlett-Packard. I do NOT recommend using SOAP for anything.

在我在惠普工作的时候,我建立了第一批SOAP服务器,包括代码生成和WSDL生成。我不建议使用SOAP做任何事情。

The acronym "SOAP" is a lie. It is not Simple, it is not Object-oriented, it defines no Access rules. It is, arguably, a Protocol. It is Don Box's worst spec ever, and that's quite a feat, as he's the man who perpetrated "COM".

缩写“SOAP”是一个谎言。它不是简单的,它不是面向对象的,它定义了没有访问规则。可以说,这是一种协议。这是唐·博克史上最糟糕的天赋,这是一个相当了不起的成就,因为他是犯下“COM”的人。

There is nothing useful in SOAP that can't be done with REST for transport, and JSON, XML, or even plain text for data representation. For transport security, you can use https. For authentication, basic auth. For sessions, there's cookies. The REST version will be simpler, clearer, run faster, and use less bandwidth.

SOAP中没有什么有用的东西是不能用REST进行传输的,JSON、XML甚至是纯文本进行数据表示的。对于传输安全性,可以使用https。进行验证,基本认证。对于会话,有饼干。REST版本将更简单、更清晰、运行得更快、使用更少的带宽。

XML-RPC clearly defines the request, response, and error protocols, and there are good libraries for most languages. However, XML is heavier than you need for many tasks.

XML-RPC明确地定义了请求、响应和错误协议,并且对于大多数语言都有很好的库。但是,XML比许多任务所需要的要重。

#2


193  

REST is an architecture, SOAP is a protocol.

REST是一个体系结构,SOAP是一个协议。

That's the first problem.

这是第一个问题。

You can send SOAP envelopes in a REST application.

您可以在REST应用程序中发送SOAP信封。

SOAP itself is actually pretty basic and simple, it's the WSS-* standards on top of it that make it very complex.

SOAP本身实际上是非常基本和简单的,它上面的WSS-*标准使它非常复杂。

If your consumers are other applications and other servers, there's a lot of support for the SOAP protocol today, and the basics of moving data is essentially a mouse-click in modern IDEs.

如果您的消费者是其他应用程序和其他服务器,那么现在有很多对SOAP协议的支持,移动数据的基础本质上就是现代ide中的鼠标点击。

If your consumers are more likely to be RIAs or Ajax clients, you will probably want something simpler than SOAP, and more native to the client (notably JSON).

如果您的客户更可能是ria或Ajax客户端,那么您可能需要比SOAP更简单的东西,并且更适合于客户端(特别是JSON)。

JSON packets sent over HTTP is not necessarily a REST architecture, it's just messages to URLs. All perfectly workable, but there are key components to the REST idiom. It is easy to confuse the two however. But just because you're talking HTTP requests does not necessarily mean you have a REST architecture. You can have a REST application with no HTTP at all (mind, this is rare).

通过HTTP发送的JSON数据包不一定是REST架构,它只是指向url的消息。所有这些都是完全可行的,但是REST习语有一些关键的组件。然而,很容易将两者混淆。但是,仅仅因为您正在谈论HTTP请求,并不一定意味着您拥有一个REST架构。您可以有一个完全没有HTTP的REST应用程序(注意,这很少见)。

So, if you have servers and consumers that are "comfortable" with SOAP, SOAP and WSS stack can serve you well. If you're doing more ad hoc things and want to better interface with web browsers, then some lighter protocol over HTTP can work well also.

因此,如果您的服务器和消费者对SOAP、SOAP和WSS堆栈感到“舒适”,那么它们可以很好地为您服务。如果您正在做更多的特别的事情,并且想要更好地与web浏览器进行交互,那么在HTTP上的一些轻量级协议也可以很好地工作。

#3


100  

REST is a fundamentally different paradigm from SOAP. A good read on REST can be found here: How I explained REST to my wife.

REST是与SOAP完全不同的范例。这里有一篇关于休息的好文章:我是如何向我的妻子解释休息的。

If you don't have time to read it, here's the short version: REST is a bit of a paradigm shift by focusing on "nouns", and restraining the number of "verbs" you can apply to those nouns. The only allowed verbs are "get", "put", "post" and "delete". This differs from SOAP where many different verbs can be applied to many different nouns (i.e. many different functions).

如果你没有时间阅读,这里有一个简短的版本:休息是一种范式转换,主要集中在“名词”上,并限制你可以应用于这些名词的“动词”的数量。唯一允许使用的动词是“get”、“put”、“post”和“delete”。这与SOAP不同,SOAP可以将许多不同的动词应用于许多不同的名词(即许多不同的函数)。

For REST, the four verbs map to the corresponding HTTP requests, while the nouns are identified by URLs. This makes state management much more transparent than in SOAP, where its often unclear what state is on the server and what is on the client.

在REST中,这四个动词映射到相应的HTTP请求,而名词由url标识。这使得状态管理比SOAP中透明得多,SOAP中常常不清楚服务器上的状态和客户机上的状态。

In practice though most of this falls away, and REST usually just refers to simple HTTP requests that return results in JSON, while SOAP is a more complex API that communicates by passing XML around. Both have their advantages and disadvantages, but I've found that in my experience REST is usually the better choice because you rarely if ever need the full functionality you get from SOAP.

在实践中,虽然大多数都失败了,但是REST通常只引用返回JSON结果的简单HTTP请求,而SOAP是通过传递XML进行通信的更复杂的API。两者都有各自的优缺点,但是我发现在我的经验中REST通常是更好的选择,因为您很少需要从SOAP获得的全部功能。

#4


56  

Quick lowdown for 2012 question:

快速了解2012年的问题:

Areas that REST works really well for are:

休息真正有效的领域是:

  • Limited bandwidth and resources. Remember the return structure is really in any format (developer defined). Plus, any browser can be used because the REST approach uses the standard GET, PUT, POST, and DELETE verbs. Again, remember that REST can also use the XMLHttpRequest object that most modern browsers support today, which adds an extra bonus of AJAX.

    有限的带宽和资源。记住,返回结构实际上是任何格式(开发人员定义的)。另外,任何浏览器都可以使用,因为REST方法使用标准的GET、PUT、POST和DELETE谓词。同样,请记住REST也可以使用大多数现代浏览器支持的XMLHttpRequest对象,这增加了AJAX的额外好处。

  • Totally stateless operations. If an operation needs to be continued, then REST is not the best approach and SOAP may fit it better. However, if you need stateless CRUD (Create, Read, Update, and Delete) operations, then REST is it.

    完全无状态的操作。如果需要继续操作,那么REST不是最好的方法,SOAP可能更适合它。但是,如果您需要无状态CRUD(创建、读取、更新和删除)操作,那么REST就是它了。

  • Caching situations. If the information can be cached because of the totally stateless operation of the REST approach, this is perfect.That covers a lot of solutions in the above three.

    缓存的情况。如果由于REST方法的完全无状态操作,可以缓存信息,那么这是完美的。这涵盖了上面三种方法中的许多解决方案。

So why would I even consider SOAP? Again, SOAP is fairly mature and well-defined and does come with a complete specification. The REST approach is just that, an approach and is wide open for development, so if you have the following then SOAP is a great solution:

那么,我为什么还要考虑使用SOAP呢?同样,SOAP是相当成熟和定义良好的,并且附带完整的规范。REST方法就是这样一种方法,对开发是开放的,所以如果您有以下内容,那么SOAP就是一个很好的解决方案:

  • Asynchronous processing and invocation. If your application needs a guaranteed level of reliability and security then SOAP 1.2 offers additional standards to ensure this type of operation. Things like WSRM – WS-Reliable Messaging.

    异步处理和调用。如果您的应用程序需要一个有保证的可靠性和安全性级别,那么SOAP 1.2提供了额外的标准来确保这种类型的操作。诸如WSRM - ws - reliability的消息传递。

  • Formal contracts. If both sides (provider and consumer) have to agree on the exchange format then SOAP 1.2 gives the rigid specifications for this type of interaction.

    正式的合同。如果双方(提供者和使用者)都必须同意交换格式,那么SOAP 1.2为这种类型的交互提供了严格的规范。

  • Stateful operations. If the application needs contextual information and conversational state management then SOAP 1.2 has the additional specification in the WS* structure to support those things (Security, Transactions, Coordination, etc). Comparatively, the REST approach would make the developers build this custom plumbing.

    有状态操作。如果应用程序需要上下文信息和会话状态管理,那么SOAP 1.2在WS*结构中有额外的规范来支持这些内容(安全性、事务、协调等等)。相对而言,REST方法将使开发人员构建这种自定义管道。

http://www.infoq.com/articles/rest-soap-when-to-use-each

http://www.infoq.com/articles/rest-soap-when-to-use-each

#5


44  

SOAP currently has the advantage of better tools where they will generate a lot of the boilerplate code for both the service layer as well as generating clients from any given WSDL.

SOAP目前具有更好的工具,它们将为服务层生成大量的样板代码,并从任何给定的WSDL生成客户端。

REST is simpler, can be easier to maintain as a result, lies at the heart of Web architecture, allows for better protocol visibility, and has been proven to scale at the size of the WWW itself. Some frameworks out there help you build REST services, like Ruby on Rails, and some even help you with writing clients, like ADO.NET Data Services. But for the most part, tool support is lacking.

REST更简单,因此更容易维护,位于Web架构的核心,允许更好的协议可见性,并且已经被证明可以在WWW本身的大小上伸缩。有些框架可以帮助您构建REST服务,如Ruby on Rails,有些甚至可以帮助您编写客户机,如ADO。净数据服务。但是在大多数情况下,工具支持是缺乏的。

#6


40  

SOAP is useful from a tooling perspective because the WSDL is so easily consumed by tools. So, you can get Web Service clients generated for you in your favorite language.

从工具的角度来看,SOAP是有用的,因为工具很容易使用WSDL。因此,您可以使用您喜欢的语言生成Web服务客户端。

REST plays well with AJAX'y web pages. If you keep your requests simple, you can make service calls directly from your JavaScript, and that comes in very handy. Try to stay away from having any namespaces in your response XML, I've seen browsers choke on those. So, xsi:type is probably not going to work for you, no overly complex XML Schemas.

REST在AJAX web页面上运行良好。如果您让请求保持简单,您可以直接从JavaScript进行服务调用,这非常方便。尽量不要在响应XML中使用任何名称空间,我曾看到浏览器在这些名称空间上出现问题。因此,xsi:type可能不会适合您,没有过于复杂的XML模式。

REST tends to have better performance as well. CPU requirements of the code generating REST responses tend to be lower than what SOAP frameworks exhibit. And, if you have your XML generation ducks lined up on the server side, you can effectively stream XML out to the client. So, imagine you're reading rows of database cursor. As you read a row, you format it as an XML element, and you write that directly out to the service consumer. This way, you don't have to collect all of the database rows in memory before starting to write your XML output - you read and write at the same time. Look into novel templating engines or XSLT to get the streaming to work for REST.

休息往往也有更好的表现。生成REST响应的代码的CPU需求往往低于SOAP框架所显示的。而且,如果您的XML生成鸭子在服务器端排列,您可以有效地将XML流到客户端。假设您正在读取数据库光标的行。在读取一行时,将其格式化为XML元素,并将其直接写入服务使用者。这样,在开始编写XML输出之前,您不必收集内存中的所有数据库行——您可以同时读写。请查看新的模板引擎或XSLT,以使流在REST中工作。

SOAP on the other hand tends to get generated by tool-generated services as a big blob and only then written. This is not an absolute truth, mind you, there are ways to get streaming characteristics out of SOAP, like by using attachments.

另一方面,SOAP往往是由工具生成的服务作为一个大的blob生成,然后才写入。注意,这并不是绝对的事实,有一些方法可以从SOAP中获取流特性,比如使用附件。

My decision making process is as follows: if I want my service to be easily tooled by consumers, and the messages I write will be medium-to-small-ish (10MB or less), and I don't mind burning some extra CPU cycles on the server, I go with SOAP. If I need to serve to AJAX on web browsers, or I need the thing to stream, or my responses are gigantic, I go REST.

我的决策过程如下:如果我想让我的服务易于被消费者使用,并且我所写的消息将是中等到小(10MB或更小),并且我不介意在服务器上消耗一些额外的CPU周期,我使用SOAP。如果我需要在web浏览器上为AJAX服务,或者我需要流数据,或者我的响应很大,我就休息一下。

Finally, there are lots of great standards built up around SOAP, like WS-Security and getting stateful Web Services, that you can plug in to if you're using the right tools. That kind of stuff really makes a difference, and can help you satisfy some hairy requirements.

最后,围绕SOAP构建了许多很棒的标准,如WS-Security和获取有状态Web服务,如果您使用了正确的工具,您可以插入这些标准。这些东西真的很重要,可以帮助你满足一些棘手的要求。

#7


29  

I know this is an old question but I have to post my answer - maybe someone will find it useful. I can't believe how many people are recommending REST over SOAP. I can only assume these people are not developers or have never actually implemented a REST service of any reasonable size. Implementing a REST service takes a LOT longer than implementing a SOAP service. And in the end it comes out a lot messier, too. Here are the reasons I would choose SOAP 99% of the time:

我知道这是个老问题,但我得把我的答案贴出来——也许有人会觉得它有用。我不敢相信有多少人推荐休息而不是肥皂。我只能假设这些人不是开发人员,或者从来没有实现过任何合理大小的REST服务。实现REST服务要比实现SOAP服务花费的时间长得多。最后,它也变得更加混乱。以下是99%的时候我选择肥皂的原因:

1) Implementing a REST service takes infinitely longer than implementing a SOAP service. Tools exist for all modern languages/frameworks/platforms to read in a WSDL and output proxy classes and clients. Implementing a REST service is done by hand and - get this - by reading documentation. Furthermore, while implementing these two services, you have to make "guesses" as to what will come back across the pipe as there is no real schema or reference document.

1)实现REST服务比实现SOAP服务要花费无限长的时间。所有现代语言/框架/平台都可以在WSDL和输出代理类和客户端中读取工具。实现REST服务是手工完成的,通过阅读文档来实现。此外,在实现这两个服务时,您必须“猜测”管道中返回的内容,因为没有真正的模式或引用文档。

2) Why write a REST service that returns XML anyway? The only difference is that with REST you don't know the types each element/attribute represents - you are on your own to implement it and hope that one day a string doesn't come across in a field you thought was always an int. SOAP defines the data structure using the WSDL so this is a no-brainer.

为什么要编写一个返回XML的REST服务呢?唯一的区别是,在休息你不知道每个元素/属性代表类型——你自己实现它,希望有一天,一个字符串不遇到一个领域你认为总是int。使用WSDL SOAP定义了数据结构这是显而易见的。

3) I've heard the complaint that with SOAP you have the "overhead" of the SOAP Envelope. In this day and age, do we really need to worry about a handful of bytes?

我听人抱怨说,用肥皂你有肥皂信封的“开销”。在这个时代,我们真的需要担心一些字节吗?

4) I've heard the argument that with REST you can just pop the URL into the browser and see the data. Sure, if your REST service is using simple or no authentication. The Netflix service, for instance, uses OAuth which requires you to sign things and encode things before you can even submit your request.

4)我听过这样的说法:REST可以将URL弹出到浏览器中并查看数据。当然,如果您的REST服务使用简单或不使用身份验证。例如,Netflix服务使用OAuth,它要求你在提交请求之前先进行签名和编码。

5) Why do we need a "readable" URL for each resource? If we were using a tool to implement the service, do we really care about the actual URL?

5)为什么每个资源都需要一个“可读”的URL ?如果我们使用工具来实现服务,我们真的关心实际的URL吗?

Need I go on?

我需要继续吗?

#8


19  

Most of the applications I write are server-side C# or Java, or desktop applications in WinForms or WPF. These applications tend to need a richer service API than REST can provide. Plus, I don't want to spend any more than a couple minutes creating my web service client. The WSDL processing client generation tools allow me to implement my client and move on to adding business value.

我编写的大多数应用程序是服务器端c#或Java,或WinForms或WPF中的桌面应用程序。这些应用程序往往需要比REST提供的更丰富的服务API。另外,我不想花超过几分钟来创建我的web服务客户机。WSDL处理客户端生成工具允许我实现我的客户端并继续添加业务价值。

Now, if I were writing a web service explicitly for some javascript ajax calls, it'd probably be in REST; just for the sake knowing the client technology and leveraging JSON. In my opinion, web service APIs used from javascript probably shouldn't be very complex, as that type of complexity seems to be better handled server-side.

现在,如果我为一些javascript ajax调用显式地编写web服务,它可能会处于REST中;只是为了了解客户端技术并利用JSON。在我看来,从javascript使用的web服务api可能不应该非常复杂,因为这种复杂性似乎可以更好地处理服务器端。

With that said, there some SOAP clients for javascript; I know jQuery has one. Thus, SOAP can be leveraged from javascript; just not as nicely as a REST service returning JSON strings. So if I had a web service that I wanted to be complex enough that it was flexible for an arbitrary number of client technologies and uses, I'd go with SOAP.

也就是说,javascript有一些SOAP客户机;我知道jQuery有一个。因此,可以从javascript使用SOAP;只是没有REST服务返回JSON字符串那么好。因此,如果我有一个web服务,我希望它足够复杂,能够灵活地用于任意数量的客户端技术和使用,那么我将使用SOAP。

#9


17  

I'd recommend you go with REST first - if you're using Java look at JAX-RS and the Jersey implementation. REST is much simpler and easy to interop in many languages.

我建议您首先使用REST—如果您使用Java,请查看JAX-RS和Jersey实现。在许多语言中,REST更简单、更容易交互。

As others have said in this thread, the problem with SOAP is its complexity when the other WS-* specifications come in and there are countless interop issues if you stray into the wrong parts of WSDL, XSDs, SOAP, WS-Addressing etc.

正如这个线程中其他人所说的,SOAP的问题在于当其他WS-*规范出现时它的复杂性,如果您误入WSDL、xsd、SOAP、WS- addressing等的错误部分,就会遇到无数的互操作问题。

The best way to judge the REST v SOAP debate is look on the internet - pretty much all the big players in the web space, google, amazon, ebay, twitter et al - tend to use and prefer RESTful APIs over the SOAP ones.

判断REST v SOAP辩论的最好方法是看互联网——几乎所有web空间的大玩家,谷歌、amazon、ebay、twitter等都倾向于使用REST api,而不是SOAP。

The other nice approach to going with REST is that you can reuse lots of code and infratructure between a web application and a REST front end. e.g. rendering HTML versus XML versus JSON of your resources is normally pretty easy with frameworks like JAX-RS and implicit views - plus its easy to work with RESTful resources using a web browser

使用REST的另一个好方法是,您可以重用web应用程序和REST前端之间的大量代码和基础结构。在使用JAX-RS和隐式视图等框架时,呈现HTML和XML相对于JSON是相当容易的,而且使用web浏览器可以轻松地使用RESTful资源。

#10


16  

I'm sure Don Box created SOAP as a joke - 'look you can call RPC methods over the web' and today groans when he realises what a bloated nightmare of web standards it has become :-)

我确信Don Box创造了SOAP作为一个笑话——“看,你可以通过web调用RPC方法”,今天当他意识到它已经成为一个多么膨胀的web标准噩梦时,他呻吟道:

REST is good, simple, implemented everywhere (so more a 'standard' than the standards) fast and easy. Use REST.

休息是好的,简单的,在任何地方都可以实现(所以比标准更像是一个“标准”),快速和容易。使用REST。

#11


15  

I think that both has its own place. In my opinion:

我认为两者都有自己的位置。在我看来:

SOAP: A better choice for integration between legacy/critical systems and a web/web-service system, on the foundation layer, where WS-* make sense (security, policy, etc.).

SOAP:对遗留/关键系统和web/web服务系统集成的更好的选择,在基础层上,WS-*有意义(安全性、策略等)。

RESTful: A better choice for integration between websites, with public API, on the TOP of layer (VIEW, ie, javascripts taking calls to URIs).

RESTful:在网站间集成公共API的更好选择。

#12


13  

One thing that hasn't been mentioned is that a SOAP envelope can contain headers as well as body parts. This lets you use the full expressiveness of XML to send and receive out of band information. REST, as far as I know, limits you to HTTP Headers and result codes.

还没有提到的一点是SOAP信封可以包含头部和身体部分。这使您可以使用XML的全部表达性来发送和接收带外信息。据我所知,REST限制您使用HTTP头和结果代码。

(otoh, can you use cookies with a REST service to send "header"-type out of band data?)

(otoh,您是否可以使用带有REST服务的cookie来发送“header”——带外数据类型?)

#13


10  

Answering the 2012 refreshed (by the second bounty) question, and reviewing the today's results (other answers).

回答了2012年的问题(第二个赏金),并回顾了今天的结果(其他答案)。


SOAP, pros and cons

About SOAP 1.2, advantages and drawbacks when comparing with "REST"... Well, since 2007 you can describe REST Web services with WSDL, and using SOAP protocol... That is, if you work a little harder, all W3C standards of the web services protocol stack can be REST!

关于SOAP 1.2,与“REST”相比的优缺点……自2007年以来,您可以使用WSDL和SOAP协议来描述REST Web服务……也就是说,如果您稍微努力一点,那么web服务协议栈的所有W3C标准都可以是REST!

It is a good starting point, because we can imagine a scenario in which all the philosophical and methodological discussions are temporarily avoided. We can compare technically "SOAP-REST" with "NON-SOAP-REST" in similar services,

这是一个很好的起点,因为我们可以想象一个场景,在这个场景中,所有哲学和方法上的讨论都暂时避免了。我们可以将技术上的“SOAP-REST”与类似服务中的“非SOAP-REST”进行比较,

  • SOAP-REST (="REST-SOAP"): as showed by L.Mandel, WSDL2 can describe a REST webservice, and, if we suppose that exemplified XML can be enveloped in SOAP, all the implementation will be "SOAP-REST".

    SOAP-REST (="REST-SOAP"):如L所示。Mandel、WSDL2可以描述REST web服务,如果我们假设示例的XML可以封装在SOAP中,那么所有的实现都将是“SOAP-REST”。

  • NON-SOAP-REST: any REST web service that can not be SOAP... That is, "90%" of the well-knowed REST examples. Some not use XML (ex. typical AJAX RESTs use JSON instead), some use another XML strucutures, without the SOAP headers or rules. PS: to avoid informality, we can suppose REST level 2 in the comparisons.

    非SOAP-REST:任何不能是SOAP的REST web服务…也就是说,“90%”的良好的REST示例。有些不使用XML(例如,典型的AJAX rest使用JSON),有些使用另一个XML结构,没有SOAP头或规则。PS:为了避免不拘礼节,我们可以在比较中假设休息等级2。

Of course, to compare more conceptually, compare "NON-REST-SOAP" with "NON-SOAP-REST", as different modeling approaches. So, completing this taxonomy of web services:

当然,要在概念上进行比较,请将“非rest - soap”与“非soap - rest”进行比较,因为建模方法不同。因此,完成web服务的分类:

  • NON-REST-SOAP: any SOAP web service that can not be REST... That is, "90%" of the well-knowed SOAP examples.

    非REST-SOAP:任何不能是REST的SOAP web服务…也就是说,“90%”的成熟的SOAP示例。

  • NON-REST-NEITHER-SOAP: yes, the universe of "web services modeling" comprises other things (ex. XML-RPC).

    非rest - neithersoap:是的,“web服务建模”的宇宙包含其他东西(例如XML-RPC)。

SOAP in the REST condictions

Comparing comparable things: SOAP-REST with NON-SOAP-REST.

比较类似的东西:SOAP-REST和非SOAP-REST。

PROS

Explaining some terms,

解释一些术语,

  • Contractual stability: for all kinds of contracts (as "written agreements"),

    合同稳定性:适用于各类合同(如“书面协议”),

    • By the use of standars: all levels of the W3C stack are mutually compliant. REST, by other hand, is not a W3C or ISO standard, and have no normatized details about service's peripherals. So, as I, @DaveWoldrich(20 votes), @cynicalman(5), @Exitos(0) said before, in a context where are NEED FOR STANDARDS, you need SOAP.

      通过使用标准:W3C堆栈的所有级别都是相互兼容的。另一方面,REST不是W3C或ISO标准,也没有关于服务外围设备的规范化细节。所以,我,@DaveWoldrich(20票),@ alman(5), @Exitos(0)之前说过,在需要标准的环境中,你需要SOAP。

    • By the use of best practices: the "verbose aspect" of the W3C stack implementations, translates relevant human/legal/juridic agreements.

      通过使用最佳实践:W3C堆栈实现的“详细方面”,翻译相关的人工/法律/法律协议。

  • Robustness: the safety of SOAP structure and headers. With metada communication (with the full expressiveness of XML) and verification you have an "insurance policy" against any changes or noise.
    SOAP have "transactional reliability (...) deal with communication failures. SOAP has more controls around retry logic and thus can provide more end-to-end reliability and service guarantees", E. Terman.

    健壮性:SOAP结构和头的安全性。使用metada通信(具有XML的完整表达能力)和验证,您就有了针对任何更改或噪音的“保险策略”。SOAP具有“事务可靠性(……)处理通信失败”。SOAP对重试逻辑有更多的控制,因此可以提供更多的端到端可靠性和服务保证。

Sorting pros by popularity,

排序优点的流行,

  • Better tools (~70 votes): SOAP currently has the advantage of better tools, since 2007 and still 2012, because it is a well-defined and widely accepted standard. See @MarkCidade(27 votes), @DaveWoldrich(20), @JoshM(13), @TravisHeseman(9).

    更好的工具(大约70张选票):SOAP目前拥有更好的工具的优势,从2007年开始一直到2012年,因为它是一个定义明确且被广泛接受的标准。参见@MarkCidade(27张选票),@DaveWoldrich(20), @JoshM(13), @TravisHeseman(9)。

  • Standars compliance (25 votes): as I, @DaveWoldrich(20 votes), @cynicalman(5), @Exitos(0) said before, in a context where are NEED FOR STANDARDS, you need SOAP.

    标准遵从性(25票):正如我、@DaveWoldrich(20票)、@犬儒主义者(5票)、@Exitos(0票)之前所说,在需要标准的环境中,您需要SOAP。

  • Robustness: insurance of SOAP headers, @JohnSaunders (8 votes).

    健壮性:SOAP header的保险,@JohnSaunders(8张选票)。

CONS

  • SOAP strucuture is more complex (more than 300 votes): all answers here, and sources about "SOAP vs REST", manifest some degree of dislike with SOAP's redundancy and complexity. This is a natural consequence of the requirements for formal verification (see below), and for robustness (see above). "REST NON-SOAP" (and XML-RPC, the SOAP originator) can be more simple and informal.

    SOAP结构更加复杂(超过300张选票):这里的所有答案,以及“SOAP vs REST”的来源,都表明了SOAP的冗余和复杂性在某种程度上的不喜欢。这是正式验证(见下面)和健壮性(见上面)需求的自然结果。“REST NON-SOAP”(和XML-RPC, SOAP发起者)可以更加简单和非正式。

  • The "only XML" restriction is a performance obstacle when using tiny services (~50 votes): see json.org/xml and this question, or this other one. This point is showed by @toluju(41), and others.
    PS: as JSON is not a IETF standard, but we can consider a de facto standard for web software community.

    “唯一的XML”限制是使用小服务时的性能障碍(~50投票):参见json.org/xml和这个问题,或另一个问题。这一点由@toluju(41)和其他人展示。PS:因为JSON不是IETF标准,但是我们可以考虑一个事实上的web软件社区标准。


Modeling services with SOAP

Now, we can add SOAP-NON-REST with NON-SOAP-REST comparisons, and explain when is better to use SOAP:

现在,我们可以添加SOAP- non - rest和非SOAP- rest比较,并解释什么时候使用SOAP更好:

  • Need for standards and stable contracts (see "PROS" section). PS: see a typical "B2B need for standards" described by @saille.

    需要标准和稳定的合同(参见“专业人员”一节)。请参见@saille所描述的典型“B2B标准需求”。

  • Need for tools (see "PROS" section). PS: standards, and the existence of formal verifications (see bellow), are important issues for the tools automation.

    需要工具(请参阅“专业人员”一节)。标准和形式验证的存在(见下面)是工具自动化的重要问题。

  • Parallel heavy processing (see "Context/Foundations" section below): with bigger and/or slower processes, no matter with a bit more complexity of SOAP, reliability and stability are the best investments.

    并行重处理(请参阅下面的“上下文/基础”部分):对于较大和/或较慢的流程,无论SOAP的复杂性有多高,可靠性和稳定性都是最好的投资。

  • Need more security: when more than HTTPS is required, and you really need additional features for protection, SOAP is a better choice (see @Bell, 32 votes). "Sending the message along a path more complicated than request/response or over a transport that does not involve HTTP", S. Seely. XML is a core issue, offering standards for XML Encryption, XML Signature, and XML Canonicalization, and, only with SOAP you can to embed these mechanisms into a message by a well-accepted standard as WS-Security.

    需要更多的安全性:当需要超过HTTPS的安全性时,并且需要额外的保护特性时,SOAP是更好的选择(参见@Bell, 32选票)。“以比请求/响应更复杂的路径或不涉及HTTP的传输方式发送消息”,S. Seely说。XML是一个核心问题,它为XML加密、XML签名和XML规范化提供了标准,而且只有使用SOAP,您才能通过公认的WS-Security标准将这些机制嵌入到消息中。

  • Need more flexibility (less restrictions): SOAP not need exact correspondence with an URI; not nedd restrict to HTTP; not need to restrict to 4 verbs. As @TravisHeseman (9 votes) says, if you wanted something "flexible for an arbitrary number of client technologies and uses", use SOAP.
    PS: remember that XML is more universal/expressive than JSON (et al).

    需要更大的灵活性(更少的限制):SOAP不需要与URI进行精确的通信;不受nedd限制为HTTP;不需要限定4个动词。正如@TravisHeseman(9票)所说,如果你想要“任意数量的客户端技术和使用的灵活性”,请使用SOAP。请记住,XML比JSON更通用/更有表现力。

  • Need for formal verifications: important to understand that W3C stack uses formal methods, and REST is more informal. Your WSDL (a formal language) service description is a formal specification of your web services interfaces, and SOAP is a robust protocol that accept all possible WSDL prescriptions.

    需要正式的验证:重要的是要理解W3C堆栈使用正式的方法,而REST则更为非正式。您的WSDL(正式语言)服务描述是web服务接口的正式规范,SOAP是一个健壮的协议,接受所有可能的WSDL解决方案。

CONTEXT

Historical

To assess trends is necessary historical perspective. For this subject, a 10 or 15 years perspective...

评估趋势是必要的历史观点。对于这个问题,从10年或15年的角度来看……

Before the W3C standardization, there are some anarchy. Was difficult to implement interoperable services with different frameworks, and more difficult, costly, and time consuming to implement something interoperable between companys. The W3C stack standards has been a light, a north for interoperation of sets of complex web services.

在W3C标准化之前,存在一些混乱。很难用不同的框架实现可互操作的服务,实现公司间可互操作的服务则更加困难、昂贵和耗时。W3C堆栈标准是一个轻量级的标准,是一套复杂web服务之间的互操作。

For day-by-day tasks, like to implement AJAX, SOAP is heavy... So, the need for simple approaches need to elect a new theory-framework... And big "Web software players", as Google, Amazon, Yahoo, et al, elected the best alternative, that is the REST approach. Was in this context that REST concept arrived as a "competing framework", and, today (2012's), this alternative is a de facto standard for programmers.

对于日复一日的任务,比如实现AJAX, SOAP是沉重的……因此,对简单方法的需求需要选择一个新的理论框架……而大型的“网络软件玩家”,如谷歌、亚马逊、雅虎等,则选择了最好的选择,那就是REST方法。在这样的背景下,REST概念作为一个“竞争框架”出现了,而今天(2012年),这个替代方案实际上是程序员的标准。

Foundations

In a context of Parallel Computing the web services provides parallel subtasks; and protocols, like SOAP, ensures good synchronization and communication. Not "any task": web services can be classified as
coarse-grained and embarrassing parallelism.

在并行计算的上下文中,web服务提供并行子任务;协议,如SOAP,确保良好的同步和通信。不是“任何任务”:web服务可以归类为粗粒度和令人尴尬的并行。

As the task gets bigger, it becomes less significant "complexity debate", and becomes more relevant the robustness of the communication and the solidity of the contracts.

随着任务变得越来越大,“复杂性辩论”就变得不那么重要了,并且变得更加贴近于通信的健壮性和合同的可靠性。

#14


9  

It's nuanced.

这是微妙的。

If you need to have other systems interface with your services, than a lot of clients will be happier with SOAP, due to the layers of "verification" you have with the contracts, WSDL, and the SOAP standard.

如果您需要与您的服务有其他系统接口,那么由于您与契约、WSDL和SOAP标准的“验证”层的关系,许多客户端将更喜欢使用SOAP。

For day-to-day systems calling into systems, I think that SOAP is a lot of unnecessary overhead when a simple HTML call will do.

对于日常的系统调用系统,我认为当一个简单的HTML调用就可以完成时,SOAP是很多不必要的开销。

#15


9  

Don't overlook XML-RPC. If you're just after a lightweight solution then there's a great deal to be said for a protocol that can be defined in a couple of pages of text and implemented in a minimal amount of code. XML-RPC has been around for years but went out of fashion for a while - but the minimalist appeal seems to be giving it something of a revival of late.

不要忽视xml - rpc。如果您只是想要一个轻量级的解决方案,那么对于一个可以在几页文本中定义并以最少的代码实现的协议来说,有很多话要说。XML-RPC已经存在多年了,但已经过时一段时间了——但是极简主义的吸引力似乎给了它某种最近的复兴。

#16


9  

I am looking at the same, and i think, they are different tools for different problems.

我也一样,我认为,它们是不同问题的不同工具。

Simple Object Access Protocol (SOAP) standard an XML language defining a message architecture and message formats, is used by Web services it contain a description of the operations. WSDL is an XML-based language for describing Web services and how to access them. will run on SMTP,HTTP,FTP etc. Requires middleware support, well defined mechanisam to define services like WSDL+XSD, WS-Policy SOAP will return XML based data SOAP provide standards for security and reliability

简单对象访问协议(Simple Object Access Protocol, SOAP)标准定义消息体系结构和消息格式的XML语言,由包含操作描述的Web服务使用。WSDL是一种基于xml的语言,用于描述Web服务以及如何访问它们。将在SMTP、HTTP、FTP等上运行。需要中间件支持,定义良好的mechanisam来定义诸如WSDL+XSD等服务,WS-Policy SOAP将返回基于XML的数据SOAP提供安全性和可靠性标准吗

Representational State Transfer (RESTful) web services. they are second generation Web Services. RESTful web services, communicate via HTTP than SOAP-based services and do not require XML messages or WSDL service-API definitions. for REST no middleware is required only HTTP support is needed.WADL Standard, REST can return XML, plain text, JSON, HTML etc

表示状态传输(RESTful) web服务。它们是第二代Web服务。基于rest的web服务,通过HTTP而不是基于soap的服务进行通信,不需要XML消息或WSDL服务api定义。对于REST,不需要中间件,只需要HTTP支持。WADL标准,REST可以返回XML、纯文本、JSON、HTML等。

It is easier for many types of clients to consume RESTful web services while enabling the server side to evolve and scale. Clients can choose to consume some or all aspects of the service and mash it up with other web-based services.

对于许多类型的客户机来说,在使用基于rest的web服务的同时允许服务器端进行演进和扩展更容易。客户端可以选择使用服务的某些或所有方面,并将其与其他基于web的服务结合起来。

  1. REST uses standard HTTP so it is simplerto creating clients, developing APIs
  2. REST使用标准的HTTP,因此它简单地创建客户机,开发api。
  3. REST permits many different data formats like XML, plain text, JSON, HTML where as SOAP only permits XML.
  4. REST允许许多不同的数据格式,如XML、纯文本、JSON、HTML,而SOAP只允许XML。
  5. REST has better performance and scalability.
  6. REST具有更好的性能和可扩展性。
  7. Rest and can be cached and SOAP can't
  8. Rest可以缓存,SOAP不能
  9. Built-in error handling where SOAP has No error handling
  10. 内置错误处理,其中SOAP没有错误处理
  11. REST is particularly useful PDA and other mobile devices.
  12. REST是非常有用的PDA和其他移动设备。

REST is services are easy to integrate with existing websites.

REST is服务很容易与现有网站集成。

SOAP has set of protocols, which provide standards for security and reliability, among other things, and interoperate with other WS conforming clients and servers. SOAP Web services (such as JAX-WS) are useful in handling asynchronous processing and invocation.

SOAP有一组协议,它们为安全性和可靠性等提供标准,并与其他符合WS的客户端和服务器进行互操作。SOAP Web服务(如JAX-WS)在处理异步处理和调用时非常有用。

For Complex API's SOAP will be more usefull.

对于复杂API, SOAP将更加有用。

#17


8  

REST is an architecture invented by Roy Fielding and described in his dissertation Architectural Styles and the Design of Network-based Software Architectures. Roy is also the main author of HTTP - the protocol that defines document transfer over the World Wide Web. HTTP is a RESTful protocol. When developers talk about "using REST Web services" it is probably more accurate to say "using HTTP."

REST是Roy Fielding发明的架构,并在他的论文架构风格和基于网络的软件架构设计中进行了描述。Roy也是HTTP的主要作者,这个协议定义了万维网上的文档传输。HTTP是一个RESTful协议。当开发人员谈到“使用REST Web服务”时,更准确的说法可能是“使用HTTP”。

SOAP is a XML-based protocol that tunnels inside an HTTP request/response, so even if you use SOAP, you are using REST too. There is some debate over whether SOAP adds any significant functionality to basic HTTP.

SOAP是一种基于xml的协议,它在HTTP请求/响应中隧道,所以即使您使用SOAP,您也在使用REST。对于SOAP是否向基本HTTP添加任何重要功能,存在一些争论。

Before authoring a Web service, I would recommend studying HTTP. Odds are your requirements can be implemented with functionality already defined in the spec, so other protocols won't be needed.

在编写Web服务之前,我建议研究HTTP。很有可能您的需求可以用规范中已经定义的功能实现,因此不需要其他协议。

#18


7  

I am looking at the same issue. Seems to me that actually REST is quick and easy and good for lightweight calls and responses and great for debugging (what could be better than pumping a URL into a browser and seeing the response).

我也在关注同样的问题。在我看来,REST实际上是快速、简单、适合轻量级调用和响应,并且非常适合调试(还有什么比在浏览器中输入URL并查看响应更好的呢)。

However where REST seems to fall down is to do with the fact that its not a standard (although it is comprised of standards). Most programming libraries have a way of inspecting a WSDL to automatically generate the client code needed to consume a SOAP based services. Thus far consuming REST based web services seems a more adhoc approach of writing an interface to match the calls that are possible. Making a manual http request then parsing the response. This in itself can be dangerous.

然而,在哪里休息似乎与它不是标准的事实有关(尽管它是由标准组成的)。大多数编程库都有检查WSDL的方法来自动生成使用基于SOAP的服务所需的客户端代码。到目前为止,使用基于REST的web服务似乎是编写接口以匹配可能的调用的一种更特别的方法。创建一个手动http请求,然后解析响应。这本身就是危险的。

The beauty of SOAP is that once a WSDL is issued then business' can structure their logic aorund that set contract any change to the interface will change the wsdl. There isnt any room for manouvre. You can validate all requests against that WSDL. However because a WSDL doesnt properly describe a REST service then you have no defined way of agreeing on the interface for communication.

SOAP的美妙之处在于,一旦发布了WSDL,业务“就可以构造它们的逻辑主动脉,设置对接口的任何更改都将更改WSDL。”没有任何施展空间。您可以验证所有针对该WSDL的请求。然而,由于WSDL不能正确地描述REST服务,所以您没有定义的方式来约定用于通信的接口。

From a business perspective this does seem to leave the communication open to interpretation and change which seems like a bad idea.

从商业的角度来看,这确实让沟通变得更容易理解和改变,这似乎是一个糟糕的想法。

The top 'Answer' in this thread seems to say that SOAP stands for Simple Object-oriented Access Protocol, however looking at wiki the O means Object not Object-oriented. They are different things.

这个线程中最上面的“答案”似乎是SOAP代表简单的面向对象访问协议,但是看wiki O表示对象而不是面向对象的。它们是不同的东西。

I know this post is very old but thought I should respond with my own findings.

我知道这篇文章很老了,但我认为我应该用我自己的发现来回应。

#19


6  

It's a good question... I don't want to lead you astray, so I'm open to other people's answers as much as you are. For me, it really comes down to cost of overhead and what the use of the API is. I prefer consuming web services when creating client software, however I don't like the weight of SOAP. REST, I believe, is lighter weight but I don't enjoy working with it from a client perspective nearly as much.

这是一个好问题……我不想把你引入歧途,所以我和你一样愿意接受别人的答案。对我来说,这主要是因为开销和API的使用。我喜欢在创建客户端软件时使用web服务,但是我不喜欢SOAP的重量。我相信,休息可以减轻体重,但我不喜欢从客户的角度来看待它。

I'm curious as to what others think.

我很好奇别人怎么想。

#20


6  

Listen to this podcast to find out. If you want to know the answer without listening, then OK, its REST. But I really do recommend listening.

请收听本期播客,找出答案。如果你想不听就知道答案,那好吧,就到此为止。但是我真的推荐大家去听。

#21


6  

My general rule is that if you want a browser web client to directly connect to a service then you should probably use REST. If you want to pass structured data between back-end services then use SOAP.

我的一般规则是,如果您希望浏览器web客户端直接连接到服务,那么您应该使用REST。如果希望在后端服务之间传递结构化数据,那么使用SOAP。

SOAP can be a real pain to set up sometimes and is often overkill for simple web client and server data exchanges. Unfortunately, most simple programming examples I've seen (and learned from) somewhat reenforce this perception.

SOAP有时设置起来确实很麻烦,对于简单的web客户端和服务器数据交换来说,它通常是多余的。不幸的是,我所见过(并从中学到的)的大多数简单的编程示例都在某种程度上强化了这种感觉。

That said, SOAP really shines when you start combining multiple SOAP services together as part of a larger process driven by a data workflow (think enterprise software). This is something that many of the SOAP programming examples fail to convey because a simple SOAP operation to do something, like fetch the price of a stock, is generally overcomplicated for what it does by itself unless it is presented in the context of providing a machine readable API detailing specific functions with set data formats for inputs and outputs that is, in turn, scripted by a larger process.

也就是说,当您开始将多个SOAP服务组合在一起,作为数据工作流驱动的更大流程的一部分时(请考虑企业软件),SOAP确实很出色。这是许多SOAP编程示例无法传达的,因为一个简单的SOAP操作,如获取股票的价格,它本身通常是复杂的,除非它的上下文中提出了提供一个机器可读的API详细说明特定功能和设置数据格式的输入和输出,反过来,通过更大的化的过程。

This is sad, in a way, as it really gives SOAP a bad reputation because it is difficult to show the advantages of SOAP without presenting it in the full context of how the final product is used.

这在某种程度上是令人遗憾的,因为它确实给SOAP带来了不好的名声,因为如果不在最终产品如何使用的完整上下文中展示SOAP的优点,就很难展示它。

#22


4  

SOAP embodies a service-oriented approach to Web services — one in which methods (or verbs) are the primary way you interact with the service. REST takes a resource-oriented approach in which the object (or the noun) takes center stage.

SOAP体现了面向服务的Web服务方法——其中方法(或动词)是与服务交互的主要方式。REST采用面向资源的方法,对象(或名词)处于中心位置。

#23


4  

In sense with "PHP-universe" PHP support for any advanced SOAP sucks big time. You will end up using something like http://wso2.com/products/web-services-framework/php/ as soon as you cross the basic needs, even to enable WS-Security or WS-RM no inbuilt support.

从某种意义上来说,PHP对任何高级SOAP的支持都很糟糕。一旦跨越基本需求,您最终将使用http://wso2.com/products/web服务-framework/php/之类的内容,甚至可以启用WS-Security或WS-RM no内置支持。

SOAP envelope creation I feel is lot messy in PHP, the way it creates namespaces, xsd:nil, xsd:anytype and old styled soap Services which use SOAP Encoding (God knows how's that different) with in SOAP messages.

我觉得在PHP中创建SOAP信封很麻烦,它在SOAP消息中创建名称空间、xsd:nil、xsd:any类型和旧风格的SOAP服务(天知道有什么不同)的方式。

Avoid all this mess by sticking to REST, REST is nothing really big we have been using it since the start of WWW. We realized only when this http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm paper came out it shows how can we use HTTP capabilities to implement RESTFul Services. HTTP is inherently REST, that doesn't mean just using HTTP makes your services RESTFul.

通过坚持休息来避免这些混乱,休息并不是什么大问题,我们从WWW开始就一直在使用它。我们只有在这个http://www.ics.uci.edu/~fielding/pub /dissertation/top.htm论文发表时才意识到,它展示了如何使用HTTP功能实现RESTFul服务。HTTP本质上是REST,这并不意味着仅使用HTTP就可以使服务RESTFul。

SOAP neglects the core capabilities of HTTP and considers HTTP just as an transport protocol, hence it is transport protocol independent in theory (in practical it's not the case have you heard of SOAP Action header? if not google it now!).

SOAP忽略了HTTP的核心功能,并将HTTP视为传输协议,因此它在理论上是独立于传输协议的(实际上不是这样的,您听说过SOAP操作头吗?)如果不是谷歌现在!)

With JSON adaption increasing and HTML5 with javascript maturing REST with JSON has become the most common way of dealing with services. JSON Schema has also been defined can be used for enterprise level solutions (still in early stages) along with WADL if needed.

随着JSON适应能力的提高,HTML5和javascript的成熟,REST和JSON已经成为处理服务的最常见方式。还定义了JSON模式,可以用于企业级解决方案(仍然处于早期阶段),如果需要的话还可以使用WADL。

PHP support for REST and JSON is definitely better than existing inbuilt SOAP support it has.

PHP对REST和JSON的支持肯定优于现有的内置SOAP支持。

Adding few more BUZZ words here SOA, WOA, ROA

在这里添加更多的术语SOA, WOA, ROA

http://blog.dhananjaynene.com/2009/06/rest-soa-woa-or-roa/

http://blog.dhananjaynene.com/2009/06/rest-soa-woa-or-roa/

http://www.scribd.com/doc/15657444/REST-White-Paper

http://www.scribd.com/doc/15657444/REST-White-Paper

by the way I do love SOAP especially for the WS-Security spec, this is one good spec and if someone thinking in Enterprise JSON adaption definetly need to come with some thing similar for JSON, like field level encryption etc.

顺便说一下,我非常喜欢SOAP,尤其是WS-Security规范,这是一个很好的规范,如果有人认为企业JSON适配器一定需要提供一些类似于JSON的东西,比如字段级加密等等。

#24


3  

One quick point - transmission protocol and orchestration;

一个快速点——传输协议和编排;

I use SOAP over TCP for speed, reliability and security reasons, including orchestrated machine to machine services (ESB) and to external services. Change the service definition, the orchestration raises an error from the WSDL change and its immediately obvious and can be rebuilt/deployed.

出于速度、可靠性和安全性的考虑,我使用了TCP之上的SOAP,包括编排好的机器到机器服务(ESB)和外部服务。更改服务定义,业务流程会从WSDL更改中引发错误,并立即明显,可以重新构建/部署。

Not sure you can do the same with REST - I await being corrected or course! With REST, change the service definition - nothing knows about it until it returns 400 (or whatever).

我不确定你是否可以用休息来做同样的事情——我在等待被纠正或纠正!使用REST,更改服务定义——直到它返回400(或其他)时才知道它。

#25


2  

If you are looking for interoperability between different systems and languages, I would definately go for REST. I've had a lot of problems trying to get SOAP working between .NET and Java, for example.

如果您正在寻找不同系统和语言之间的互操作性,那么我肯定会休息一下。例如,我在。net和Java之间使用SOAP时遇到了很多问题。

#26


2  

i create a benchmark for find which of them are faster! i see this result:

我创建了一个基准来查找其中哪个更快!我看到这个结果:

for 1000 requests :

1000个请求:

  • REST took 3 second
  • 剩下3秒
  • SOAP took 7 second
  • SOAP 7秒

for 10,000 requests :

10000个请求:

  • REST took 33 second
  • 其他33秒
  • SOAP took 69 second
  • 肥皂花了69秒

for 1,000,000 requests :

1000000个请求:

  • REST took 62 second
  • 剩下62秒
  • SOAP took 114 second
  • 肥皂花了114秒

#27


0  

An old question but still relevant today....due to so many developers in the enterprise space still using it.

一个老问题,但仍有关今天....由于许多开发人员仍在使用它。

My work involves designing and developing IoT (Internet of Things) solutions. Which includes developing code for small embedded devices that communicate with the Cloud.

我的工作包括设计和开发物联网解决方案。这包括为与云通信的小型嵌入式设备开发代码。

It is clear REST is now widely accepted and useful, and pretty much the defacto standard for the web, even Microsoft has REST support included throughout Azure. If I needed to rely on SOAP I could not do what I need to do, as is just too big, bulky and annoying for small embedded devices.

很明显,REST现在已经被广泛接受,并且非常有用,而且几乎是web的实际标准,甚至微软也在Azure中包含了REST支持。如果我需要依赖SOAP,我就不能做我需要做的事情,因为它太大、太笨重,而且讨厌小型嵌入式设备。

REST is simple and clean and small. Making it ideal for small embedded devices. I always scream when I am working with a web developer who sends me a WSDLs. As I will have to begin an education campaign about why this just isn't going to work and why they are going to have to learn REST.

休息简单、干净、小。使其成为小型嵌入式设备的理想选择。当我与一个向我发送wsdl的web开发人员一起工作时,我总是会尖叫。因为我将不得不开始一场教育运动,关于为什么这是行不通的,为什么他们要学习休息。

#28


0  

1.From my experience. I would say REST gives you option to access the URL which is already built. eg-> a word search in google. That URL could be used as webservice for REST. In SOAP, you can create your own web service and access it through SOAP client.

1。从我的经验。我想说REST让你选择访问已经构建好的URL。>在谷歌中的单词搜索。该URL可以用作REST的webservice。在SOAP中,您可以创建自己的web服务并通过SOAP客户机访问它。

  1. REST supports text,JSON,XML format. Hence more versatile for communicating between two applications. While SOAP supports only XML format for message communication.
  2. 其他支持文本、JSON、XML格式。因此,在两个应用程序之间进行通信时更加灵活。而SOAP只支持消息通信的XML格式。