Home > php教程 > PHP开发 > body text

Easily understand how WebService works

高洛峰
Release: 2016-12-15 15:19:04
Original
1139 people have browsed it

Let’s talk about WebService in a simpler way, so that you can understand it faster and easier. I hope it will be helpful to beginners.

WebService is a network-based, distributed modular component.

Let’s look directly at a simple workflow of WebService:

Client ——> Read WSDL document (understand webservice requests) ——> Call WebService

The above process is a rough description , the client reads the WSDL document to send a request, then calls the web server and finally returns it to the client. This is the same as an ordinary http request, request->processing->response. What is different from ordinary requests is that there is a webservice request WSDL document and SOAP protocol, as well as the Web Service request processor ISAPI Extension that comes with the .NET Framework.

Let’s take a look at a relatively complete process:

Client ——> Read WSDL document (generate SOAP request based on the document) ——>Send to Web server——> Hand to WebService request processor ( ISAPI Extension)

——> Process SOAP request——> Call WebService——> Generate SOAP response ——> The Web server hands it to the client through http

OK, I already understand it here Classmates, you can go and browse other articles. If you don’t understand, let’s continue below:

Let’s first explain a few terms that appear in the above process:

1. SOAP: It is based on XML Forms provide a simple, lightweight mechanism for exchanging structured and typed information in a decentralized or distributed environment. The basic structure of a SOAP message delivers XML data via the HTTP protocol. Simply put, it is an XML-based protocol.

2. WSDL: It is a standard for using XML documents to describe Web services. It is the interface definition language of Web services. It describes how to access specific interfaces and contains 3 basic attributes:

a. How to access services: interact with services Data format and necessary protocols.

b. Where is the service: Protocol-related addresses, such as url information, etc.

c. What functions does the service have: The specific operation methods provided by the service => Which callable methods are provided in your webservice

Detailed description of the principle:

No matter what tool or language is used to write WebService, it can be called through HTTP using the SOAP protocol, and its working principle is the same. After creating the WebService, expose it to Web clients. Clients of any language and platform can read its WSDL document to call the WebService. Clients can generate a SOAP request message based on the WSDL description document. WebService is deployed on a Web server (such as IIS). The SOAP request generated by the client will be embedded in an HTTP request and sent to the Web server. The Web server (IIS) will then forward the request to the WebService request processor.

For .Net, the WebService request processor is an ISAPI Extension that comes with the .NET Framework. The Web request processor is used to parse the received SOAP request, call WebService, and then generate the corresponding SOAP response. After the web server gets the SOAP response, it returns it to the client through an HTTP response.

WebService advantages:

1. Platform independence. WebService can be used on any platform

2. The programming language does not matter. Based on XML, XML itself has nothing to do with the platform, using XSD as the data type system. No matter what language is written, all data types will be converted to XSD, and only need to comply with the unified standards of WebService.

3. Deploying, upgrading and maintaining web services is simple and convenient.

4. Realize the aggregation of multiple data and multiple services.

5. Low cost.

6. Not affected by firewalls. Communication using the SOAP protocol encapsulates data in XML format and transmits it as ASCII text instead of binary. It is easy to debug and allows the data to easily pass through the firewall without opening a separate communication port.

Summary:

WSDL, SOAP and UDDI (Unified Description, Discovery and Integration Mechanism) work together to support WebService interaction with other services, applications and devices on the Internet. UDDI provides the function of publishing and locating Web services (please learn more by yourself), WSDL describes Web services, and SOAP services provide transmission messages.



For more articles related to easily understanding the working principle of WebService, please pay attention to the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!