简体   繁体   English

何时使用网络服务

[英]When to use web services

I am new to the concept of web services but i have gone through few atrticles and have implemented REST services. 我对Web服务的概念是陌生的,但是我经历了很少的讨论,并实现了REST服务。 I have few questions 我有几个问题

  1. Are web services used only in the case of cross-platform communication? 仅在跨平台通信的情况下才使用Web服务吗?

  2. When to use SOAP or REST? 什么时候使用SOAP或REST? How do i make the decision 我如何做出决定

  3. What are the advantages of web services Web服务的优点是什么

Thanks in advance 提前致谢

Before you spend hours fretting over the choice between SOAP and REST, consider that some Web services support one and some the other. 在花费数小时为SOAP和REST之间的选择烦恼之前,请考虑一些Web服务支持另一个。 Unless you plan to create your own Web service, the decision of which protocol to use may already be made for you. 除非您打算创建自己的Web服务,否则可能已经为您决定了使用哪种协议。 Extremely few Web services, such as Amazon, support both. 极少数Web服务(例如Amazon)支持这两种服务。 The focus of your decision often centers on which Web service best meets your needs, rather than which protocol to use. 您的决策重点通常集中在最能满足您需求的Web服务上,而不是使用哪种协议。

SOAP is definitely the heavyweight choice for Web service access. SOAP绝对是Web服务访问的重要选择。 It provides the following advantages when compared to REST: 与REST相比,它具有以下优点:

Language, platform, and transport independent (REST requires use of HTTP)
Works well in distributed enterprise environments (REST assumes direct point-to-point communication)
Standardized
Provides significant pre-build extensibility in the form of the WS* standards
Built-in error handling
Automation when used with certain language products

REST is easier to use for the most part and is more flexible. REST在大多数情况下更易于使用,并且更加灵活。 It has the following advantages when compared to SOAP: 与SOAP相比,它具有以下优点:

No expensive tools require to interact with the Web service
Smaller learning curve
Efficient (SOAP uses XML for all messages, REST can use smaller message formats)
Fast (no extensive processing required)
Closer to other Web technologies in design philosophy

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

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