“XML的制定目标为:
XML应该可以在互联网上直接使用(*就象HTML那样好用)。
XML应该支持各种不同的应用方式(*不但包括浏览,还包括对内容的分析)。
XML应该与SGML兼容(*子承父业嘛,后面我们会讲到,SGML是XML的直接先驱)。
处理XML文件的应用程序应该容易编写(*计算机系的研究生花上两周的工夫就该差不多了)。
XML中的可选特性的数量应该减到最小,最好减至没有(*可选特性经常造成混淆)。
XML文件应该具有良好的可读性,并且比较清晰(*别象HTML那样,如果不借助浏览器,要想读它简直就是对你意志力和耐心的考验)。
用XML设计新的置标语言应该方便快捷(你不必再去经历标准制定的繁琐程序了)。
XML设计的置标语言应该正式、简洁(不然怎么易写易读?)。
XML文件应该容易编制(想想要用“记事本”写个HTML是一件多么可怕的工作)。
XML标记的简洁性并不重要(你不必再去费尽心机减少标记)。
——Extensible Markup Language (XML) 1.0 Specs, The Annotated Version.”
让我们来考虑一个非常简单的例子。如果我们需要定义一个新的置标语言,叫做FCLML(F_company s Client List Markup Language)——F公司的客户列表置标语言。这个语言应该定义一些标签来代表可联系的客户和有关他们的信息。这组标签很简单,它们的优点是代表了一定的语意。让我们回想一下上一节中这些信息在HTML中是如何用标签〈UL〉和〈LI〉表示的。与之相比,下面这一段代码,显然更加清晰易读:
在XML中,置标的语法是通过文件类型定义DTD(Document Type Definition)来描述的。也就是说,我们通过DTD来描述什么是有效的标签,从而进一步定义置标语言的结构。在用XML定义的置标语言中,DTD与数据文件是分离的部分。第三章我们将详细讨论DTD的定义方法。这里我们先给出关于上例的DTD描述,让大家先睹为快:
You call Web services with messages that are written in the SOAP format. SOAP is a specification that defines the XML format for messages. A well-formed XML fragment enclosed in a couple of SOAP elements is a SOAP message. SOAP stands for Simple Object Access Protocol. You could print out a SOAP message, fax it to a remote location, and type it into the remote machine without violating the SOAP standard. More likely, you would send a SOAP message inside an HTTP message. There's no standard for how a SOAP message is carried, and SOAP doesn't care what the transport is. The SOAP specification defines what an HTTP message containing a SOAP message must look like.
The SOAP specification includes three major parts. The required part defines the structure of an XML document that can be used to exchange data between applications. Section 5 defines a way to encode programming language data types in XML. Such a message is called a section-5 encoded SOAP message. A regular message that contains an XML document is called a literal SOAP message. Section 7 of the SOAP definition is also optional. It deals with RPC (remote procedure calls), where the message is sent synchronously. You call a Web service's function and wait to check the return code. The default specification is for asynchronous call.
You can call Web services from JavaScript. In upcoming tips and columns we'll cover the motivation and the implementation of Web services, and how to use them from JavaScript.
Benefits of XML Web Services
Experts and visionaries believe that the benefits of XML Web services will be instrumental in propelling explosive business growth over the next few years. One of the major benefits is the Web services' ease of integration. You will easily integrate your software with other pieces of software. You can run on all kinds of machines, from the desktop to the mainframe, either within your enterprise or at external sites. This ease of integration will enable tighter business relationships and more efficient business processes.
With Web services readily available, and as the pool of XML Web services grows, you would be able to find software modules that can be integrated into your own application, by finding it and integrating it through XML Web services. Integrate with existing Web services instead of reinventing them. The bottom line is that you will be able to develop applications much faster than before.
An integral part of the XML Web services programming model, is the ease of integration with external data sources. No longer does each application need to copy and maintain external data sources. You can request and get information in real time, and transform it to your particular format. This will allow you to deliver individualized software and services, while your maintenance burden is reduced.
Consumers will enjoy ease of use when using XML Web services-based applications. XML Web services link applications, services, and devices together. Using Web services will be an integrated experience that excels in its simplicity. XML Web services give users the ability to act on information any time, any place, and from any smart device.
Businesses will love Web services because it will force them to streamline their processes. All suppliers will use the same language to describe their offerings. An XML Web service is a simple, reliable way to blend existing systems with new applications and services.