The Mythical XML
Mr. Thomas Lee
Center for E-Commerce Infrastructure Development
(CECID), The University of Hong Kong
HK Computer Society XML Specialist Group
Speaker’s Session
26 August 2003, HK Polytechnic University
Agenda
XML Basis
Web Services
XML Development in HK
Demo
26 August 2003
HKCS XMLSG Speaker's Meeting - Mythical XML
2
XML Basis
True or False?
XML = Extensible Markup Language
XML is an extension of HTML
– XML is going to replace HTML for Web
browsing
Tags are not predefined in XML
– You must define your own tags
XML specifies data semantics
26 August 2003
HKCS XMLSG Speaker's Meeting - Mythical XML
4
Background of XML
eXtensible Markup Language
XML 1.0 became a W3C Recommendation in
1998
F.O.X (Father of XML) - Jon Bosak
– a SUN architect, who led a group to create XML
Over 20 XML-related specs at W3C in 2003
Over 200 XML application standards for
different industries registered at XML.org
– Finance, healthcare, e-government, mathematic,
telecom…
26 August 2003
HKCS XMLSG Speaker's Meeting - Mythical XML
5
What is XML?
A markup language for documents containing structured
information
– i.e. a data format for structurally delimiting text data with tags
For computer-to-computer communication
HTML
Encode content and
presentation
Tags are already defined for
rendering the content on
browsers (one application only)
Semantics has already been
defined in HTML spec
XML
Encode structure + content
(no presentation)
Tags are to be defined by
different applications for
processing the content
Semantics is not defined in
XML spec
XML is not going to replace HTML
26 August 2003
HKCS XMLSG Speaker's Meeting - Mythical XML
6
Weather
Forecast
in
Browser
26 August 2003
HKCS XMLSG Speaker's Meeting - Mythical XML
7
Weather Forecast
in HTML
26 August 2003
HKCS XMLSG Speaker's Meeting - Mythical XML
8
Weather Forecast in XML
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
Start Tag
<?xml version="1.0"?>
Element
<WeatherForecast>
<City name="Hong Kong">
<Weather date="2003-08-26">Light Rain</Weather>
<Weather date="2003-08-27">Showers</Weather>
</City>
<City name="Beijing">
Attribute
<Weather date="2003-08-26">Cloudy</Weather>
<Weather date="2003-08-27">Thunder Shower</Weather>
</City>
Data Value
</WeatherForecast>
End Tag
26 August 2003
HKCS XMLSG Speaker's Meeting - Mythical XML
9
XML Document Structure
WeatherForecast
City:
name=“Hong Kong”
City:
name=“Beijing”
Weather:
date=“2003-08-26”
Weather:
date=“2003-08-27”
Weather:
date=“2003-08-26”
Weather:
date=“2003-08-27”
Light Rain
Showers
Cloudy
Thunder Showers
26 August 2003
HKCS XMLSG Speaker's Meeting - Mythical XML
10
XSLT
XML Stylesheet Language Transformation
A scripting language to transform a XML document
to different document forms
– another XML form, HTML, text, etc.
Can present XML data in different rendering
languages, e.g. HTML, WML
– separation of content and presentation
Can translate to a different XML form (conforming
to a different XML schema)
– interoperability between different applications, e.g.
vendor products
26 August 2003
HKCS XMLSG Speaker's Meeting - Mythical XML
11
XSLT Example
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<html>
<head>
<title>Weather Forecast</title>
</head>
<body>
<h1>Weather Forecast</h1>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
26 August 2003
HKCS XMLSG Speaker's Meeting - Mythical XML
12
XSLT Example (2)
<xsl:template match="City">
<h2>
<xsl:apply-templates select="@name"/>
</h2>
<table border="1">
<tbody>
<tr>
<th>Date</th>
<th>Weather</th>
</tr>
<xsl:apply-templates/>
</tbody>
</table>
</xsl:template>
26 August 2003
HKCS XMLSG Speaker's Meeting - Mythical XML
13
XSLT Example (3)
<xsl:template match="Weather">
<tr>
<td>
<xsl:apply-templates select="@date"/>
</td>
<td>
<xsl:apply-templates select="text()"/>
</td>
</tr>
</xsl:template>
</xsl:stylesheet>
26 August 2003
HKCS XMLSG Speaker's Meeting - Mythical XML
14
Schema Language
A schema language is used to validate the XML data whether
it is in valid form for a specific application
– the tag set
– the structure in which the tags can be placed
– the format of the values marked-up by tags and attributes values
Data Type Definition (DTD) and W3C XML Schema
To define an XML application standard
– e.g. XBRL (XML Business Reporting Language)
Not sufficient define semantics
– semantics is defined in a supplementary vocabulary or
specification
Not designed to program application logic
– e.g. cannot convert temperature between degrees Celsius and
Fahrenheit
26 August 2003
HKCS XMLSG Speaker's Meeting - Mythical XML
15
XML Schema Example
<?xml version="1.0" encoding="UTFencoding="UTF-8"?>
<xs:schema
http://www.w3.org/2001/XMLSchema
XMLSchema">
">
xs:schema xmlns:
xmlns:xs="
xs="http://www.w3.org/2001/
<xs:element
WeatherForecast">
">
xs:element name="
name="WeatherForecast
<xs:
xs:complexType>
complexType>
<xs:sequence
>
xs:sequence>
<xs:element
City"" minOccurs="
0" maxOccurs="
unbounded">
">
xs:element name="
name="City
minOccurs="0
maxOccurs="unbounded
<xs:
xs:complexType>
complexType>
<xs:sequence
>
xs:sequence>
<xs:element
Weather"" minOccurs="
0" maxOccurs="
unbounded">
">
xs:element name="
name="Weather
minOccurs="0
maxOccurs="unbounded
<xs:
xs:complexType>
complexType>
<xs:
xs:simpleContent>
simpleContent>
<xs:extension
xs:string
:string">
">
xs:extension base="
base="xs
<xs:attribute
date"" type="
xs:date
:date"" use="
required"/>
"/>
xs:attribute name="
name="date
type="xs
use="required
</xs
:extension>
>
</xs:extension
</xs
xs:
:
simpleContent>
</ simpleContent>
</xs
</xs::complexType>
complexType>
</xs
:element>
>
</xs:element
</xs
:sequence>
>
</xs:sequence
<xs:attribute
name"" type="
xs:string
:string"" use="
required"/>
"/>
xs:attribute name="
name="name
type="xs
use="required
</xs
</xs::complexType>
complexType>
</xs
:element>
>
</xs:element
</xs
:sequence>
>
</xs:sequence
</xs
</xs::complexType>
complexType>
</xs
:element>
>
</xs:element
</xs
:schema>
>
</xs:schema
26 August 2003
HKCS XMLSG Speaker's Meeting - Mythical XML
16
True or False (Answers)
9
8
XML = Extensible Markup Language
XML is an extension of HTML
– XML is going to replace HTML for Web
browsing
9Tags are not predefined in XML
XML specifies data semantics
8
– You must define your own tags
26 August 2003
HKCS XMLSG Speaker's Meeting - Mythical XML
17
Web Services
Weather Info Everywhere
26 August 2003
HKCS XMLSG Speaker's Meeting - Mythical XML
19
How to Automatically Obtain
Weather Info from HKO?
Now:
– poll HKO web pages
– “try” to decode the text contained within
(based on the current web page layout)
– 300+ have registered web sites, mass media,
telecom operators using this method
– problem: a slight change to layout or data
format would cause problems to these users
Better solution:
– Use Web Services
26 August 2003
HKCS XMLSG Speaker's Meeting - Mythical XML
20
What is Web Service?
Remote procedure call (distributed
computing) on the Internet using XML
Exposes functionality through a standard
protocol
Describes the interfaces in enough detail
to for building client applications to talk to
them
Registers the services so that potential
users can find them easily
26 August 2003
HKCS XMLSG Speaker's Meeting - Mythical XML
21
SOAP
Simple Object Access Protocol
Uses XML to package input and output data on
making a remote procedure call (RPC) on the
Internet
Uses Internet protocols for data transport, e.g.
HTTP, SMTP
– Firewall friendly
Platform independent
– .Net and Java programs can talk with each other in SOAP
http://www.w3c.org
26 August 2003
HKCS XMLSG Speaker's Meeting - Mythical XML
22
SOAP Request
POST /weatherwarning/services/WeatherWarning HTTP/1.0
Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: Axis/1.1RC2
Host: 127.0.0.1
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: ""
Content-Length: ###
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:getWarning
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="http://model.weatherwarning.webservice.hko.cecid.hku.hk"/>
<ns1:type>typhoon</ns1:type>
</ns1:getWarning>
</soapenv:Body>
</soapenv:Envelope>
26 August 2003
HKCS XMLSG Speaker's Meeting - Mythical XML
23
SOAP Response
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Date: Tue, 26 Aug 2003 02:25:37 GMT
Server: Apache Coyote/1.0
Connection: close
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:getWarningResponse
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="http://model.weatherwarning.webservice.hko.cecid.hku.hk">
<return xsi:type="xsd:string">強烈季候風信號</return>
</ns1:getWarningResponse>
</soapenv:Body>
</soapenv:Envelope>
26 August 2003
HKCS XMLSG Speaker's Meeting - Mythical XML
24
WSDL
Web Services Description Language
Specifies the data types and structures (in XML
Schema) of input and output data for a SOAP call
Specifies other transport parameters, e.g. protocol,
URL end-point, etc.
Tells the clients how to make a SOAP call to use a
specific Web Service
– similar to Interface definition language (IDL) for RPC
http://www.w3c.org
26 August 2003
HKCS XMLSG Speaker's Meeting - Mythical XML
25
UDDI
Universal Description, Discovery and Integration
A registry to register, publish, find Web Services
– white pages, or basic identification: name, address, and
key points of contact
– yellow pages, or classification by a standard index of
business and industries
– green pages, or technical capabilities and services related
to the conduct of electronic business
Similar to a portal for system clients
http://www.uddi.org
26 August 2003
HKCS XMLSG Speaker's Meeting - Mythical XML
26
ebXML
E-business XML
Co-developed by UN/CEFACT and OASIS
XML-based document exchange architecture to
perform Electronic Data Interchange (EDI) on the
Internet
Provides reliable and secure document exchange
on the Internet
Supports business process specification for
system execution
Widely adopted in Asia and Europe
– HK is an ebXML forerunner
26 August 2003
HKCS XMLSG Speaker's Meeting - Mythical XML
27
XML Development in HK
eProcurement Case
MTRC purchases office supplies from Saggio on
SaggioDirect.com
Past: plentiful of delivery notes, invoices, monthly
statements were sent in paper and reconciled
manually
Present: XML documents are transferred on the
Internet using ebXML
– automatic reconciliation
– save costs and trees
– procurement data ready for analysis and planning
26 August 2003
HKCS XMLSG Speaker's Meeting - Mythical XML
29
eProcurement with ebXML
Saggio Logistics
Delivery goods
MTRC
Users
SaggioDirect System
Workstations
Web
Server
MTRC Intranet System
Internet
Intranet
Server
XML document
Hermes
Extract data
from XML
Hermes document
26 August 2003
XML document
HKCS XMLSG Speaker's Meeting - Mythical XML
30
eLogistics Case
Shipping companies electronically submit
dangerous goods manifests to Marine
Department using ebXML
Participating pilot shipping companies:
OOCL and APL
Pilot production in July 2003
Saved data reentry required by Web
Will cover other port formality documents, e.g. prearrival notification, general declaration…
Issue: need to design XML Schemas for various
port formality documents
26 August 2003
HKCS XMLSG Speaker's Meeting - Mythical XML
31
Dangerous Goods Declaration with ebXML
Shipping
Agents
Paper submission
1
W
eb
su
bm
iss
2
io
Internet
Hermes
MSH
26 August 2003
3
Marine
Dept
n
XML submission
ebXML Message Service
HKCS XMLSG Speaker's Meeting - Mythical XML
over HTTP on VPN
Hermes
MSH
32
XML Schema Design and
Management Guide
For HKSARG to implement e-government joined-up services
– enhance data interoperability
Systematic modelling methodology for designing reusable
XML Schemas
– facilitates design of consistent, quality and reusable schemas
– consolidated international best practices, e.g. CCTS, UBL
Flexible management framework for standardizing Common
Schemas, e.g. HKID Number, Person Name, Postal Address
– minimizes repetitive data alignment efforts by standardizing
schemas for commonly used data elements
Under public consultation
– http://www.itsd.gov.hk/itsd/english/infra/eif.htm
Pilot project: HK Observatory plans to broadcast weather
information in XML through Web Services/HTTP
26 August 2003
HKCS XMLSG Speaker's Meeting - Mythical XML
33
Weather Information in XML/WS
26 August 2003
HKCS XMLSG Speaker's Meeting - Mythical XML
34
Digital Trade and
Transportation Network
A neutral, high-tech, and value-added e-logistics
platform
–
–
–
–
–
facilitate information flow & service integration
pearl River Delta (PRD), regionally & globally
based on open-standards, e.g. XML / ebXML
SME is an important focus
releases 1 and 2 completed in 12-15 months
Return on investment
– estimated investment: HK$3B over 17 years
– estimated benefit: HK$11B over 17 years
http://www.logisticshk.gov.hk
26 August 2003
HKCS XMLSG Speaker's Meeting - Mythical XML
35
Proposed DTTN Architecture
26 August 2003
HKCS XMLSG Speaker's Meeting - Mythical XML
36
Open-Source Software
(OSS) Development
Conditions to advance global e-commerce development
– high interoperability and reliability, low cost
– therefore, open standards and open-source software
HK is the world champion in ebXML OSS
FreebXML.org to promote the development and adoption of
open-source technologies for e-commerce
– international collaboration: HKU (HK), Cyclone (US), ECOM
(Japan), Kasetart U. (Thailand), KIEC (Korea), SigmaLogica (US),
Sterling Commerce (US), Sun (US), Sybase (US)
Our vision: FreebXML – the “Linux” and “Apache” in the ecommerce development
26 August 2003
HKCS XMLSG Speaker's Meeting - Mythical XML
37
26 August 2003
HKCS XMLSG Speaker's Meeting - Mythical XML
38
Global Penetration of
Made-in-HK OSS
Many serious users in Asia and Europe!
26 August 2003
HKCS XMLSG Speaker's Meeting - Mythical XML
39
About CECID
Center For E-Commerce Infrastructure Development
Technology focus: XML and Web Services
HKU R&D Center (15+ full-time staff)
Primarily funded by Innovation and Technology Fund
– establishment of ebXML infrastructure in HK
– business process and information interoperability platform
To enhance HK’s competitiveness in e-commerce development
– technology creation and transfer for the community
– provision of R&D and training services to businesses and the
government (R&D outsourcing)
– participation of international standardization initiatives
26 August 2003
HKCS XMLSG Speaker's Meeting - Mythical XML
40
Our R&D Strategy
R&D
R&D
Products
Pilot
Projects
HK Lead
Projects / SIs
International
Collaborations
26 August 2003
HKCS XMLSG Speaker's Meeting - Mythical XML
Production
Deployments
End
Users
41
When Should I Use XML?
When you need a buzzword in your
resume :-)
26 August 2003
HKCS XMLSG Speaker's Meeting - Mythical XML
42
Thank You
Q&A
Email: ytlee@cecid.hku.hk
URL: www.cecid.hku.hk