My understanding of webservice is this
Recently, I encountered such a project at work (temporarily named Project A). Project A itself was developed in PHP, but its data came from another project developed in Java (temporarily named Project B). Project A could not operate the database of Project B. It had its own set of databases, but some places needed to use the content in Project B. So here we need a communication method to transfer the data in B to A. Naturally, I chose Webservice. I used PHP to build a Webservice service in Project A and provided B with the interface I needed to implement. As long as B called the corresponding interface and transferred the data to A in the data format required by the interface, it was done.
So what exactly is Webservice? When I first started using it, I looked up a lot of information on the Internet. Now I would like to share with you my own understanding of Webservice.
Webservice can be seen as a standard for communication between different devices. It has nothing to do with a specific language. If there is a relationship, it is that each language develops corresponding functions according to this webservice standard to implement this standard. For example, when project B transmits data to project A, it needs to be transmitted according to this Webservice standard to be successful.
Of course, for the above case, if project A needs to store a copy of part of the data in project B locally, but the business logic has nothing to do with B, then A needs to provide a webservice service, and B calls the interface to send data. Then B has nothing to do. Only when the corresponding data in B is updated, the webservice interface provided by A is called again to update the data in A. However, if the business is like this, project A does not need to store the data in B, it only uses part of the data in B for display, then we need to build a Webservice service in B, provide the corresponding interface, and A calls the Webservice interface provided by B to retrieve the data in B. In this way, when the data in B is updated, the data called by A is also the latest.
Having said so much above, it is nothing more than one sentence
Webservice is a standard defined to enable data transmission between different applications over the network. This standard has nothing to do with the specific language. As for which language provides the interface and which language is used to call it, it depends on the needs of the project.
Since it is a standard, there must be corresponding technologies to support the implementation of this standard. The following are the four technologies in Webservice: XML, WSDL, SOAP, and UDDI. In a complete set of Webservice services, these four technologies each have their own implementation value. The following will introduce their respective uses.
1. XML
XML is used to mark data (for a detailed introduction to XML tags, please refer to W3C). As we said above, webservice does not depend on a specific programming language. Different systems may be developed using different programming languages (such as above: Project A is developed using PHP, and Project B is developed using Java). Therefore, a method is needed to exchange data that is also independent of a programming language. Most software integrates XML tags, so data in XML format is used to achieve data exchange.
2. SOAP
SOAP is a special protocol used to transmit data. Once the caller finds the address that provides the Webservice interface, it will use the SOAP protocol to connect to the system that provides the Webservice.
3. WSDL
WSDL is used to describe the rules of the interface that the client can call. All these rules are defined in the WSDL file. When a client initiates a call, the Webservice provider will refer to the WSDL rules to verify the legitimacy of the data request.
4.UDDI
UDDI lists the services that can be accessed. When a system needs data, it will first search UDDI to find services other than itself that can obtain the data it needs, and then connect to obtain the data. This is somewhat similar to the function of DNS.
The above introduces the roles of these four technologies in the entire Webservice architecture. Next, we will connect these four items and see how the entire Webservice architecture is implemented.
First, the provider of Webservice will create some new interface rules in the WSDL file, and then send the WSDL file to UDDI for reporting and registration. The service requester (that is, the party that calls the Webservice interface) will first connect to UDDI to query which provider has the data it needs, and then connect to the service provider after finding it. At this time, the service provider interacts with the provider using the SOAP protocol. When the service provider receives the request, it will first verify the request, and the basis for the verification is the previously created WSDL rules. After the verification is passed, the service provider will send XML format data to the requester, and the SOAP protocol is also used for interaction. When the requester receives the XML data, the requester will use XSD to verify the legitimacy of the XML data. After the verification is passed, the data will be processed.
The whole process can be reflected in the following figure
The above is the entire Webservice implementation process. Looking at this process, I always feel that it is somewhat similar to the process of WEB application. First, you need to bind the domain name and IP address and report and register them in DNS. When a user visits, he will first access the DNS server with the domain name. DNS will resolve the domain name to the corresponding IP address and return this information to the user. After the user obtains the IP, he will access the corresponding website service based on the IP. At this time, the HTTP protocol is used between the user and the WEB service.
The above is my understanding of Webservice. As for when Webservice is appropriate, I can't say. I can only say that it depends on the actual situation. I have done limited projects. Although I have seen the use of Webservice on the Internet, I have not come into contact with some situations. It is difficult to draw conclusions about the benefits and disadvantages of using Webservice. If I am lucky enough to come into contact with other projects that use Webservice in the future, I will supplement and update this article. Of course, if you have any good suggestions, please leave a message below so that we can discuss and make progress together.
For reprinting, please send an email to 1244347461@qq.com for approval. After obtaining the author's consent, kindly include the source as a link.
Related Articles
What multipart/form-data does in post Upload upload files
Publish Date:2025/03/18 Views:63 Category:NETWORK
-
Everyone has used the attribute enctype="multipart/form-data" when uploading files using a form. What is the role of multipart/form-data? Let's talk about this topic. First, let's look at a case Look at the first code form action= "handl
About application/x-www-form-urlencoded
Publish Date:2025/03/18 Views:147 Category:NETWORK
-
As a data format of form, application/x-www-form-urlencoded has its own characteristics form action= "handle.php" method= "post" input type= "text" name= " uname" class= " uname" /br / input type= "text" name= "email" class=
WSDL looks like this
Publish Date:2025/03/18 Views:190 Category:NETWORK
-
When I first started learning Webservice, I found that there were quite a lot of knowledge points involved, and each point could be a school of its own. Especially when I saw WSDL, I looked up information for a long time, but I was still a
Which technology do you choose to implement the web chat room?
Publish Date:2025/03/18 Views:61 Category:NETWORK
-
With the rise of HTML5 Websockets, web chat applications are becoming more and more popular. Recently, I am working on a mobile web application, the core function of which is to implement web chat on the mobile phone. Of course, the functio
Implementing a group chat room using socket.io
Publish Date:2025/03/18 Views:65 Category:NETWORK
-
This article will share with you an example of using socket.io to realize the function of group chat. If you want to use socket.io, you must use nodejs to implement the server, so we need to install socket.io in nodejs Install socket.io How
Getting started with FastCGI
Publish Date:2025/03/18 Views:164 Category:NETWORK
-
In "First Contact with CGI", we mentioned the operating mechanisms of CGI and Server APIs, as well as their respective advantages and disadvantages. In this chapter, we will learn about FastCGI, which combines the advantages of CGI and Serv
Build the SVN service project and synchronize the code to the project directory
Publish Date:2025/03/18 Views:197 Category:NETWORK
-
As the project grows, more people are needed to participate in the development of the same project. SVN is used for multiple people to jointly develop the same project and share resources. There are two ways to run SVN server: one is as a s
How to Fix the “This Site Can’t Provide a Secure Connection” Error
Publish Date:2025/03/17 Views:164 Category:NETWORK
-
Nothing is more frustrating than receiving an error message that brings our work to a screeching halt—especially when security is involved. Seeing a “This Site Can’t Provide a Secure Connection” notification can be confusing and ala
9 Ways to Fix NET::ERR_CERT_AUTHORITY_INVALID Error
Publish Date:2025/03/17 Views:176 Category:NETWORK
-
Sometimes even after you have an SSL certificate installed on your website, your website’s users may encounter NET::ERR_CERT_AUTHORITY_INVALID an invalid certificate authority error. Despite the intimidating name, the invalid certificate