REST vs. SOAP可以获得大量具有安全性的数据

时间:2021-10-20 13:17:00

I have a requirement where I have large amount of data(in form of pdf,images,doc files) on server which will be distributed to many users. I want to pull these file using web services along with their meta-data. I will be getting the files in bytes. I am confused in which type of web service will be more secure, easy to parse? Which one is easy to implement on iPhone client?

我有一个要求,我在服务器上有大量的数据(pdf格式,图片,doc文件),这些数据将分发给许多用户。我想使用web服务和它们的元数据来提取这些文件。我将以字节为单位获取文件。我对哪种类型的web服务更安全、更容易解析感到困惑?哪一个在iPhone客户端上容易实现?

I know REST is simpler but I read somewhere that it is not suitable for distributed environment. At the same time SOAP is too heavy for mobile platform.

我知道REST更简单,但是我在某处读到它不适合分布式环境。与此同时,SOAP对于移动平台来说太重了。

I have searched many sites describing how REST is easier and how SOAP is secure. I got confused about which one to use? Also about the kind of response, which will be better JSON or XML for my requirement?

我搜索了很多网站,描述了REST如何变得更容易,SOAP如何安全。我不知道该用哪个?关于响应的类型,对于我的需求,哪个是更好的JSON或XML ?

2 个解决方案

#1


2  

For your requirements JSON will be the best kind of response because it is way smaller than XML (More than 50% smaller in many tests). You can use SBJSON (https://github.com/stig/json-framework/) to parse it easily on iOS.

对于您的需求,JSON将是最好的响应,因为它比XML小得多(在许多测试中比XML小50%以上)。您可以使用SBJSON (https://github.com/stir/json -framework/)在iOS上轻松解析它。

Concerning REST or SOAP, the last one is indeed really heavy for mobile platform and not so easy to implement. SOAP requires XML too and cannot be used with JSON. Whereas with REST you can use JSON or XML and easily implement it on iOS with RESTKit (http://restkit.org/), for security you can use an SSL connection with HTTPS and a signed certificate.

关于REST或SOAP,最后一个对于移动平台来说确实很重,而且不太容易实现。SOAP也需要XML,不能与JSON一起使用。而使用REST,您可以使用JSON或XML并轻松地在iOS上使用RESTKit (http://restkit.org/)实现它,为了安全,您可以使用带有HTTPS的SSL连接和签名证书。

The only advantage of SOAP is the WSDL (Webservice specification) which made your webservices really strong.

SOAP的唯一优点是WSDL (Webservice规范),它使您的webservices变得非常强大。

#2


0  

Unless you have a specific requirement to pull the file data and the metadata in the same response, you might consider just pulling down the file with a regular HTTP GET. You can get decent security with HTTPS and Basic Auth or client certificates. I would then include a Link header pointing to the metadata for your file, as in:

除非您有在相同响应中拉出文件数据和元数据的特定需求,否则您可以考虑使用常规的HTTP GET拉出文件。您可以通过HTTPS和基本身份验证或客户端证书获得良好的安全性。然后,我将包含指向文件元数据的链接头,如:

Link: </path/to/metadata>;rel=meta

In particular, this lets you have separate caching semantics for the file itself and for its metadata, which is useful in the common case where the files are much larger than their metadata and where metadata can change without file contents changing.

特别是,这使您能够为文件本身和它的元数据拥有独立的缓存语义,这在文件比元数据大得多的常见情况下非常有用,而且元数据可以在不改变文件内容的情况下进行更改。

#1


2  

For your requirements JSON will be the best kind of response because it is way smaller than XML (More than 50% smaller in many tests). You can use SBJSON (https://github.com/stig/json-framework/) to parse it easily on iOS.

对于您的需求,JSON将是最好的响应,因为它比XML小得多(在许多测试中比XML小50%以上)。您可以使用SBJSON (https://github.com/stir/json -framework/)在iOS上轻松解析它。

Concerning REST or SOAP, the last one is indeed really heavy for mobile platform and not so easy to implement. SOAP requires XML too and cannot be used with JSON. Whereas with REST you can use JSON or XML and easily implement it on iOS with RESTKit (http://restkit.org/), for security you can use an SSL connection with HTTPS and a signed certificate.

关于REST或SOAP,最后一个对于移动平台来说确实很重,而且不太容易实现。SOAP也需要XML,不能与JSON一起使用。而使用REST,您可以使用JSON或XML并轻松地在iOS上使用RESTKit (http://restkit.org/)实现它,为了安全,您可以使用带有HTTPS的SSL连接和签名证书。

The only advantage of SOAP is the WSDL (Webservice specification) which made your webservices really strong.

SOAP的唯一优点是WSDL (Webservice规范),它使您的webservices变得非常强大。

#2


0  

Unless you have a specific requirement to pull the file data and the metadata in the same response, you might consider just pulling down the file with a regular HTTP GET. You can get decent security with HTTPS and Basic Auth or client certificates. I would then include a Link header pointing to the metadata for your file, as in:

除非您有在相同响应中拉出文件数据和元数据的特定需求,否则您可以考虑使用常规的HTTP GET拉出文件。您可以通过HTTPS和基本身份验证或客户端证书获得良好的安全性。然后,我将包含指向文件元数据的链接头,如:

Link: </path/to/metadata>;rel=meta

In particular, this lets you have separate caching semantics for the file itself and for its metadata, which is useful in the common case where the files are much larger than their metadata and where metadata can change without file contents changing.

特别是,这使您能够为文件本身和它的元数据拥有独立的缓存语义,这在文件比元数据大得多的常见情况下非常有用,而且元数据可以在不改变文件内容的情况下进行更改。