官术网_书友最值得收藏!

  • Cloud-Native Applications in Java
  • Ajay Mahajan Munish Kumar Gupta Shyam Sundar
  • 411字
  • 2021-06-24 19:07:19

The trio – REST, HTTP, and JSON

The web has made HTTP tremendously popular and is the de facto integration mechanism for accessing content on the internet. Interestingly, this technology was not hugely popular within applications that relied on native and binary protocols, such as RMI and CORBA for inter-application access.

When social consumer companies, such as Google, Amazon, Facebook, and Twitter, started publishing APIs to connect/integrate with their products, the de facto standard for integration across the web became HTTP/REST. Social consumer companies started investing in platforms for onboard developers to develop various applications leading to the proliferation of applications that relied on HTTP as the protocol.

The applications on the browser side are a mix of HTML and JavaScript. Information returned from the server or across other applications needs to be in a simple and usable format. JavaScript supports data manipulation, and the data format that it suited most is JavaScript Object Notation (JSON).

REST is a state representational style that provides a way to deal with interchange over HTTP. REST has a lot factors in its favor:

  • Utilizes the HTTP protocol standard, giving it an immense leg up for anything and everything on WWW
  • Mechanism to isolate the access to entities (GET/PUT/POST/DELETE) while still utilizing the same HTTP request model
  • Supports JSON as the data format

REST with JSON has become the dominant model over the SOAP/XML model. According to one statistic from ProgrammableWeb:

73% of the APIs on Programmable Web use REST. SOAP is far behind but is still represented in 17% of the APIs.

Let's cover some high-level reasons why the REST/JSON model is favored over the SOAP/XML model of service development:

  • SOAP model of contract first approach makes crafting web services difficult.
  • SOAP is complex compared to REST, giving a steeper learning curve as compared to REST.
  • REST is lightweight compared to SOAP and does not tax the bandwidth as much as SOAP.
  • Support for SOAP outside of the Java world is limited, relegating SOAP primarily to the enterprise world.
  • XML parsing on the client side is memory and compute intensive, which does not lend well to the mobile world.
  • XML Schema/markup provides structure definitions and validation models but at the expense of additional parsing. JSON has a loose syntax allowing rapid iterations on the data model.

Today, the reality is REST/JSON has been adopted as the standard for integration across programming languages providing an easy and simple way to integrate APIs over the internet.

主站蜘蛛池模板: 体育| 盐源县| 南木林县| 东乡县| 南岸区| 沙湾县| 城市| 灵丘县| 平远县| 赤壁市| 吉首市| 辉南县| 正定县| 潼关县| 罗源县| 嵊州市| 东莞市| 东宁县| 专栏| 崇明县| 辛集市| 米林县| 分宜县| 肇东市| 酉阳| 稻城县| 东山县| 玉田县| 化州市| 襄樊市| 西藏| 灵川县| 屯门区| 县级市| 庆元县| 碌曲县| 遂昌县| 云浮市| 三河市| 襄城县| 汕头市|