As you’ve already seen in this chapter, XML can be a very effective way to represent business data for transfer between different systems and organizations. With the increasing importance of the Internet and related technologies, XML can be a key factor in helping organizations move their businesses to the Web.
When most people think of using the Internet for business, they think of online retailers selling goods and services through a Web site. Retail e-commerce solutions such as these usually rely on HTML pages accessed by means of a Web browser. The pages show product data from a database and allow customers to place orders, the details of which are also stored in a database.
XML can be an extremely effective way to pass data from the database to the Web application. XSL can then be used to easily transform the XML data into HTML for display in the browser. This approach is usually more efficient than retrieving data as a rowset and writing presentation logic in a Web page script or component to render the data. In addition, as more devices are used to connect to the Internet, the same XML data can be transformed using different style sheets to suit different client devices. For example, an XML product catalog could be transformed into HTML for display in a browser or into Wireless Markup Language (WML) for display on a Wireless Application Protocol (WAP)–enabled cell phone. This flexibility makes XML a great choice for developing Web-based applications that will be accessed by multiple client types.
Of course, Internet technologies such as HTTP are often used to build internal applications. This is particularly helpful in environments where multiple platforms and development languages are used because an Intranet-based solution allows any application that can communicate over TCP/IP to be integrated.
For applications that allow users to access and manipulate data, XML-aware browsers such as Microsoft Internet Explorer can be used to download and render the data. Users can then manipulate the data in the browser using XML data islands before sending the updated data back to the server for storage in the database.
Existing applications running on platforms such as mainframes or UNIX can use XML as a neutral way to describe data. For example, suppose a mail-order company with a large existing Information Management System (IMS) application running on a mainframe decided to build a Web-based e-commerce program using Windows 2000 and SQL Server. Existing telephone sales orders can continue to be entered into the IMS application as before, and new orders placed through the Web site can be represented as XML and passed to the mainframe to be stored in the IMS application.
One of the most important aspects of Web development is the integration of business processes across trading partners. Most interbusiness processes involve an exchange of business documents, such as orders, invoices, delivery notes, and so on. XML provides an ideal way to describe these business documents for exchange across the Internet. XML schemas can be used to define the XML representation of the business documents, allowing trading partners to agree on a format for the data being exchanged. Of course, each organization can represent the data differently internally and use XSL to transform data for exchange.
Because XML is a text-based language, business documents can be exchanged by using any protocol, such as HTTP (or more likely HTTPS), SMTP, or FTP, or by using a message queuing solution. This flexibility makes it possible for any business to integrate with its trading partners over the Internet.
Throughout the rest of this book, I’ll be examining various ways in which XML can be used to Web-enable the fictional Northwind Traders organization. I’ve chosen Northwind Traders as the basis for the examples because it represents the kind of organization that will benefit most from the use of XML to integrate with trading partners and customers, and because the Northwind database comes with a standard installation of SQL Server 2000.
The Northwind Traders company is a fictional wholesaler that supplies food and drink products to various companies throughout the world. A SQL Server database is used to store employee, product, customer, order, and shipment data.
The Northwind Traders organization can benefit in a number of ways from Web-enabling the application. Customers could be allowed to browse the catalog over the Web or even download it as an XML document to display to their own customers. Business documents, such as orders and invoices, could be exchanged with customers and trading partners as XML, and employees could use browser-based applications to access business data over the corporate intranet. In each of these scenarios, two basic tasks need to be accomplished: relational data needs to be extracted from SQL Server as XML, and XML data needs to be inserted into SQL Server tables. In the following chapters, I’ll examine how the XML support in SQL Server 2000 can be used to perform these fundamental tasks.