2. OBJECTIVES
• Learn XML fundamentals.
• Be exposed to build applications based on XML.
• Understand the key principles behind SOA.
• Be familiar with the web services technology elements for
realizing SOA.
• Learn the various web service standards.
3. Text Books
1. Ron Schmelzer et al. “XML and Web Services”,
Pearson Education, 2002.
2. Thomas Erl, “Service Oriented Architecture: Concepts,
Technology, and Design”, Pearson Education, 2005.
4. Reference Books
1. Frank P.Coyle, “XML, Web Services and the Data Revolution”,
Pearson Education, 2002
2. Eric Newcomer, Greg Lomow, “Understanding SOA with Web
Services”, Pearson Education, 2005
3. Sandeep Chatterjee and James Webber, “Developing Enterprise Web
Services: An Architect's Guide”, Prentice Hall, 2004.
4. James McGovern, Sameer Tyagi, Michael E.Stevens, Sunil Mathew,
“Java Web Services Architecture”, Morgan Kaufmann Publishers,
2003.
5. SYLLABUS
• UNIT I INTRODUCTION TO XML 9
• UNIT II BUILDING XML-BASED APPLICCATIONS 9
• UNIT III SERVICE ORIENTED ARCHITECTURE 9
• UNIT IV WEB SERVICES 9
• UNIT V BUILDING SOA-BASED APPLICATIONS 9
6. UNIT I INTRODUCTION TO XML
XML document structure – Well formed and valid
documents – Namespaces – DTD – XML Schema
– X-Files.
7. Markup Language
Set of words and symbols that highlight text
to define it for a web document.
8. Introduction
• Markup language
– A set of words and symbols that highlight text to define it for a web
document.
• For example,
– When creating an Internet page, you want to be able the separate
paragraphs and put letters in a bold-face type.
– This is accomplished through a markup language.
9. SGML
• In this family of markup languages,
– Standard Generalized Markup Language (SGML) is the parent.
• SGML
– Provides the basic structure of the markup language, and
– Sets the standard for their form.
• As a parent, it passes on genetic behavior to a child,
– SGML passes structure and format rules to other markup languages.
10. HTML
• HyperText Markup Language (HTML) is a child of SGML.
– It usually designs the page for an Internet browser.
• Using HTML, we can
– Embed images, create page sections, establish fonts & direct the flow of page.
• In HTML, we can add other functions to a website via scripting languages,
– Such as JavaScript.
• HTML is the predominant language used for website design.
11. XML
• Extensible Markup Language (XML) - Cousin to HTML & a nephew to SGML.
• XML is a subset of SGML,
– This give it rights that an application, such as HTML, doe not have.
• XML can define applications of its own.
– Resource Description Format (RDF) is an application of XML.
– HTML is limited to design and does not have subsets or applications.
• XML inherited genetic qualities from SGML,
– But is created to make its own family.
• Subsets of XML include XSL and XSLT.
12. XML
• Advantages of XML are:
– It is much simpler compare to SGML
– XML documents can be Valid or Well Formed without a DTD
(deducing the semantics from the structure of the document)
– Linking is much simpler in XML than in SGML, but also much more intelligent than HTML
– No longer restricted a limited set of tags, you can create your own set of tags.
– XML is very powerful, yet easy to implement, not limited on data structures
– It is in text format, Human readable and easy to edit
• Disadvantages of XML are:
– DTD's can't located on the Internet
– There is no guarantee that all browser currently support XML, although now some
browser now currently capable of interpreting XML, example are IE 5 and Netscape.
14. What is XML?
• XML is the metamarkup language.
– That means it specify the rules for creating markup languages
• XML was designed to describe data, not to display data
• XML tags are not predefined.
– You must define your own tags
• XML is designed to be self-descriptive
– Self-describing language simplifies document creation, maintenance, and
debugging
• XML is a W3C Recommendation
15. Difference Between XML and HTML
• XML is not a replacement for HTML.
• XML and HTML were designed with different goals:
– XML was designed to describe data, with focus on what data is
– HTML was designed to display data, with focus on how data looks
• HTML is about displaying information,
– While XML is about carrying information.
16. Use of XML
• XML can be used to encode any structured information
• XML is good at representing
– Information that has an extensible, hierarchical format and requires
encoding of metadata.
17. XML Does Not DO Anything
• <note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
• XML document does not DO anything
• It is just information wrapped in tags.
– One must write a piece of s/w to send, receive or display it.
It has
Sender and receiver information,
A heading and a message body.
18. How Can XML be Used?
• XML Separates Data from HTML
• XML Simplifies Data Sharing
• XML Simplifies Platform Changes
• Internet Languages Written in XML
19. XML Delimiter Characters
• XML language has 4 special delimiters
Character Meaning
< Start of an XML markup tag
> End of an XML markup tag
& Start of an XML entity
; End of an XML entity
20. XML Syntax Rules
• All XML Elements Must Have a Closing Tag
• XML Tags are Case Sensitive
Example:
<message>This is incorrect</Message>
<message>This is correct</message>
• XML Elements Must be Properly Nested
• XML Documents Must Have a Root Element
• XML Attribute Values Must be Quoted
21. Empty XML Elements
• An element with no content is said to be empty.
• <element></element>
OR
• <element />
22. XML Attributes
• XML elements can have attributes, just like HTML.
• Attributes provide additional information about an element.
• Attributes often provide information that is not a part of the
data.
• XML Attribute value must be Quoted (single or double quotes)
<person gender="female">
23. XML Tree
• XML documents form a tree structure
– That starts at "the root" and branches to "the leaves".
<?xml version="1.0" encoding="UTF-8"?>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!
</body>
</note>
• First line is the XML declaration.
It defines the XML version
• Next line describes the
root element of the document.
<note>
• Next 4 lines describe
4 child elements of root
(to, from, heading, body)
• Last line defines the
end of the root element: </note>
25. XML Elements vs. Attributes
<person gender="female">
<firstname>Anna</firstname>
<lastname>Smith</lastname>
</person>
<person>
<gender>female</gender>
<firstname>Anna</firstname>
<lastname>Smith</lastname>
</person>
• There are no rules about
when to use attributes or
when to use elements.
• In XML best advice is to avoid
them. Use elements instead.
26. XML Elements are Extensible
• XML elements can be extended to carry more information.
<note>
<to>Tove</to>
<from>Jani</from>
<body>Don't forget me this weekend!</body>
</note>
MESSAGE
To: Tove
From: Jani
Don't forget me this weekend!
27. XML Elements are Extensible
• Previous XML document added some extra information to it:
<note>
<date>2008-01-10</date>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
Should the application break or crash?
No.
Application should be able to find <to>, <from>, and <body> elements
in the XML document and produce the same output.
One of the beauties
of XML, is that it can
be extended without
breaking
applications.
28. Best way of using XML
<note date="2008-01-10">
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
A date attribute is used in the first example:
<note>
<date>2008-01-10</date>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
A date element is used in the second example:
29. • An expanded date element is used in the third:
<note>
<date>
<year>2008</year>
<month>01</month>
<day>10</day>
</date>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
30. Problems With Using Attributes
1. Attributes cannot contain multiple values (elements can)
2. Attributes cannot contain tree structures (elements can)
3. Attributes are not easily expandable (for future changes)