What is web service?

xiaoxiao2021-03-06  96

What is web service?

What is the Web Service; in what circumstances you should use the web service.

Distributed applications and browsers

Studying the current application development, you will find an absolute tendency: people began to prefer the browser-based thin client application. This is of course not because thin customers can provide a better user interface, but because it avoids high costs on desktop applications. Release desktop applications is high, half is because the application is installed and configured, and the other half is a problem between customers and servers.

Traditional Windows rich client applications use DCOM to communicate with the server and call remote objects. Configuring DCOM will be a very challenging job in a large network, and it is also a nightmare of many IT engineers. In fact, many IT engineers prefer to endure the functional restrictions brought by the browser, and do not want to run a DCOM on the LAN. In my opinion, the result is an application that is easy to publish, but the development is difficult, and the user interface is extremely limited. Extremely, that is, you spent more funds and time, but developed applications from users to seem weaknesses. Do not believe? Ask your accountant what is idea for new browser-based accounting software: Most business programs users want to use a more friendly Windows user interface.

About communication issues for clients and servers, a perfect solution is to communicate with the HTTP protocol. This is because any machine running a web browser is using the HTTP protocol. At the same time, many firewalls are also configured to only allow HTTP connections.

Many commercial procedures are still in another problem, that is, interoperability with other programs. If all applications are written in a COM or .NET language and run on a Windows platform, it is too peaceful. However, in fact, most commercial data still stores in the form of non-relational files (VSAM) on large hosts, and has been accessed by the Cobol language. Moreover, there are still many commercial procedures to continue using C , Java, Visual

Basic and other variety of languages. Now, in addition to the simplest procedure, all applications need to integrate with applications running on other heterogeneous platforms and perform data exchange. Such tasks are typically made of a special method, such as file transfer and analysis, message queues, and APIs that apply to some cases, such as IBM's "advanced programs to program communication (APPC)". In the past, there is no application communication standard, which is independent of the platform, sets the model and programming language. Only through the Web

Service, clients, and servers are free to communicate with HTTP, regardless of the platforms and programming languages ​​of the two programs.

What is Web Service

For this issue, we have at least two answers. From the surface, the Web Service is an application that exposes an API that can be called by the web. That is to say, you can call this application with a programming method. We call the app called this web service. For example, you want to create a web service, its role is to return the current weather condition. Then you have established an ASP page that accepts postal code as a query string, then returns a string separated by a comma, which contains current temperatures and weather. To call this ASP page, the client needs to send the following HTTP GET request:

http://host.company.com/weather.asp?zipcode=20171

The data returned should be like this:

21, sunny

This ASP page should be calculated as a web service. Because it is based on the HTTP GET request, it exposes an API that can be called by the web. Of course, Web Service has more things. Below is a more accurate explanation of Web Service: Web Services is a new platform for establishing interoperable distributed applications. As a Windows programmer, you may have already established a component-based distributed application with COM or DCOM. COM is a very good component technology, but we are also very easy to mention COM and cannot meet the requirements.

The Web Service platform is a set of standards that define how the application implements interoperability on the Web. You can use any language you like, write Web Service on any of your favorite platform, as long as we can query and access these services through the Web Service standard.

New platform

The Web Service platform requires a set of protocols to create a distributed application. Any platform has its data representation method and type system. To achieve interoperability, the Web Service platform must provide a set of standard type systems to communicate different types of systems in different platforms, programming languages, and component models. In a conventional distributed system, an interface-based platform provides some ways to describe interfaces, methods, and parameters (translation: such as IDL language in COM and COBAR). Similarly, the Web Service platform must also provide a standard to describe the Web Service, allowing customers to get enough information to call this web.

SERVICE. Finally, we must also have a method to remotely call this Web Service. This method is actually a remote procedure call protocol (RPC). In order to achieve interoperability, this RPC protocol must also be independent of platform and programming language. The following subsections briefly describe these three techniques that make up the Web Service platform.

XML and XSD

Scalable Markup Language (XML) is the basic format representing the data in the Web Service platform. In addition to easy establishment and easy analysis, the main advantage of XML is that it is both a platform-independent, and it is not related to the manufacturer. Non-relatedity is more important than technological superiority: software vendors do not choose a technique invented by competitors.

XML solves the problem of data representation, but it does not define a set of standard data types, but didn't say how to extend this set of data types. For example, what is the number of plastic surgery? 16-bit, 32-bit, or 64? These details are important for achieving interoperability. The XML Schema (XSD) developed by W3C is a set of standards that dedicate this problem. It defines a set of standard data types and gives a language to extend this set of data types. The Web Service platform is using XSD as its data type system. When you construct a Web Service in a Web Service (such as VB.NET or C #), all data types you use must be converted to the XSD type in order to comply with the Web Service standard. The tool you use may have automatically finished this conversion, but you are likely to modify the conversion process based on your needs. In the second chapter, we will go deep into XSD, learn how to convert custom data types (for example, classes) to XSD.

SOAP

After the Web Service is built, you or others will call it. The Simple Object Access Protocol (SOAP) provides a standard RPC method to call the Web Service. In fact, SOAP is a bit word here: it means that the following Web Service is expressed in an object, but the fact is not necessarily: you can write your web service into a series of C functions and still Use SOAP to call. The SOAP specification defines the format of the SOAP message, and how to use SOAP through the HTTP protocol. SOAP is also based on XML and XSD, XML is a SOAP data encoding method. Chapter III We will discuss SOAP and meet the various elements of SOAP messages. WSDL

How would you introduce someone to your web service, and the parameters when you call each function? You may write a set of documents yourself, you may even tell people who need to use your web service in verbally. These informal methods have at least a serious problem: When the programmer is sitting in front of the computer, when you want to use your web service, their tools (such as Visual Studio) cannot give them any help because these tools are fundamentally I don't know your web.

SERVICE. The solution is to provide a formal description document with a machine to read. The Web Service Description Language (WSDL) is an XML-based language that describes Web Service and its functions, parameters, and return values. Because it is based on XML, WSDL is both machine readable, and people can read, this will be a big benefit. Some of the latest developments can generate the WSDL document according to your Web Service, and generate the code that calls the corresponding web service.

转载请注明原文地址:https://www.9cbs.com/read-122621.html

New Post(0)