Metadata and Electronic Document Management for Electronic Commerce

Web Services Demonstration

Tom Worthington

Version of 2 August 2008

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.

Web Services Demonstration

Web services can be thought of as the transaction processing equivalent of the world wide web. The web provided a relatively easy and standardized way to create distributed hypertext. Web Services is a set of standards which aims to provide easy and standardized distributed transaction processing.

This is a demonstration of web services using'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?

Simple Web Services Query

Search for books with "tom" and "worthington" amp;t=universalservice&dev-t=D1XUYSABAOWG8G&

In this example a request is made via HTTP to the database, for books with the keywords "tom worthington".

What the request contains

Request Description
http: Address of the service:
dev-t= Identifier of business partner
KeywordSearch= Search for "tom" and "Worthington"
mode=books Search for books.
type=lite Use the lite transaction type
page=1 Display the first set of records (by default 10)
f=xml Return the results in XML format

Results in XML

<ProductName>Universal Service: Telecommunications Policy
and People With Disabilities</ProductName>
<Author>Michael J. Bourk</Author>
<Author>Tom Worthington</Author>
<ReleaseDate>January, 2001</ReleaseDate>
<Manufacturer>1stBooks Library</Manufacturer>

The result is an XML document, containing data from the database. This is formatted in XML. A sample of the output is available.

This data can then be used as input to another transaction.

Web Services Metadata

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.

Metadata as a DTD

<?xml version="1.0" encoding="UTF-8"?> ...
<!-- ...................................................................... -->
<!-- File: developer-lite.dtd -->
<!-- ...................................................................... -->
<!-- DTD for xml -->
<!ELEMENT ProductInfo (Details*, ShoppingCart?, ErrorMsg?)>
<!-- url is the url of the product page -->
<!ELEMENT Artists (Artist+)>...

The DTDs and XML Schemas represent the same metadata in different formats.

Metadata as XML Schema

<?xml version="1.0" encoding="UTF-8" ?> -
<xs:schema xmlns:xs="" elementFormDefault="qualified"> <xs:element name="Actor" type="xs:string" /> <xs:element name="Artist" type="xs:string" />
- <xs:element name="Artists">
- <xs:complexType> - <xs:sequence>
<xs:element ref="Artist" maxOccurs="unbounded" />

The XML Schema is easier to use in an automated system.

XML to HTML transformation

The XML produced from the 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.

Creation of HTML by XSLT

<title>Some Books From</title>.


<xsl:template match="Details">
<a href="{Asin}/universalservice">
<img src="{ImageUrlMedium}" width="107" height="140" align="left" alt=""/>
<xsl:value-of select="ProductName"/></a>


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.

Data values are substituted

<a href=""><img src="" width="107" height="140" align="left" alt="">Universal Service: Telecommunications Policy and People With Disabilities</a>,

The data values are substituted into the HTML template to produce a web document.

Values substituted

In this case:

Field Value
Asin 0759614245
ProductName Universal Service: Telecommunications Policy and People With Disabilities

Web browser renders HTML with images

Universal Service: Telecommunications Policy and People With Disabilities,

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.

Some points to note


Thanks to Steve Jenkin and Frank van Praag for getting the XSL to work.

© Tomw Communciations Pty Ltd 2006 - 2008

Creative Commons License
Metadata and Electronic Document Management for Electronic Commerce by Tom Worthington is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 2.5 Australia License.

Web page by