This item on "Web Services Demonstration" is part of the segment on "Metadata and Electronic Document Management for Electronic Commerce" first presented for the Australian National University course "Information Technology in Electronic Commerce" (COMP3410/COMP6341).
This document is intended to provide both for live group presentation and accompanying lecture notes for individual use. The Slides and these notes are provided in the one HTML document, using HTML Slidy.
This is a demonstration of web services using Amazon.com's implementation.
Just as the web trades off functionality and efficiency for ease of use, so does web services. It is not yet clear if this is a tradeoff which applications developers are willing to make. Applications like the simple one show below are easy to produce, but how much harder will more complex applications be?
In this example a request is made via HTTP to the Amazon.com database, for books with the keywords "tom worthington".
The result is an XML document, containing data from the Amazon.com database. This is formatted in XML. A sample of the output is available.
This data can then be used as input to another transaction.
Amazon provide the choice of two subsets of data ("lite" and "heavy"), with the >metadata in two formats: DTD and XML Schema.
A SOAP interface is also supplied. This provides a set of operations, including "KeywordSearchRequest", but is not used for this demonstration.
The DTDs and XML Schemas represent the same metadata in different formats.
The XML Schema is easier to use in an automated system.
The XML produced from the Amazon.com database is intended as input to another system, rather than being displayed directly. To make it easier to display on a conventional (HTML) web page, Amazon provide a process for transforming the XML output into HTML, using a XSL style sheet supplied as part of the request. The only change to the query is to replace the "xml" of the format ("f=xml") with the specific address of the XSL transformation document.
This example XML to HTML transformation is based on one provided by Amazon and produces a web page.
The XSLT creates some static HTML, such as the document title.
For each book found, it extracts details, such as the product identifier (Asin), URL of an image of the product (ImageUrlMedium) and ProductName.
The data values are substituted into the HTML template to produce a web document.
When rendered by a web browser, the HTML will produce an image of the cover of the book, the book title, with a hypertext link to the item on the Amazon web site.
- Small Transactions: The web pages generated display images, but these images are not processed as part of the XML transaction. The URLs of the images are extracted from the database and included in the HTML. It is the end-user's browser which then requests the image file, based on the URLs. The result is that a relatively small XML transaction can produce a large and impressive looking web page.
- Caching: For efficiency the Amazon server currently caches the XSL file for six hours. If testing a changed XSL file, it is therefore necessary to save it with another name to see the effect of changes immediately.
- Format: The XML or HTML generated can be specified to conform whatever design is required.
- Efficiency: The XML format used by Web Services is relatively inefficient compared to binary formats used by traditional database systems. The XML data may be compressed while in transit on a network, but must be created at one end and interpreted at the other, consuming system resources.
- Security: This example provides no security to ensure the transaction is from an authorized user, is to the authorized web service and that data in transit has not been tampered with. There are a number of security models proposed for web services.