`
`
`
`
`
`Merrill Communications LLC
`d/b/a Merrill Corporation
`Exhibit 1006 pt. 2
`
`
`
`Heinemanu.
`
`An online auction is the epitome of a complex
`real—time interactive application, so the Micros-oft
`Web Applications Tit-am built a realistic Auction Demo
`to show how simply one can be implemented as an
`XML three-tier Web application. This chapter is
`sponsored by Microsoft Corporation.
`, and wasprepared by Charles
`
`ring he Auction Demo is a three—tier Web application that simu-
`
`lates an online auction using technologies that are available in
`Internet Explorer 4.0 (IE 4.0). It allows you to View the items
`available for auction, place bids on those items, and monitor the bids
`placed by fellow bidders.
`the Auction Demo has data
`Like Other three—tier Web applications,
`. sources on the backend, a user interface on the client, and a Web server in
`the middle. We’ll see how it was developed, using just three permanent Web
`pages:
`
`userInterface.htm
`This page uses Dynamic HTML (DHTML) to allow the Web
`browser to present the auction information to the user. It contains
`scripts that collect or update data on date middle tier by requesting
`Active Server Pages (ASP).
`
`auction.asp
`This page is an ASP file. When userInterfacehtm requests this
`page,
`the scripts in it are executed on the server. The scripts
`
`@1998 THE XML HANDBOOKm
`
`79
`
`
`
`
`
`80
`
`CHAPTER 6 |
`
`BUILDING AN ONLINE AUCTION WEB SITE
`
`generate auction.xml, an XML document that contains the latest
`auction data, which is delivered to the client.
`
`makebid.asp
`
`This page is requested by userInterface.htm when the user wants
`to make a bid. It is executed on the middle tier, causing the data
`source to be updated with the new bid information.
`
`The user interface (UI) for the Auction Demo is shown in Figure 6—1. It is
`the rendition of the userInterface.htm Dynamic HTML page, which is
`downloaded to the client when the user clicks on a link to the auction.
`
`That page has scripts within it that handle all the client—side activity.
`That includes requesting data from the middle tier in order to display the
`most current values of the items and bids. We’ll see later how the UI page
`does its thing, but first let’s look at how the middle tier collects and trans-
`mits the data. It does so by packaging the data as XML documents.
`
`6.I
`
`| Getting data from the middle tier
`
`The role of the middle tier in a Web application is to gather information
`from data sources and deliver it in a consistent manner to clients. In the
`
`Auction Demo we start with a single data source, an ODBC—compliant
`database. (Later we’ll see how multiple data sources of different kinds can
`be accessed.)
`
`The “Auction” database used for the Auction Demo is a relational data—
`
`base with two tables, an “Item” table and a “Bids” table. The “Item” table
`
`contains data about each of the items up for auction. It is shown in Figure
`6-2.
`
`For the sake of clarity, we’ll just cover the “Item” table in this chapter (the
`“Bids” are handled similarly). You can see the full demo at http: / /
`www.microsoft.com/xml. We want to deliver the data in that table in the
`
`form of an XML document, so the client’s user interface page won’t have to
`know anything about the actual data source.
`
`@1998 THE XML HANDBOOKTM
`
`
`
`
`
`81
`
`i1
`351$
`Fannie:
`
`History Duannehiimscieen
`
`33
`Mai
`
`$3000
`
`CURRENT ITEMS E
`Vase and Stones
`$3300
`Still Life I Onions
`$3200
`Sandstone
`$3500 ‘r'
`Jewelry Box
`$2800
`Personal Objects
`$3700
`Still Life I Sweets
`$2800 E‘Eid‘ie"
`Bread and Apples
`$2600 (enter name)
`Rnbbits
`$3100 George
`Risotto
`$3100 Ringo
`Paul
`
`Oil, 1996, 20x30 inches 5
`
`opening price
`RAnnoM BIDDER
`
`'1 AC H‘Jl‘f‘i’ E
`
`' Linda Mann
`VASE AND STONES
`iiopwigl‘il s 1997 Lima Mam a mine Mia-wail
`
`FREE
`
`(hm;
`$3300
`$3200
`$3100
`
`time
`
`itfi
`10:43? mil
`10:47 RM
`19:47 AM
`10:44 QM
`
`
`
` [El—I-—
` ' "I 'Egmwms-‘u'
`“'
`J
`"i
`fiaflmmjlw 0m.
`. ”Waikiki
`:EE‘JIFIQ‘? dam-Hologiu—hnmlgsemboaMubarak]
`
`Figure 6-1 The Auction Demo user interface.
`
`
`Tlflii
`fv’ass and Stones
`
`Still Life 1“ Onions
`Sandstone
`
`Jewelry Box
`
`Personal Objects“
`
`Still Life 1“ Sweets
`Bread and fipples
`
`Babbits
`
`Risotto
`
`
`
`Dimensions ' Materials '_ Year
`Alflst
`1999
`l2EIx3EI inches on
`:Linda Mann
`
`izoxso inches on
`:Linda Mann
`lEUKBU inohss Oil
`jLinda Mann
`
`iaoeao inches ioii
`Linda Mann
`
`12oeao inches Ion
`ILinda Mann
`
`!2oeao inches ion
`iLinda Mann
`l2ElK3U inohss Oil
`lLinda Mann
`
`!2E|}130 inohss .Oil
`lLinda Mann
`
`l2oe3o inches on
`l Linda Mann
`
`
`
`199?
`
`1995
`
`1994
`
`1995
`
`1994
`
`1995
`
`1999
`
`_ 1995
`
`Figure 6-2 The Auction Demo item table.
`
`@1998 THE XML HANDBOOKTM
`
`
`
`
`
`82
`
`CHAPTER 6 | BUILDING AN ONLINE AUCTION WEB SITE
`
`6.l.l Defining the XML document structure
`
`The key to creating useful XML documents is the proper structuring of the
`data. For the Auction Demo, that means deciding how a record in the “Item”
`table will be represented as an ITEM element in XML. There is a straight-
`forward mapping, shown in the following data—less element:
`
`Example 6-1. Template for an ITEM element.
`
`<ITEM>
`<TITLE></TITLE>
`<ARTIST></ARTIST>
`<DIMENSIONS></DIMENSIONS>
`<MATERIALS></MATERIALS>
`<YEAR></YEAR>
`</ITEM>
`
`
`For each field in the “Item” table, there is a corresponding subelement of
`the ITEM element.
`To generate XML documents with these ITEM elements, the Auction
`Demo uses ASP files.
`
`6.l.1 Using ASPfiles to generate XML
`documents
`
`XML can be generated on the middle tier using Active Server Pages. ASP
`offers an environment in which Web authors can create documents dynam—
`ically by intermixing markup languages with in—line scripts. The scripts can
`be written in a variety of scripting languages,
`including [Script and
`VBScript, and can invoke server-side components to access databases, exe—
`cute applications, and process information.
`When a browser requests an ASP file, it is first processed by the server,
`which delivers a generated Web page containing standard markup.
`In an ASP file, commands and scripts are delimited by “<%” and “%>”.
`Everything not so delimited is markup or data that will appear in the gener—
`ated page. For example, consider the following trivial ASP file:
`The file, after establishing that the scripting language is VBScript, creates
`the variable “Total” with the value “2”. The following line generates an
`
`@1998 THE XML HANDBOOKW
`
`
`
`
`
`6.1 1 GETTING DATA FROM THE MIDDLE TIER
`
`83
`
`Example 6-2. Sample ASP file.
`<%@ LANGUAGE
`VBScript%>
`<%DIM Total = 2%>
`<AMOUNT><%=Total%></AMOUNT>
`_____________—————————-
`
`XML “AMOUNT” element whose content is generated by executing the
`small script, which in this case retrieves the value of “Total”.
`When the browser requests this file, it will actually receive the XML doc-
`ument that is generated from the file, as shown in Example 6-3:
`
`Example 6-3. XML document generated by sample ASP file.
`<AMOUNT>2</AMOUNT>
`__—_________——————-———
`
`. 0/o>) does not cause an XML parsing
`.
`Note that the ASP syntax (<% .
`error. That is because the ASP file is not itself an XML document. The ASP
`file is processed on the server and only the generated XML document is
`returned to the client.
`
`In the case of the Auction Demo, the file auction.asp is used to access the
`“Auction” database and generate XML containing the data within the
`“Item” and "Bids” tables. The ability to generate XML on the middle tier
`makes it possible to provide the Web application with content that can be
`manipulated on the client and refreshed without having to refresh the entire
`user interface.
`
`In Example 6-4, aucrion.asp begins like the ASP file in Example 6—2, by
`declaring the scripting language. The next two lines are the XML declara—
`tion and the start-tag of the root element (AUCTIONBLOCK) of the
`XML document to be generated, which we will call “auction.xml”.
`
`Example 6-4. Start of auction.asp.
`<%@ LANGUAGE VBScript %>
`<?XML VERSION="1 . O " ?>
`<AUCTIONBLOCK>
`__________—__———————-—
`
`Next, a connection to the “Auction” database is established and that con—
`nection is opened:
`
`©1998 THE XML HANDBOOKTM
`
`
`
`
`
`84
`
`CHAPTER 6 | BUILDING AN ONLINE AUCTION WEB SITE
`
`Example 6-5. Connecting to the database.
`<%
`
`Set Conn = Server.CreateObject(”ADODB.Connection")
`Conn.0pen ”Auction",”Auction","Auction"
`%>
`———————_______________
`
`A “record set” variable (ItemRS) is now established to contain each
`record of the “Item” table as it is accessed, and a “Do While” loop is begun
`to perform the access.
`
`Example 6-6. Preparing to access the “Item” records.
`<%
`
`ItemRS = Conn.Execute("select
`Set
`Do While Not
`ItemRS.EOF
`%>
`———————_______——_____
`
`from item")
`
`*
`
`Next, the template in Example 6—1 is used to create the XML ITEM ele—
`ment that will be generated. Just as in Example 6-2, a small script is inserted
`as the content of each subelement of ITEM within auction.asp. In this case,
`the script extracts the corresponding field’s data from the record set.
`
`Example 6-7. Markup and scripts to generate an ITEM element.
`
`<ITEM>
`
`<TITLE><%=ItemRS("Title")%></TITLE>
`<ARTIST><%=ItemRS(”Artist")%></ARTIST>
`<DIMENSIONS><%=ItemRS("Dimensions")%></DIMENSIONS>
`<MATERIALS><%=ItemRS("Materials”)%></MATERIALS>
`<YEAR><%=ItemRS(“Year”)%></YEAR>
`</ITEM>
`'§—-———_____________
`
`After an ITEM element is generated, the script moves to the next record
`in the record set. The loop is then repeated. Once all of the records have
`been run through, the root element is ended.
`The complete auction.asp file is in Example 6—9.
`Example 6-10 is an abridged version of the XML document
`tion.xml) generated by the auctionasp file in Example 6—9.
`
`(auc-
`
`©1998THE XML HANDBOOKTM
`
`
`
`
`
`6.1 | GETTING DATA FROM THE MIDDLE TIER
`
`85
`
`
`Example 6-8. Repeating the loop and ending the document.
`<%
`ItemRS.MoveNext
`Loop
`%>
`</AUCTIONBLOCK>
`
`
`Example 6-9. The complete auction.asp file.
`<%@ LANGUAGE = VBSCript %>
`<?XML VERSION="l.O"?>
`<AUCTIONBLOCK>
`<%
`
`Set Conn = Server.CreateObject(”ADODB.Connection")
`Conn.Open "Auction",“Auction”,"Auction”
`Set
`ItemRS = Conn.Execute("select *
`from item")
`Do While Not
`ItemRS.EOF
`%>
`
`<ITEM>
`
`<TITLE><%=ItemRS("Title")%></TITLE>
`<ARTIST><%=ItemRS("Artist")%></ARTIST>
`<DIMENSIONS><%=ItemRS(”Dimensions”)%></DIMENSIONS>
`<MATERIALS><%=ItemRS(”Materials”)%></MATERIALS>
`<YEAR><%=ItemRS("Year")%></YEAR>
`</ITEM>
`<%
`ItemRS.MoveNext
`Loop
`%>
`</AUCTIONBLOCK>
`
`Example 6-10. Abridged auction.xml document generated by auction.asp.
`<?XML VERSION="l.O"?>
`<AUCTIONBLOCK>
`<ITEM>
`<TITLE>Vase and Stones</TITLE>
`<ARTIST>Linda Mann</ARTIST>
`<DIMENSIONS>20 X 30 inches<DIMENSIONS>
`<MATERIALS>Oil</MATERIALS>
`<YEAR>1996</YEAR>
`</ITEM>
`<ITEM>
`
`</ITEM>
`
`</AUCTIONBLOCK>
`____________________________________________________________________.
`
`@1998 THE XML HANDBOOKTM
`
`
`
`
`
`86
`
`CHAPTER 6 | BUILDING AN ONLINE AUCTION WEB smz
`
`6.l.3 Generating XML from multiple
`databases
`
`One powerful reason to generate XML documents on the middle tier is that
`they can contain data that is sourced from multiple independent databases.
`The technique is similar to what we’ve already seen. The only difference is
`that multiple database connections are made instead of one.
`
`The ASP file in Example 6-11 does just this, generating a single XML
`document with data from the databases “Galleryl” and “Gallery2”.
`
`The XML generated by the ASP file in Example 6-11 looks structurally
`just like Example 6—10, an AUCTIONBLOCK element with multiple
`ITEM children. However, the data content originates from two different
`data sources.
`
`Also notice that, for the DIMENSIONS, MATERIALS, and YEAR ele-
`ments, the source fields in the “Gallery2” database are actually labeled dif—
`ferently from the corresponding fields in “Gallery1.” One benefit of
`consolidating the data on the middle tier is that the semantics can be iden—
`tified consistently, and therefore made more easily accessible.
`
`6.I.4 Generating XML from both databases
`and XML data sources
`
`The middle tier can source data of different kinds, not just databases. In
`Example 6-11, the ASP file, as in previous examples, first accesses data from
`“Gallery I”, an ODBC compliant database. However, it then adds data
`from “Gallery 3”, a source of XML documents.
`
`is processed by the MSXML parser
`The Gallery3 XML document
`(details below), which allows access to the document’s data content. Note
`that there is no way — and no need — to tell whether Gallery3 is a persistent
`document, or was generated by another middle-tier application.
`
`Also, look at the YEAR element. Just as with the Gallery2 database in the
`previous example,
`the original semantic label — in this case the DATE
`generic identifier — is changed on the middle tier to ensure consistency.
`
`@1998 THE XML HANDBOOKTM
`
`
`
`
`
`6.1 1 GETTING DATA FROM THE MIDDLE TIER
`
`87
`
`Example 6-11. Generating one XML document from two databases.
`____—_—————————-
`<%@ LANGUAGE = VBScript %>
`<?XML VERSION=”1.0"?>
`<AUCTIONBLOCK>
`<%
`‘The connection to the Galleryl data source is made
`Set Conn = Server.CreateObject("ADODB.Connection“)
`Conn.Open "Galleryl",“Galleryl",”Galleryl"
`Set
`ItemRS = Conn.Execute("select
`*
`from item“)
`DO While Not
`ItemRS.EOF
`%>
`
`<ITEM>
`<TITLE><%=ItemRS("Title")%></TITLE>
`<ARTIST><%=ItemRS("Artist")%></ARTIST>
`<DIMENSIONS><%=ItemRS("Dimensions")%></DIMENSIONS>
`<MATERIALS><%=ItemRS("Materials")%></MATERIALS>
`<YEAR><%=ItemRS("Year")%></YEAR>
`</ITEM>
`<%
`ItemRS.MoveNext
`Loop
`%>
`
`<%
`'The connection to the Galleryz data source is made
`Set Conn = Server.CreateObject("ADODB.Connection")
`Conn.Open "Gallery2","Gallery2","Gallery2"
`Set
`ItemRS = Conn.Execute("select *
`from item")
`Do While Not
`ItemRS.EOF
`%>
`
`<ITEM>
`<TITLE><%=ItemRS("Title")%></TITLE>
`<ARTIST><%=ItemRS(”Artist")%></ARTIST>
`<DIMENSIONS><%=ItemRS("Size")%></DIMENSIONS>
`<MATERIALS><%=ItemRS("Medium")%></MATERIALS>
`<YEAR><%=ItemRS("Date")%></YEAR>
`</ITEM>
`<%
`ItemRS.MoveNext
`Loop
`%>
`</AUCTIONBLOCK>
`———————————————_
`
`©1998THE XML HANDBOOKTM
`
`
`
`
`
`88
`
`CHAPTER 6
`
`BUILDING AN ONLINE AUCTION WEB SITE
`
`Example 6-12. Generating one XML document from a database and
`anothernXBdI.docunnent.
`
`<%@ LANGUAGE = VBScript %>
`<?XML VERSION="1.0"?>
`<AUCTIONBLOCK>
`<%
`
`Server.CreateObject("ADODB.Connection")
`Set Conn
`Conn.Open "Galleryl",”Galleryl",”Galleryl"
`
`ItemRS = Conn.Execute("select *
`Set
`from item“)
`ItemRS.EOF
`Do While Not
`%>
`
`<ITEM>
`
`<TI"LE><%=ItemRS("Title")%></TITLE>
`
`<AR”IST><%=ItemRS(”Artist")%></ARTIST>
`<DIMENSIONS><%=ItemRS("Dimensions")%></DIMENSIONS>
`<MATERIALS><%=ItemRS(”Materials")%></MATERIALS>
`<YEAR><%=ItemRS("Year")%></YEAR>
`</ITEM>
`<%
`ItemRS.MoveNext
`Loop
`%>
`
`<%
`
`'Here the connection to the Gallery3 data is made
`Set XML 2 Server.CreateObject("msxml")
`XML.URL = "http://datasource3/Gallery3.xml"
`Set Items = XML.root.children
`For I = 0
`to Items.length —
`1
`%>
`
`<ITEM>
`
`<TITLE><%=Items.item(I).children.item(“TITLE").text%>
`</TITLE>
`<ARTIST><%=Items.item(I).children.item("ARTIST”).text%>
`</ARTIST>
`<DIMENSIONS><%=Items.item(I).children.item("DIMENSIONS").text%>
`</DIMENSIONS>
`<MATERIALS><%=Items.item(I).dhildren.item("MATERIALS").text%>
`</MATERIALS>
`<YEAR><%=Items.item(I).children.item("DATE").text%>
`</YEAR>
`</ITEM>
`<%Next%>
`</AUCTIONBLOCK>
`
`©1998THE XML HANDBOOKTM
`
`
`
`
`
`6.2 | BUILDING THE USER INTERFACE
`
`89
`
`6.1 | Building the user interface
`
`The user interface is critical to the success of any application. It must allow
`the user to interact with the application in an efficient and straightforward
`manner. The user interface for the Auction Demo was built using DHTML.
`
`DHTML is a set of features in Internet Explorer 4.0 for creating interac—
`tive and visually interesting Web pages. It is based on existing HTML stan—
`dards and is designed to work well with applications, ActiveX controls, and
`other embedded objects.
`
`With DHTML a developer can create a robust and efficient UI without
`additional support from applications or embedded controls, or even return
`trips to the server. A Dynamic HTML page is self—contained, using styles
`and scripts to process user input and directly manipulate the HTML
`markup and other text within the page.
`
`Let’s see how userInterface.htm creates the Auction Demo interface by
`using scripts and the [E 4.0 Document Object Model. Two basic techniques
`are employed: procedural scripts and descriptive binding.
`
`6.1.l Using procedural scripts
`
`Internet Explorer 4.0 includes the MSXAJL parser, which exposes the parsed
`XML document as a document object model.1 Once exposed, scripts can
`access the data content of the XML elements and dynamically insert the
`data into the user interface.
`
`The userInterface.htm code in Example 6—13 applies MSXIWL to auc—
`tion.xml, the XML document generated by auction.asp. That creates an
`ActiveX object representing the parsed document.
`
`Example 6-13. Creating the auction document object.
`var auction
`new Activexobj ect ( "msxml") ,-
`auction.URL
`"http: //Webserver/auction. asp " ;
`
`
`1. The W3C is currently developing a common document object model for
`XML and HTML. There is a working draft on the CD—ROM. The IE 4.0
`Document Object Model attempts to maintain compliance with the W3C draft
`as it evolves.
`
`@1998 THE XML HANDBOOK1W
`
`
`
`
`
`90
`
`CHAPTER 6 | BUILDING AN ONLINE AUCTION WEB SITE
`
`In Example 644, the script next retrieves the root element. It then navi—
`gates the tree until it locates the TITLE element within the first ITEM ele—
`ment of auction.xrnL The innerText property is used to insert the data
`content of TITLE into the user interface as the value of the “item__title"
`attribute, which appears on a DIV element.
`
`Example 6-14. Extracting data from the auction document object.
`var root = auction.root;
`var itemO = root.children.item("ITEM",0)
`var title = item0.chi1dren.item("TITLE”).text;
`document.all("item_title").innerText = title;
`<DIV ID="item_title"></DIV>
`_________________—————————-
`
`One of the benefits of using procedural scripts to display XML docu—
`ments is that you can manipulate the data content of an XML element
`before you display it. For example, if you wanted to display the dimensions
`of each painting using the metric system, rather than feet and inches, your
`script could simply convert the content of the DIMENSIONS element
`from inches to centimeters.
`
`6.2.! Using descriptive data binding
`
`The [E 4.0 XZWL Data Source Object (XML D50) is a declarative alterna—
`tive to the procedural scripts described in the last section. The XML D80
`is an applet (see Example 6-15) that enables the data of XML elements to
`be bound as the content of HTML elements.
`
`Example 6-15. The IE 4.0 XML Data Source Object applet.
`<APPLET ID=auction CODE=com.ms.xml.dso.XMLDSO.c1ass MAYSCRIPT
`WIDTH=0 HEIGHT=0>
`<PARAM NAME=“url" VALUE=“auCtion.asp">
`</APPLET>
`__________________———————-
`
`In Example 6-15, the “url” parameter points the XML DSO to auc-
`tion.asp, which causes auctionxml to be generated on the middle tier. A
`persistent XML source could also have been used.
`@1998 THE XML HANDBOOKTM
`
`
`
`
`
`te the part of the user
`In Example 6-16, data binding is used to popula
`interface that shows the painting and the caption beneath it.
`
`Example 6-16. Data binding with the XML DSO.
`<TD>
`
`<DIV STYLE="margin—1eft:16px;
`margin—top:l6px;margin—right:l6px">
`<DIV ID=pict></DIV>
`<DIV CLASS="details">
`<SPAN DATASRC=#auCtion DATAFLD=
`<SPAN DATASRC=#auCtion DATAFLD=YE
`<SPAN DATASRC=#auction DATAFLD=DIMENSION
`
`MATERIALS></SPAN>,
`AR></SPAN>,
`S></SPAN>
`
`With the XML DSO applet embedded in the Web page, no scripting is
`required to bind the data content of XML elements to HTML elements.
`Instead, the name of the document object (ID of the APPLET in Example
`6-15) is specified as the value of the DATASRC attribute, and the generic
`identifier of the XML element is specified for the DATAFLD attribute.
`One advantage of displaying XML with the XML DSO is that the XML
`document is processed asynchronously to the rendering of the page. There—
`fore, if the inventory of paintings were very large, the initial elements of the
`XML document could be displayed even before the last elements were pro—
`cessed.
`
`6.3 | Updating the data source from the
`client
`
`We have seen how userlnterfaceh
`to the user by invoking auctionasp
`user to make his own bid by invo
`bid.asp.
`In the Auction Demo, the u
`name in the first row of the bi
`
`trn on the client obtained data to display
`on the middle tier. It can also enable the
`king another middle tier page, make—
`
`ser bids by overwriting the price and bidder
`d table. A bid therefore consists of the “title”
`
`©19981WHLXML HANDBOOKTM
`
`
`
`
`
`92
`
`CHAPTER 6 | BUILDING AN ONLINE AUCTION WEB SITE
`
`of the item currently displayed, the “price” of the new bid, and the name of
`the new “bidder”.
`These data items must be passed as parameters to makebid.asp, which
`executes a script to process them and update the database. The script
`returns to the client a "return message” XML document: a single element
`containing information about the status of the processing.
`The script in userlnterfacehtm (see Example 6-17) begins by assigning
`the title of the current item up for auction to the “title” variable, the value
`of the “price” text box to the “price” variable, and the value of the “bidder”
`text box to the “bidder” variable.
`It then creates the return message document object, which will state
`whether makebid.asp successfully updated the database. The three variables
`are passed as parameters to the ASP file when it is invoked.
`
`Example 6-17. Sending a new bid to makebid.asp.
`var title = current_item.children.item("TITLE").text;
`var price = price.value;
`var bidder = bidder.value;
`var returnMsg = new ActiveXObject("msxml“);
`returnMsg.URL = “http://auction/makebid.asp?title=" +
`title + "&price=” + price + "&bidder=" + bidder;
`———————_—_—________
`
`In Example 6—18, makebid.asp (called by userInterfacehtm in Example
`6—17) assigns the values of the parameters “title”, “price”, and “bidder” to
`variables with the same names.
`The “BidRS” record set object is then created and a connection to the
`“Auction” database is made. Note that the connection is made for both
`reading and writing. The “Bids” table is then opened and the new informa—
`tion is added to the record set, after which the connection is closed. The
`process is much the same as it was for auction.asp, except that the database
`is written to instead of just being read.
`Finally, makebid.asp generates the return message document with the
`status of the update.
`
`©19981Wm XML HANDBOOKTM
`
`
`
`
`
`6.4 [ CONCLUSION
`
`93
`
`Example 6-18. The makebid.asp file updates the database.
`________________.________________________________________________________.
`<%@ LANGUAGE = VBSCript %>
`<%
`
`title = Request.QueryString(”title")
`price 2 Request.QueryString("price")
`bidder = Request.QueryString("bidder”)
`
`Set BidRS = Server.CreateObject("ADODB.RecordSet")
`connect = "data source=Auction;user id=sa;password=;"
`BidRS.CursorType = 2
`‘ read/write
`BidRS.LockType = 3
`BidRS.Open "Bids“, connect
`
`BidRS.AddNew
`BidRS(”item")
`BidRS("price”)
`BidRS(”bidder")
`BidRS.Update
`BidRS.Close
`
`= title
`= price
`= bidder
`
`%>
`<STATUS>OK</STATUS>
`
`
`6.4 | Conclusion
`
`The entire Auction Demo was built using the methods described above. You
`can get a head start on building a similar Web application by modifying
`these scripts to suit your particular requirements.
`XML enables Web applications by providing dynamic, accessible content
`that can be navigated and manipulated on the client. In addition, it enables
`the updating of content without having to refresh the entire user interface.
`This ability saves time by reducing round trips to the server for information
`that already exists on the client.
`With XML, users can manage data over the Internet just as they pres-
`ently do on their local machines. As a result, the Web is made a more inter—
`active and interoperable medium. As the information superhighway is
`transformed into the data superhighway, Web applications similar to the
`
`©19981¥w XML HANDBOOKW
`
`
`
`94
`
`CHAPTER 6 | BUILDING AN ONLINE AUCTION WEB SITE
`
`Auction Demo will allow for better utilization of the vast resources made
`
`available by the Web.
`
`The Auction Demo clearly illustrates the
`- Analysis
`'. architecture of a three-tier application. It uses the middle tier as a
`transient data aggregator and normalizer. In other chapters you'll
`, see different approaches to the middle tier, including persistent
`l storage of metadata and the use of object paradigms rather than
`' data paradigms.
`
`@1993 THE XML HANDBOOKTM
`
`
`
`
`
`
`
`
`
`
`XML and EDI:
`
`The new Web
`
`commerce
`
`I Traditional EDI: Built on outdated principles
`
`I Ubiquitous EDI: A quantum leap forward
`
`I The New EDI: Leveraging XML and the Internet
`
`@1998 THE XMLH OOOOOOO 1“
`
`
`
`
`
`(flap!!!
`
`
`
`XML and the Internet will dramatically reshape
`the. Electronic Data-Imercbange-{EDIJ landscape. By
`driving down eosmand complexity, EDI will become
`a truly ubiquitous technology that will reshape
`business as we kn_ow-it_._ This introduction to BB! is
`sponsored by POIET Software Corporation.
`'
`-.- -
`'--
`-
`-
`-
`-
`'
`-.
`., developers of'objeét-m'ientetl
`airtime for XMl-based infoniiation systems. It was
`
`prepared by Mike Hogan.
`
`-
`
`0 ver the past several decades, corporations have invested tril—
`
`lions of dollars in automating their internal processes. While
`this investment has yielded significant improvements in effi—
`ciency, that efficiency has not been extended to external processes.
`In effect, companies have created islands of automation that are isolated
`from their vendors and customers — their trading partners. The interaction
`among companies and their trading partners remains slow and inefficient
`because it is still based on manual processes.
`
`1.l
`
`| What is EDI?
`
`Electronic Data Interchange (EDI) has been heralded as the solution to this
`problem. ED] is defined as the exchange of data between heterogeneous sys—
`tems to support transactions.
`EDI is not simply the exportation of data from one syStem to another,
`but actual interaction between sysrems. For example, Company B is a sup-
`plier to Company A. InSteacl of sending purchase orders, bills and checks in
`
`@1998 THE XML HANDBOOKTM
`
`97
`
`
`
`
`
`98
`
`CHAPTER 7 | XML AND EDI: THE NEW WEB COMMERCE
`
`hard copy form, the two might connect their systems to exchange this same
`data electronically.
`
`In the process they could benefit in many other ways, including faster
`turnaround on orders, better inventory control, reduced financial float,
`complete real—time information about orders and inventory for improved
`decision-making, reduced costs for manual data input, and more. Compa—
`nies that have implemented EDI rave about the various benefits.
`In fact, these benefits can be expanded to a chain of suppliers. For exam—
`ple, Company C might be a supplier to Company B above. If companies B
`and C implement EDI, then Company A gains the additional benefits of
`superior integration with their entire supply chain of suppliers.
`
`1.l.l Extrcmets can’t hack it
`
`There is a significant gap between the business benefits described above and
`the actual implementation of EDI. This is because the actual implementa—
`tion of “traditional EDI” is fundamentally flawed. It is difficult and costly
`to implement and, even worse, it requires a unique solution for each pair of
`trading partners. This situation is analogous to requiring a unique tele-
`phone line to be wired to each person to whom you wish to speak.
`Many people falsely proclaimed the Internet as the solution to this prob—
`lem. By implementing EDI over a single network, our problems would be
`solved. This “solution” was so exciting it was even given its own name, the
`extranet. Unfortunately, a network with a common protocol is still only a
`partial solution.
`
`This is because the systems implemented in each company are based on
`different platforms, applications, data formats (notations), protocols, sche—
`mas, business rules, and more. Simply “connecting” these systems over the
`Internet does not, by itself, solve the problem. To use the phone system
`analogy again,
`this is analogous to wiring each business into the global
`phone network, only to realize that each company’s phone system is unique,
`and incompatible with every other phone system.
`And given the trillions ofdollars companies have invested in automation,
`they are not simply going to replace these systems with new “compatible”
`solutions, assuming such things existed.
`
`@1998 THE XML HANDBOOKTM
`
`
`
`
`
`7.1 | WHAT IS EDI?
`
`99
`
`1.1.: XML can!
`
`The eXtensible Markup Language (XML) provides a solution for EDI over
`the Internet. XML is a universal notation {data format) that allows comput-
`ers to srore and transfer data that can be understood by any other computer
`system. XML maintains the content and structure, but separates the busi-
`ness rules from the data. As a result, each trading partner can apply its own
`business rules. This flexibility is critical to creating a complete solution for
`EDI.
`
`There are additional technologies which are also part of the complete
`solution. Security, for example,
`is critical to EDI. Transactional integrity,
`connection stability, authentication and other services are also critical to
`implementing a complete solution. These requirements are addressed by
`technologies that are layered on top of the In ternet. We refer to them gener—
`ically as Internet-based services.
`The final piece of the EDI solution is data storage. XML introduces a
`unique set of requirements for hierarchical naming and structure. It also
`requires rich relationships and complex linking. XML’s use in EDI adds fur-
`ther requirements for metadata and versioning. These requirements levy
`heavy demands on database technology.
`
`1.I.3 The new EDI
`
`the Internet, Internet—based services and database
`By combining XML,
`connecrivity, we have a complete solution for New ED]. Together,
`these
`technologies will not only change EDI, they will change our entire business
`landscape. EDI will metamorphose from a handful of unique interconnec-
`tions, defined by the supply chain, into a “supply web”. The supply web is
`an intelligent common fabric of commerce over the Internet.
`According to Metealfe’s Lawl, the value of a network is roughly pr0por-
`tional to the number of users squared. Imagine what this means when your
`EDI “network” expands from a one-to-one proposition, to a true network
`that encompasses practically every company in the world. Suddenly,
`the
`trillions of dollars companies have invested in internal automation increase
`in value by several factors. By the same token, this information can also be
`
`1. Robert Metcalfe is the creator of Ethernet.
`
`@1998 THE XML HANDBOOKTM
`
`
`
`
`
`
`
`100
`
`CHAPTER 7 | XML AND EDI: THE NEW WEB COMMERCE
`
`extended to customers, adding significant value to the vendor—customer
`relationship, thereby enhancing customer loyalty.
`This is a pivotal time in the history of technology. With the emergence of
`XML, all of the pieces are available to create a universal mechanism for
`EDI. The Internet provides the transport. XML provides the flexible, exten—
`sible, structured message format. Various Internet—based services provide
`solutions for security,
`transactional integrity, authentication, connection
`stability, network fail—over and more.
`Add to this sophisticated data storage and you have all of the pieces nec-
`essary to unite corporate islands of automation into a single coherent fabric
`of electronic commerce. This will result in dramatic improvements in effi—
`ciency, cost-savings, superior access to real—time data for analysis and deci-
`sion—making, superior inventory management, and more.
`Let’s examine these propositions in detail, and the technology that makes
`them possible. The new EDI is already emerging as the driving force behind
`the use of XML on the Web.
`
`LIA Ubiquitous EDI: A quantum leap
`forward
`
`Ubiquitous EDI will have a profound impact on business—to—business and
`business—to—consumer
`relationships. The many problems with current
`implementations of EDI have relegated it to large enterprises and selected
`industries. However, the combination of the Internet, Internet—based tech—
`nologies, and XML will open up EDI not only to small-to-medium enter-
`prises (SMEs), but also to individuals (Example 7—1).
`Through deployment of these technologies, EDI will experience growth
`and market penetration that will rival the e—mail market. Electronic com-
`merce will finally blossom on the Web and become an everyday part of our
`lives. In short, EDI will usher in a new era in computing. The Internet will
`metamorphose from a transport for Web pages into a ubiquitous and seam-
`less foundation for every imaginable transaction. In the future, EDI will
`touch every aspect of computing.
`Various forms of “data interchange” have been implemented with various
`degrees of success. Examples include OLE and DDE for sharing data
`among heterogeneous applications on the same computer. CORBA, Java
`RMI, COM and COM+ are generalized technologies for data interchange
`
`@1998 THE XML HANDBOOKTM
`
`I
`
`
`
`
`
`7.1 | WHAT IS EDI?
`
`101
`
`Example 7-1. The value