Home  >  Article  >  Backend Development  >  Tell you in detail why XML is important for Web services

Tell you in detail why XML is important for Web services

黄舟
黄舟Original
2017-03-04 17:10:441385browse

Web services are often described from the perspective of its component technologies. SOAP, UDDI, WSDL, xml and HTTP each form part of the Web service system, and they all play an important role. Let us look at the contribution of XML technology to the Web services platform.


Standardization


Compared with other Web service technologies, standardization is one of the characteristics of XML. XML provides a standard format for transferring data between Web service applications. The World Wide Web Consortium (W3C) manages XML standards and publishes them to XML technology providers around the world, which ensures the compatibility of XML products.

In addition to XML engines and products, there is also XML grammar (grammar). Each XML syntax is a standard way of formatting data in a specific problem domain. By following and adopting XML syntax, you can standardize the format of data communicated between two applications.


Interface protocol

Programmers often call it a protocol when programming an interface. From a programming perspective, interfaces provide programming structure without exposing the implementation. If you use DTD (Document Type Definition) and schema, then XML has similar characteristics. Both DTD and outline are used to describe the structure of XML documents and the rules for creating XML documents. Such a set of rules can be organized using one (or more) related DTDs (or outlines), which we call XML grammar.

XML grammar can not only be used to standardize communication between applications, but also provide an interface protocol for developers. In other words, when a developer creates an application that needs to use the structure of an XML document, he does not need to know how the document is implemented (that is, the actual XML document). DTD and outline describe the structure of the document, and they can serve as interface protocols for development. Any changes to the DTD also change the protocol.


Simplification

Another important aspect of XML documents is its simplification properties. I'm not implying that the implementation of XML is simple, but that the concepts and general approach to XML are simple. For example, XML is based on text documents, which simplifies the process of opening an XML document and viewing its contents.

It is convenient and important to simplify the Web service model with XML. Web services are inherently more complex than XML alone. Assuming that XML and CORBA are equally complex, and that other Web services technologies are equally complex, Web services technologies can become very unwieldy. But by using simple building block methods, such as XML, SOAP, etc., we can control the complexity of Web services within a tolerable range, so that applications created with it will not be difficult to control.


Encapsulation

Encapsulation is one of my favorite features of XML, especially when developing Web services. Essentially, encapsulation refers to the concept of taking one or more chunks of data and combining them into a simple object (rather than several independent objects). Encapsulation is similar to an aggregation, but there is an important difference between them, that is, encapsulation generally means that it has no external dependencies.

You can create XML documents with external dependencies; but in a transactional Web services model, it is more sensible to use encapsulation. By designing XML solutions that wrap dependencies, you can generally eliminate problems in transaction processing. Forcing the method of locating external data in a transaction and making it consistent with the XML data is harmful, especially if the external data changes frequently. If you encapsulate the data into XML grammar, you can obtain the correct data.

The above is the detailed content that tells you why XML is important to Web services. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!


Statement:
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