Main differences between SOAP and RESTful web serv

2020-01-27 08:49发布

Follow up question to this post:

For now I have a slight idea about the differences between SOAP and RESTful Services.

My question is when I should use SOAP, and when I should use RESTful; which one is "better" when it comes to performance/speed or request handling?

I'm implementing for the first time in RESTful(java) and I want know more about it; I've dealt with SOAP before.

标签: java soap rest
11条回答
霸刀☆藐视天下
2楼-- · 2020-01-27 09:23

SOAP

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

REST 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

查看更多
仙女界的扛把子
3楼-- · 2020-01-27 09:25

Soap Web-services :

  1. If your application needs a guaranteed level of reliability and security then SOAP offers additional standards to ensure this type of operation.
  2. If both sides (service provider and service consumer) have to agree on the exchange format then SOAP gives the rigid specifications for this type of interaction.

RestWeb-Services :

  1. Totally stateless operations: for stateless CRUD (Create, Read, Update, and Delete) operations.
  2. Caching situations: If the information needs to be cached.
查看更多
Root(大扎)
4楼-- · 2020-01-27 09:28

REST vs SOAP Web Services

I am seeing a lot of new web services are implemented using a REST style architecture these days rather than a SOAP one. Lets step back a second and explain what REST is.

What is a REST Web Service

The acronym REST stands for Representational State Transfer, this basically means that each unique URL is a representation of some object. You can get the contents of that object using an HTTP GET, to delete it, you then might use a POST, PUT, or DELETE to modify the object (in practice most of the services use a POST for this).

Who's using REST?

All of Yahoo's web services use REST, including Flickr, del.icio.us API uses it, pubsub, bloglines, technorati, and both eBay, and Amazon have web services for both REST and SOAP.

Who's using SOAP?

Google seams to be consistent in implementing their web services to use SOAP, with the exception of Blogger, which uses XML-RPC. You will find SOAP web services in lots of enterprise software as well.

REST vs SOAP

As you may have noticed the companies I mentioned that are using REST api's haven't been around for very long, and their apis came out this year mostly. So REST is definitely the trendy way to create a web service, if creating web services could ever be trendy (lets face it you use soap to wash, and you rest when your tired). The main advantages of REST web services are:

Lightweight - not a lot of extra xml markup Human Readable Results Easy to build - no toolkits required SOAP also has some advantages:

Easy to consume - sometimes Rigid - type checking, adheres to a contract Development tools For consuming web services, its sometimes a toss up between which is easier. For instance Google's AdWords web service is really hard to consume (in CF anyways), it uses SOAP headers, and a number of other things that make it kind of difficult. On the converse, Amazon's REST web service can sometimes be tricky to parse because it can be highly nested, and the result schema can vary quite a bit based on what you search for.

Which ever architecture you choose make sure its easy for developers to access it, and well documented.

Freitag, P. (2005). "REST vs SOAP Web Services". Retrieved from http://www.petefreitag.com/item/431.cfm on June 13, 2010

查看更多
不美不萌又怎样
5楼-- · 2020-01-27 09:28

REST is easier to use for the most part and is more flexible.Unlike SOAP, REST doesn’t have to use XML to provide the response. We can find REST-based Web services that output the data in Command Separated Value (CSV), JavaScript Object Notation (JSON) and Really Simple Syndication (RSS). We can obtain the output we need in a form that’s easy to parse within the language we need for our application.REST is more efficient(use smaller message formats),fast and closer to other Web technologies in design philosophy

查看更多
等我变得足够好
6楼-- · 2020-01-27 09:29

REST is an architecture. REST will give human-readable results. REST is stateless. REST services are easily cacheable.

SOAP is a protocol. It can run on top of JMS, FTP, Http.

查看更多
登录 后发表回答