The difference between Webserivce and WEBAPI

Source: Internet
Author: User

First, what is a Web Service

WEB Service technology enables different applications running on different machines to exchange data or integrate with each other without the use of additional, specialized third-party software or hardware. Applications that are implemented according to the Web Service specification can exchange data with each other, regardless of the language, platform, or internal protocol they are using.

It is based on the SOAP protocol, and the data format is XML.

Second, what is the Web API

The Web API is a network application interface. Contains a wide range of functions, network applications through the API interface, can realize storage services, messaging services, computing services and other capabilities, leveraging these capabilities can be used to develop powerful Web applications.

It can interface with various clients (browser, mobile device), build the framework of HTTP service

Third, the relationship between Web service and Web API

1. The Web service uses the SOAP protocol, and the Web API uses the HTTP protocol

http: is a standard (TCP) for client and server-side requests and responses. The purpose of the HTTP protocol is to provide a way to publish and receive htttp pages

Client-to-server interaction with an HTTP protocol: a request is initiated by an HTTP client to establish a TCP connection to the server-specified port (by default, port 80). The HTTP server listens on that port for requests sent by the client. Once the request is received, the server (to the client) sends back a status line, such as "http/1.1 OK", and (in response) message, the message body may be the requested file, error message, or some other information.

SOAP protocol: It describes a lightweight protocol for exchanging information in a decentralized or distributed environment. SOAP, based on the HTTP protocol, is an XML-based protocol.

Different: is the underlying communication protocol, the request package format is different, the SOAP package is XML format, HTTP plain text format.

Relationship: SOAP is a communication protocol, SOAP on the basis of the HTTP protocol, the request parameters written as XML, placed on the HTTP body on the submission of a Web service server (servlet,asp, etc.) processing is completed, The result is also written as XML as response back to the client, in order to make the client and the Web service can correspond to each other, you can use WSDL as a description of this mode of communication, using the WSDL tool can automatically generate WS and client framework files, SOAP has the ability to serialize complex objects into XML.

2. XML and JSON in data transfer

The advantages of JSON: Data structure is clear, readability is stronger than XML, parsing rules are simple, lightweight, flexible, performance is higher than XML

The drawback of JSON is that the data type definition is ambiguous, such as: {"price":12580} in JSON, you cannot know whether the price is int, float, or double.

The advantages of XML: Powerful, powerful data type, accurate description of the content of the data, with it, mom no longer worry about the back end of the data format is not right.

The disadvantage of XML: too bloated, sometimes powerful function is not what we need, analytic rules are many, for the pursuit of high development speed and low development threshold of enterprises, is a fatal wound.

Webserivce differs from Webapi

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.