0% found this document useful (1 vote)
186 views

Service Oriented Architecture

Service Oriented Architecture

Uploaded by

jaba123jaba
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
186 views

Service Oriented Architecture

Service Oriented Architecture

Uploaded by

jaba123jaba
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 126

S.K.P.

Engineering College, Tiruvannamalai VII SEM

SKP Engineering College


Tiruvannamalai – 606611

A Course Material
On
Service Oriented Architecture

By

L.Sankaran
Assistant Professor
Computer Science and Engineering Department

Computer Science Engineering Department 1 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

Quality Certificate

This is to Certify that the Electronic Study Material

Subject Code: IT6801

Subject Name: Service Oriented Architecture

Year/Sem:IV/VII

Being prepared by me and it meets the knowledge requirement of the University


curriculum.

Signature of the Author

Name: L.Sankaran

Designation: Assistant Professor

This is to certify that the course material being prepared by Mr. L.Sankaran is of the
adequate quality. He has referred more than five books and one among them is from
abroad author.

Signature of HD Signature of the Principal

Name: K.Baskar Name: Dr.V.Subramania Bharathi

Seal: Seal:

Computer Science Engineering Department 2 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

IT6801 SERVICE ORIENTED ARCHITECTURE LTPC 3003

OBJECTIVES:
The student should be made to:
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.

UNIT I INTRODUCTION TO XML 9


XML document structure – Well-formed and valid documents – Namespaces – DTD –
XML Schema – X-Files.

UNIT II BUILDING XML- BASED APPLICATIONS 9


Parsing XML – using DOM, SAX – XML Transformation and XSL – XSL Formatting –
Modeling Databases in XML.

UNIT III SERVICE ORIENTED ARCHITECTURE 9


Characteristics of SOA, Comparing SOA with Client-Server and Distributed
architectures – Benefits of SOA -- Principles of Service orientation – Service layers.

UNIT IV WEB SERVICES 9


Service descriptions – WSDL – Messaging with SOAP – Service discovery – UDDI –
Message Exchange Patterns – Orchestration – Choreography –WS Transactions.

UNIT V BUILDING SOA-BASED APPLICATIONS 9


Service Oriented Analysis and Design – Service Modeling – Design standards and
guidelines --Composition – WS-BPEL – WS-Coordination – WS-Policy – WS-Security –
SOA support in J2EE
TOTAL : 45 PERIODS
OUTCOMES:
Upon successful completion of this course, students will be able to:
Build applications based on XML.
Develop web services using technology elements.
Build SOA-based applications for intra-enterprise and inter-enterprise applications.

Computer Science Engineering Department 3 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

TEXTBOOKS:
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.
REFERENCES:
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 Stevens, Sunil Mathew, ―Java Web
Services Architecture‖, Morgan Kaufmann Publishers, 2003

Computer Science Engineering Department 4 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

CONTENTS

S.No Particulars Page

1 Unit – I 7

2 Unit – II 38

3 Unit – III 62

4 Unit – IV 85

5 Unit – V 113

Computer Science Engineering Department 5 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

Prerequisite

Following are the minimum prerequisites to get into SOA technology.


Xml
Xsl, Xslt
Xpath
Xsd (Xml Schema Definition)
Wsdl
Soap
Students without the required background may struggle to keep up with the lectures and
assignments.

Computer Science Engineering Department 6 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

Unit – I

Introduction To Xml

Part – A

1. Define XML?.[ CO1 - L1]


XML stands for Extensible Markup Language much like HTML
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
XML is a W3C Recommendation

2. What are the major portions of an XML document structure?.[ CO1 - L1]
The XML declaration
The Document Type Declaration
The element data
The attribute data
The character data or XML content

3. What is meant by XML declaration?.[ CO1 - L1]


The first part of an XML document is the declaration. A declaration is exactly as it
sounds: It is a definite way of stating exactly what the document contains.
Example: The Declaration of Independence states that the United States planned to
separate itself from Great Britain, the XML declaration states that the following
document contains XML content.

4. Types of markup in an XML document.[ CO1 - L1]


Elements,
Entity References,
Comments,
Processing Instructions,
Marked Sections

5. Define Elements.[ CO1 - L1]


An XML document, elements are the most common form of markup. XML elements are
either a matched pair of XML tags or single XML tags that are ―self-closing.
Matching XML tags consist of markup tags that contain the same content, except that
the ending tag is prefixed with a forward slash.

Computer Science Engineering Department 7 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

Example1: our shirt element begins with <shirt> and ends with </shirt>.

6.Define Entity References.[ CO1 - L1]


There are times to introduce special characters or make use of content that is
constantly repeated without having to enter it multiple times. This is the role of the XML
entity.Entities provide a means to indicate to XML-processing applications that a special
text string is to follow that will be replaced with a different literal value.Entity references
are delimited by an ampersand at the beginning and a semicolon at the ending. The
content contained between the delimiters is the entity that will be replaced.
For example, the & lt;

7. Define Comments.[ CO1 - L1]


The character sequence <!-- begins a comment and --> ends the comment.
Between these two delimiters, any text at all can be written, including valid XML
markup.
Example: <!..The below element talks about an Elephant I once owned…..>

8. Define Processing Instructions.[ CO1 - L1]


Processing instructions (PIs) perform a similar function as comments in that they are not
a textual part of an XML document but provide information to applications as to how the
content should be processed.
Processing instructions have the following form: <?instruction options?>
Example: <?send-message ―process complete‖?>

9. Define Marked CDATA Sections.[ CO1 - L1]


Some documents will contain a large number of characters and text that an XML
processor should ignore and pass to an application. These are known as character data
(or CDATA) sections.
CDATA sections follow this general form: <![CDATA[content]]>

10. Define XML Content.[ CO1 - L1]


The value of XML is greatly enhanced by the presence of content within the elements.
•The content between XML elements is where most of the value lies in an XML
document.
XML elements are usually well defined and strict in their application.
XML content can contain any characters, including any valid Unicode and international
characters.

Computer Science Engineering Department 8 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

11. What is meant by Well formed XML documents?.[ CO1 - L1 - Nov/Dec 2016]
An XML document is well formed if it follows all the preceding syntax rules of XML.
On the other hand, if it includes inappropriate markup or characters that cannot be
processed by XML parsers, the document cannot be considered well formed.
It goes without saying that an XML document can‗t be partially well formed. And, by
definition, if a document is not well formed, it is not XML. This means that there is no
such thing as an XML document that is not well formed, and XML processors are not
required to process these documents.

12. What do you meant by Valid Documents .[ CO1 - L1]


A well-formed XML document is considered valid only if it contains a proper Document
Type Declaration and if the document obeys the constraints of that declaration. In most
cases, the constraints of the declaration will be expressed as a DTD or an XML
Schema.

13. Comparison between well-formed XML documents and Valid XML


documents.[ CO1 – L2]
Well-formed XML documents are designed for use without any constraints, whereas
valid XML documents explicitly require these constraint mechanisms.
The possible elements and the ordering of those elements in a document, valid XML
documents can take advantage of certain advanced features of XML that are not
available to merely well-formed documents due to their lack of a DTD or XML Schema.
The creation of well-formed XML is a simple process; the use of valid XML documents
can greatly improve the quality of document processes.
Valid XML documents allow users to take advantage of content management, business-
to-business transactions, enterprise integration, and other processes that require the
exchange of constrained XML documents.

14. What is XML namespace? .[ CO1 - L1 - Nov/Dec 2016]


XML allows document authors to create custom elements. This extensibility can result in
naming collisions (i.e. different elements that have the same name) among elements in
an XML document. An XML namespace is a collection of element and attribute names.
Each namespace has a unique name that provides a means for document authors to
unambiguously refer to elements with the same name (i.e. prevent collisions).

15.What are the uses of XML?.[ CO1 - L1]


CML – Chemical Markup Language – for chemical equations
MML - Mathematical Markup Language – for Mathematical equations and
derivations.

Computer Science Engineering Department 9 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

Used in bio medical line.

16. What is the use of XML .[ CO1 - L1]


Extensible Markup Language, derived from SGML (Standard Generalized Markup
Language.
XML is widely supported open technology (i.e. non-proprietary) for electronic data
exchange and storage.
XML is actually a language used to create other markup languages to describe data in a
structured manner.
XML documents contain only data, not formatting instructions, so applications that
process XML documents must decide how to manipulate or display the document‗s
data.

17.What do you mean by DTD in XML?.[ CO1 - L1 - Nov/Dec 2016]


DTD means Document Type Definition.
DTD file is similar to CSS file, because DTD also contains only styles.
DTD contains various styles which are to be applied in XML document.
Like .CSS file .DTD file also should be linked with XML program.
Styles in XML program should be save with .xsl (Xml Style Sheet Language) extension.

18. Define XML.[ CO1 - L1]


XML is a meta-markup language that provides a format for describing structured data.
This facilitates more structured declarations of content and more meaningful search
results across multiple platforms.

19. Define DTD.[ CO1 - L1]


A DTD is a set of rules that specifies how to use XML markup. It contains specifications
for each element, including what the element\'s attributes are, what values the attributes
can take on and what elements can be contained in others.

20. What are the XML rules for distinguishing between the content of a document
and the XML markup element? .[ CO1 - L1]
The start of XML markup elements is identified by either the less than symbol (<) or the
ampersand (&) character Three other characters, the greater than symbol (>), the
apostrophe or single quote (‗) and the double quotation marks (―) are used by XML for
markup. To use these special characters as content within your document, you must
use the corresponding general XML entity.

Computer Science Engineering Department 10 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

21. What is XQuery?.[ CO1 - L1]


XQuery is a W3C initiative to define a standard set of constructs for querying and
searching XML documents.
XQuery brings database query processing to XML.

22.What is XForm?.[ CO1 - L1]


XForm is an XML approach that overcomes the limitations of HTML forms.
XForm includes a variety of buttons, scrollbars and menus.
It generates XML form data as output. XForm\'s model has the capability to work with
the variety of user interfaces

23.What is XPath?.[ CO1 - L1]


Xpath is used to navigate XML tree structures. XPath gets its name from its use of a
path notation to navigate through the hierarchical tree structure of an XML document.
It is an important XML technology due to its role in providing a common syntax and
semantics for functionality in both XSLT and XPointer.

24. What are complex types?.[ CO1 - L1]


Complex types are an important aspects of xml schema that allow application
developers to define application-specific datatypes that can be checked by programs
that check XML document for validity. XML schema divides complex types into two
categories: those with simple content & those with complex content.

25. What all are the presentation technologies?.[ CO1 - L1]


CSS - Cascading Syle Sheets
XSL - provides users with ability to describe how xml data & document are to be
formated. Xforms - it is a GUI toolkit for creating user interfaces & delivering the results
in XML. Xhtml - it is used yo replace HTML with more flexable approach to display
web content.
VoiceXML - it is an emerging standard for speech enabled application.

26.What are all the Transformation techniques?.[ CO1 - L1]


XSLT - it is an XML- based languages used to transform XML documents into others
format such as HTML for web display.
XLINK - highlighting that element or taking the user directly to that point in the
document.

Computer Science Engineering Department 11 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

XPATH - xpath gets its name from its use of a payh notation to navigate through the
hierarchical tree structure of an XML document XQUERY - it is w3c initiative to define a
standard set of constructs for querying & searching XML document.

27.Explain any two XForm implementations?.[ CO1 - L1]


X-Smiles - it is a java based XML browser.it implements a large part of X-forms & uses
X-form together with XSL-FO on user interface side.
Mozquito Xforms preview - is an XML based Web development s/w that implements
Xforms & gives current Web browser the ability to send, receive & process XML
document.

28.What is metadata?.[ CO1 - L1]


Literally data about data. XML element and attribute names are considered Metadata in
that they may be used to describe the data contained in a document.
Metadata isn‗t needed but it certainly helps.

29.What is XML? How it is different from HTML?.[ CO1 - L1 - Nov/Dec 2016]


Xml is the text based make up language that stores the data in a structured format
using meaningful tags. It allows computers to store and exchange data in a format that
can be interpreted by any other computer with different hardware or software
specification.
XML HTML
Language.2.Several languages are derived from xml & wml HTML can be derived from
xml.
Xml uses indefinite, user defined, meaningful set of tags which can be used to include
XML data in the webpage.
HTML uses a fixed set of tags which can be used to specify the appearance of the
webpage.

30. Why DTD?.[ CO1 - L1]


XML documents are designed to be processed by computer programs
If you can put just any tags in an XML document, it‗s very hard to write a program that
knows how to process the tags
A DTD specifies what tags may occur, when they may occur, and what attributes they
may (or must) have

31. How to represent the XML Document?.[ CO1 - L1]


In any markup language, the first element to appear is called the "root element", which
defines what kind of document the file will be.

Computer Science Engineering Department 12 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

In an HTML file, the <html> tag is the root element.


An HTML file will always have the HTML element as the root element, while in an XML
file, it can be anything.
Eg: <phonebook><number></number>
<name></name></phonebook>

32. What is PCDATA in XML?.[ CO1 - L1]


Parsed Character Data (PCDATA) is a term used about text data that will be parsed by
the XML parser. XML parsers normally parse all the text in an XML document.When an
XML element is parsed, the text between the XML tags is also parsed:
<message>This text is also parsed</message>

33. What is the purpose of the XML DTD?.[ CO1 - L1]


The purpose of a DTD is to define the structure of an XML document. It defines the
structure with a list of legal elements:
<!DOCTYPE note [ <!ELEMENT note (to,from,heading,body)><!ELEMENT to
(#PCDATA)>
<!ELEMENT from (#PCDATA)><!ELEMENT heading (#PCDATA)><!ELEMENT body
(#PCDATA)> ]>

34. What is RSS?.[ CO1 - L1]


Really Simple Syndication (RSS) is a lightweight XML format designed for sharing
headlines and other Web content RSS defines an XML grammar (a set of HTML-like
tags) for sharing news. Each story is defined by an <item>, which contains a headline
TITLE, URL, and DESCRIPTION

35. Define XPath.[ CO1 - L1]


The XML Path Language (XPath) is a standard for creating expressions that can be
used to find specific pieces of information within an XML document.
XPath expressions are used by both XSLT (for which XPath provides the core
functionality) and XPointer to locate a set of nodes.
XPath expressions have the ability to locate nodes based on the nodes‗ type, name, or
value or by the relationship of the nodes to other nodes within the XML document.
In addition to being able to find nodes based on these criteria, an XPath expression can
also return any of the following:
A node set
A Boolean value
A string value
A numeric value

Computer Science Engineering Department 13 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

36. What are all the priorities available for evaluating XPath expressions?.[ CO1 -
L1]
Grouping
Filters
Path operations

37. Define XPath Syntax.[ CO1 - L1]


The basic syntax for an XPath expression:
axis::node test[predicate]

38. Define XPath Functions.[ CO1 - L1]


XPath functions are used to evaluate XPath expressions and can be divided into one of
four main groups:
 Boolean
 Node set
 Number
 String

39. What are the types of XLink Attributes.[ CO1 - L1]


xlink:type
xlink:href
xlink:role
xlink:title
xlink:show
xlink:actuate
xlink:label
xlink:from
xlink:to
PART-B

1. Explain the XML syntax rules in detail.[ CO1 – L2]


XML
XML stands for EXtensible Markup Language much like HTML
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
XML is a W3C Recommendation

Computer Science Engineering Department 14 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

The 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.

XML syntax rules


1.An XML document consists of markup and character data.
2.There are two types of markup: tags and references.
3.Tags begin with a less-than (<) character and end with a greater-than (>) character.
Example: <name>This is a paragraph.</name>
4.References in an XML document begin with an ampersand (&) and are of two types:
character references (such as &#x20;) and entity references (such as &lt;).
5.All XML documents may make references to the entities lt, gt, amp, apos, and quot,
which map to the characters less than (<), greater than (>), ampersand (&), single quote
('), and double quote ("), respectively. If not used to begin markup, the characters < and
& must be escaped
6.Element tags are of three types: start tags, end tags (which begin with </), and empty-
element tags (which end with />).
7.Character data may only appear within a non-empty element.

Example :
<empname>This is a character data.</empname>
Start and end tags must be paired and must be properly nested with other pairs of start
and end tags.

Example:
<b><i>This text is bold and italic</i></b>
Attribute specifications may appear within start tags or empty-element tags.
Every attribute specification consists of an attribute name followed by an equals sign
(=) followed by a quoted attribute value.

Example:
<img src=‖flower.jpg‖ alt=‖flower‖ />
An attribute value may not contain the character <; if the character & appears, it must be
the first character in a character or entity reference. A pair of either single quotes or
double quotes may be used to quote an attribute value.
Attribute specifications are white-space-separated from one another.

Computer Science Engineering Department 15 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

Element and attribute names are case sensitive. Example: <Message>This is


incorrect</message>
<message>This is correct</message>
The XML white space characters are the same as in XHTML: space, carriage return,
line feed, and tab.

2.Explain how a XML document can be displayed on a browser.[ CO1 – L2]


Displaying XML documents in Browsers
XSL stands for Extensible Stylesheet Language. CSS was designed for styling
HTML pages, and can be used to style XML pages.
Program 1- employee.xml <?xml version = "1.0" ?>
<?xmlstylesheethref="empdetail.css"type="text/css"?><Employee-Detail>
<Employee>
<Emp_Id> 11032 </Emp_Id><Emp_Name> Geetha </Emp_Name>
<Emp_E-mail>[email protected] </Emp_Email></Employee>
<Employee>
<Emp_Id> 11022 </Emp_Id><Emp_Name> sumalatha</Emp_Name>
<Emp_E-mail> [email protected] </Emp_Email></Employee>
<Employee>
<Emp_Id> 11011 </Emp_Id><Emp_Name> Lakshmanan </Emp_Name>
<Emp_E-mail> [email protected] </Emp_E-mail></Employee>
</Employee-Detail>
Program 2- empdetail.css
Employee-Detail { color:orange; }
Employee,Emp_Id, Emp_Name
{
display:block; font-size:25px; text-transform:capitalize; word-spacing:50px; }}

3. Explain in detail about XML document Structure?.[ CO1 – L2 - Nov/Dec 2016]


An XML document consists of a number of discrete components or sections. Although
not all the sections of an XML document may be necessary, their use and inclusion
helps to make for a well-structured XML document that can easily be transported
between systems and devices.
The major portions of an XML document include the following:
The XML declaration
The Document Type Declaration
The element data

Computer Science Engineering Department 16 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

The attribute data


The character data or XML content
XML Declaration
The first part of an XML document is the declaration. A declaration is exactly as it
sounds: It is a definite way of stating exactly what the document contains.
Example: The Declaration of Independence states that the United States planned to
separate itself from Great Britain, the XML declaration states that the following
document contains XML content.

The XML declaration is a processing instruction of the form <?xml ...?>. It is not
required, the presence of the declaration explicitly identifies the document as an XML
document and indicates the version of XML to which it was authored.The XML
declaration indicates the presence of external markup declarations and character
encoding. Because a number of documents formats use markup similar to XML, the
declaration is useful in establishing the document as being compliant with a specific
version of XML without any doubt or ambiguity.

In general, every XML document should use an XML declaration. As documents


increase in size and complexity, this importance likewise grows.Components of the XML
description:The standalone document declaration defines whether an external DTD will
be processed as part of the XML document.When standalone is set to ―yes‖, only
internal DTDs will be allowed.When it is set to ―no‖, an external DTD is required and
an internal DTD becomes an optional feature.

Valid XML Declarations:


<?xml version=‖1.0‖ standalone=‖yes‖?>
<?xml version=‖1.0‖ standalone=‖no‖?>
<?xml version=‖1.0‖ encoding=‖UTF-8‖ standalone=‖no‖?>
The first declaration defines a well-formed XML document, whereas the second defines
a well-formed and valid XML document.
The third declaration shows a more complete definition that states a typical use-case for
XML.

Document Type Declaration


The Document Type Declaration (DOCTYPE) gives a name to the XML content and
provides a means to guarantee the document‗s validity, either by including or specifying
a link to a Document Type Definition (DTD).SGML requires a Document Type
Declaration, XML has no restrictions of the sort, although one should be included to
avoid an ambiguous understanding of document content.well-formed XML documents

Computer Science Engineering Department 17 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

don‗t require the inclusion of the DOCTYPE, valid XML documents do.Valid XML
documents must declare the document type to which they comply, whereas well-formed
XML documents can include the DOCTYPE to simplify the task of the various tools that
will be manipulating the XML document.
A Document Type Declaration names the document type and identifies the internal
content by specifying the root element, in essence the first XML tag that the XML-
processing tools will encounter in the document.A DOCTYPE can identify the
constraints on the validity of the document by making a reference to an external DTD
subset and/or include the DTD internally within the document by means of an internal
DTD subset.

General forms of the Document Type Declarations:


<!DOCTYPE NAME SYSTEM ―file‖>
<!DOCTYPE NAME [ ]>
<!DOCTYPE NAME SYSTEM ―file‖ [ ]>
The first declaration, the DOCTYPE is referring to a document that only allows use of an
externally defined DTD subset.
The second declaration only allows an internally defined subset within the document.
The final listing provides a place for inclusion of an internally defined DTD subset
between the square brackets while also making use of an external subset.
In the preceding listing, the keyword NAME should be replaced with the actual root
element contained in the document, and the ―file‖ keyword should be replaced with a
path to a valid DTD.

Markup and Content


The six kinds of markup can occur in an XML document:
1. elements,
2. entity references,
3. comments,
4. processing instructions,
5. marked sections,
6. Document Type Declarations.
1.Elements
An XML document, elements are the most common form of markup. XML elements are
either a matched pair of XML tags or single XML tags that are ―self-closing.
Matching XML tags consist of markup tags that contain the same content, except that
the ending tag is prefixed with a forward slash.
Example1:
our shirt element begins with <shirt> and ends with </shirt>.

Computer Science Engineering Department 18 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

Example2:
<on_sale/>. In this case, there would be no other matching element of the same name
used in a different manner. These ―unmatched‖ elements are known as empty
elements.
The trailing ―/>in the modified syntax indicates to a program processing the XML
document that the element is empty and no matching end tag should be sought.
The XML is a hierarchical tree. This means that XML elements exist within other
elements and can branch off with various children nodes. The nature of XML is to allow
for the growth of these elements in a manner that‗s as ―wide‖ or ―deep‖ as possible.
This means that a single XML element can contain any number of child elements, and
the depth of the XML tree can consist of any number of nodes.
XML elements can contain letters, numbers, and other characters, but names cannot
start with a number or any punctuation character. XML names cannot contain spaces
because white spaces, is used within an element to separate the various attribute
sections. Also, XML elements cannot contain the greater-than or less-than characters
for obvious reasons.
XML elements cannot start with the letters ―xml‖ because they are reserved for future
use.
XML elements cannot contain the colon character because it is reserved for use in XML
namespaces.
Although punctuation marks (other than the colon) can be used within an XML element
name, you should avoid the hyphen (-) and period (.)
Element names can be as long as you like, with almost no real size limitation. This
means that the element <wow_this_really_is_one_heck_of_a_long_element_name> is
actually valid, but what programmer would want to type that element repeatedly or
encode a software application to key on that particular element name. Also, some
devices with constrained memory capabilities may not work well with overly long XML
tag names.
XML also allows for the use of non-English letters, such as á, é, and ò, in a document.
In fact, XML allows all Unicode 2.3 characters.
Attributes
Attributes are name/value pairs contained within the start element that can specify text
strings that modify the context of the element.
Example: <price currency= ―USD‖>_</price>

2.Entity References
There are times to introduce special characters or make use of content that is
constantly repeated without having to enter it multiple times. This is the role of the XML
entity

Computer Science Engineering Department 19 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

Entities provide a means to indicate to XML-processing applications that a special text


string is to follow that will be replaced with a different literal value.
Each entity has a unique name that is defined as part of an entity declaration in a DTD
or XML Schema. Entities are used by simply referring to them by name.
Entity references are delimited by an ampersand at the beginning and a semicolon at
the ending. The content contained between the delimiters is the entity that will be
replaced.
For example, the &lt; entity inserts the less-than sign (<) into a document. Elements
can be encoded so they aren‗t processed or replaced by their entity equivalents in order
to be used for display or encoding within other element values.
For example, the string <element> can be encoded in an XML document as & lt;
element & gt;, and it therefore will not be processed.

3.Comments
Comments are quite simple to include in a document. The character sequence <!--
begins a comment and --> ends the comment.
Between these two delimiters, any text at all can be written, including valid XML
markup. The only restriction is that the comment delimiters cannot be used; neither can
the literal string Comments can be placed anywhere in a document and are not
considered to be part of the textual content of an XML document.
Example: <!..The below element talks about an Elephant I once owned…..>

4. Processing Instructions
Processing instructions (PIs) perform a similar function as comments in that they are not
a textual part of an XML document but provide information to applications as to how the
content should be processed.
Processing instructions have the following form: <?instruction options?>
The instruction name, called the PI target, is a special identifier that the processing
application is intended to understand.
Example: <?send-message ―process complete‖?>

5. Marked CDATA Sections


Some documents will contain a large number of characters and text that an XML
processor should ignore and pass to an application. These are known as character data
(or CDATA) sections.Within an XML document, a CDATA section instructs the parser to
ignore all markup characters except the end of the CDATA markup instruction. This
allows for a section of XML code to be ―escaped‖ so that it doesn‗t inadvertently
disrupt XML processing. CDATA sections follow this general form: <![CDATA[content]]>

Computer Science Engineering Department 20 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

In the content section, any characters can be included, with the necessary exception of
the character string ]]>.
<object_code>
<![CDATA[
Function master(poltice integer){ If poltice<=3 then {
IntMaster=poltice+IntToString(FindElement(―<chicken>‖));
}
}
]]></object_code>

6.Document Type Definitions


Document Type Definitions (DTDs) provide a means for defining what XML markup can
occur in an XML document. Basically, the DTD provides a mechanism to guarantee that
a given XML document complies with a well-defined set of rules for document structure
and content.
These rules provide a framework for guaranteeing the ―validity‖ of a document.
XML Content
The value of XML is greatly enhanced by the presence of content within the elements.
The content between XML elements is where most of the value lies in an XML
document.XML elements are usually well defined and strict in their application.When a
DTD or XML Schema is used, users can‗t change these portions of the document.XML
content can contain any characters, including any valid Unicode and international
characters.The content can be as long as necessary and contain hundreds of
megabytes of textual information, if required. The size of the content is an
implementation decision.

4.Explain in detail about Well-Formed and Valid Documents?.[ CO1 – L2]


Well-Formed and Valid Documents
XML documents can be well formed, and they can also be valid. Validity implies ―well-
formed.

Well-Formed Documents
An XML document is well formed if it follows all the preceding syntax rules of XML.
On the other hand, if it includes inappropriate markup or characters that cannot be
processed by XML parsers, the document cannot be considered well formed.
It goes without saying that an XML document can‗t be partially well formed. And, by
definition, if a document is not well formed, it is not XML. This means that there is no
such thing as an XML document that is not well formed, and XML processors are not
required to process these documents.

Computer Science Engineering Department 21 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

Valid Documents
A well-formed XML document is considered valid only if it contains a proper Document
Type Declaration and if the document obeys the constraints of that declaration. In most
cases, the constraints of the declaration will be expressed as a DTD or an XML
Schema.

Comparison between well-formed XML documents and Valid XML documents:


Well-formed XML documents are designed for use without any constraints, whereas
valid XML documents explicitly require these constraint mechanisms.

The possible elements and the ordering of those elements in a document, valid XML
documents can take advantage of certain advanced features of XML that are not
available to merely well-formed documents due to their lack of a DTD or XML Schema.
The creation of well-formed XML is a simple process; the use of valid XML documents
can greatly improve the quality of document processes.

Valid XML documents allow users to take advantage of content management, business-
to-business transactions, enterprise integration, and other processes that require the
exchange of constrained XML documents.

5. Explain the role of XML name spaces with example.[ CO1 – L2]
XML namespaces - XML Namespace is used to avoid element name conflict in XML
document.The XML Namespace recommendation provides a mechanism for identifying
each element and attribute name within a document with a specific XML vocabulary.
An XML namespace is a collection of element and attribute names associated with a
particular XML vocabulary (such as XHTML) through an absolute URI known as the
namespace name

Default namespace :
<html xmlns="http://www.w3.org/1999/xhtml">
XML Namespace Declaration - An XML namespace is declared using the reserved XML
attribute. This attribute name must be started with "xmlns".

XML namespace syntax:


<element xmlns:prefixname = "URI">
Namespace starts with keyword "xmlns".
The word name is a namespace prefix.
The URL is a namespace identifier.

Computer Science Engineering Department 22 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

Example
<?xmlversion="1.0" encoding="UTF-8"?>
<cont:contact xmlns:cont="http://sssit.org/contact-us">
<cont:name>VimalJaiswal</cont:name>
<cont:company>SSSIT.org</cont:company>
<cont:phone>(0120) 425-6464</cont:phone>
</cont:contact>
Namespace Prefix: cont
Namespace Identifier: http://sssit.org/contact-us
It specifies that the element name and attribute names with cont prefix belongs to
http://sssit.org/contact-us name space.
In XML, elements name are defined by the developer so there is a chance to conflict in
name of the elements. To avoid these types of confliction we use XML Namespaces.
The XML Namespaces provide a method to avoid element name conflict. Generally
these conflicts occur when we try to mix XML documents from different XML application.

Table 1:
<table>
<tr>
<td>Aries</td>
<td>Bingo</td>
</tr>
</table>

Table 2:
This table carries information about a computer table.
<table>
<name>Computer table</name>
<width>80</width
><length>120</length>
</table>
If you add these both XML fragments together, there would be a name conflict because
both have <table>element. Although they have different name and meaning
How to get rid of name conflict?
1) By Using a Prefix
Table 1:<h:table>
<h:tr><h:td>Aries</h:td>
<h:td>Bingo</h:td></h:tr>

Computer Science Engineering Department 23 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

</h:table>
Table 2:<f:table>
<f:name>Computer
table</f:name><f:width>80</f:width><f:length>120</f:length></f:table>
Note: In this example, you will get no conflict because both the tables have specific
names.
2) By Using xmlns Attribute
<root>
<h:table xmlns:h="http://www.abc.com/TR/html4/"><h:tr>
<h:td>Aries</h:td>
<h:td>Bingo</h:td>
</h:tr>
</h:table>
<f:table:xmlns:f="http://www.xyz.com/furniture"><f:name>Computer
table</f:name><f:width>80</f:width><f:length>120</f:length>
</f:table>
</root>
In the above example, the <table> element defines a namespace and when a
namespace is defined for an element, the child elements with the same prefixes are
associated with the same namespace.
<rootxmlns:h="http://www.abc.com/TR/html4/"
xmlns:f="http://www.xyz.com/furniture"><h:table>
<h:tr>
<h:td>Aries</h:td>
<h:td>Bingo</h:td>
</h:tr>
</h:table>
<f:table>
<f:name>Computer table</f:name><f:width>80</f:width><f:length>120</f:length>
</f:table>
</root>
Note: The Namespace URI used in the above example is not necessary at all. It is not
used by parser to look upinformation. It is only used to provide a unique name to the
Namespace identifier.

Uniform Resource Identifier (URI)


Uniform Resource Identifier is used to identify the internet resource. It is a string of
characters. The most common URI is URL (Uniform Resource Locator) which identifies

Computer Science Engineering Department 24 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

an internet domain address. There is also an URI name URN (Universal Resource
Name) but it is not so common.

The Default Namespace


The default namespace is used in the XML document to save you from using prefixes in
all the child elements.The only difference between default namespace and a simple
namespace is that: There is no need to use a prefix in default namespace.You can also
use multiple namespaces within the same document just define a namespace against a
child node.

Example of Default Namespace:


<tutorials xmlns="http://www.javatpoint.com/java-tutorial"><tutorial>
<title>Java-tutorial</title><author>Sonoo Jaiswal</author>
</tutorial>
</tutorials>
You can see that prefix is not used in this example, so it is a default namespace.
Note: If you define a namespace without a prefix, all descendant elements are
considered to belong to that namespace.

6.Briefly discuss about XML and DTD. Write a DTD for employee including
employee name (firstname and lastname) Employee Date of birth (month, Date
and Year) and address (city and state) .[ CO1 – L2]
XML and DTD
A DTD (Document Type Definition) describes the structure of one or more XML
documents. Specifically, a DTD describes:
Elements
Attributes, and
Entities
An XML document is well-structured if it follows certain simple syntactic rules
An XML document is valid if it also specifies and conforms to a DTD

Why DTD?
A DTD allows the XML document to be verified (shown to be legal)
A DTD that is shared across groups and allows the groups to produce consistent XML
documents Parsers An XML parser is an API that reads the content of an XML
document,Currently popular APIs are DOM (Document Object Model) and SAX
(Simple API for XML) A validating parser is an XML parser that compares the XML
document to a DTD and reports any errors.Most browsers don‗t use validating parser

Computer Science Engineering Department 25 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

An XML example
<novel>
<foreword>
<paragraph>This is the great American novel.</ paragraph></foreword>
<chapter number="1">
<paragraph>It was a dark and stormy night.</paragraph><paragraph>Suddenly, a shot
rang out!</paragraph>
</chapter>
</novel>
An XML document contains (and the DTD describes):
Elements, such as novel and paragraph, consisting of tags and content
Attributes, such as number="1", consisting of a name and a value
Entities (not used in this example)
A DTD example
<!DOCTYP E novel [
<!ELEMENT novel (foreword, chapter+)><!ELEMENT foreword(paragraph+)>
<!ELEMENT chapter (paragraph+)>
<!ELEMENT paragraph(#PCDATA)>
<!ATTLIST chapter number CDATA #REQUIRED>
]>
A novel consists of a foreword and one or more chapters, in that order
Each chapter must have a number attribute
A foreword consists of one or more paragraphs
A chapter also consists of one or more paragraphs
A paragraph consists of parsed character data (text that cannot contain any other
elements)

ELEMENT descriptions
Suffixes:
? optional foreword?
+ one or more chapter+
* zero or more appendix*
Separators:
both, in order foreword?, chapter+
| or section chapter
Grouping:
() grouping (section |chapter)+
Element Syntax

Computer Science Engineering Department 26 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

Element defines tagname


<!ELEMENT tagname (values)>
Values defines child elements
<!ELEMENT tagname (child1, child2)>
The type of the element
<!ELEMENT tagname (type)>Types? #PCDATA, EMPTY or ANY
In the DTD: <!ELEMENT br EMPTY>
In the XML: <br></br> or just <br />
In the XML, an empty element may not have any content between the start tag and the
end tag.
Attributes and entities
The format of an attribute is: <!ATTLIST element-name
Internal: DTD is part of the declaration and is embedded into the XML document.
External: DTD is an external file and declaration links to the file.

Program 1- XML FILE


<?xml version="1.0"?>
<!DOCTYPE weather Report SYSTEM
"http://www.mysite.com/mydoc.dtd"><employee>
<employee_name><firstname>Geetha</firstname><lastname>Virdi</lastname></emplo
yee_name><employee_dob><date>twenty
second</date><month>April</month><year>2000</year><employee_dob>
<address>
<city>Villupuram</city>
<state>Tamilnadu</state>
</address>
<employee>
Program 2 – DTD FILE for XML
<!ELEMENT employee(employee_name, employee_dob, address)>
<!ELEMENT employee_name(firstname, lastname)>
<!ELEMENT firstname(#PCDATA)>
<!ELEMENT lastname(#PCDATA)>
<!ELEMENT employee_dob(date, month, year)>
<!ELEMENT date (#PCDATA)>
<!ELEMENT month(#PCDATA)>
<!ELEMENT year(#PCDATA)>
<!ELEMENT address(city, state)>
<!ELEMENT city(#PCDATA)>
<!ELEMENT state(#PCDATA)>

Computer Science Engineering Department 27 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

7. Explain in detail and give example of XML Schema?.[ CO1 – L2 - Nov/Dec 2016]
What is an XML Schema?
An XML Schema describes the structure of an XML document. The purpose of an XML
Schema is to define the legal building blocks of an XML document, just like a DTD.

An XML Schema:
Elements that can appear in a document
Attributes that can appear in a document
Which elements are child elements
The order of child elements
The number of child elements
Whether an element is empty or can include text
Data types for elements and attributes
Default and fixed values for elements and attributes

Why Use XML Schemas?


XML Schema is an XML-based alternative to DTD.
XML Schemas are much more powerful than DTDs.
The XML Schema language is also referred to as XML Schema Definition (XSD).

XML Schemas use XML Syntax


Another great strength about XML Schemas is that they are written in XML.
Some benefits of that XML Schemas are written in XML:
You don't have to learn a new language
You can use your XML editor to edit your Schema files
You can use your XML parser to parse your Schema files
You can manipulate your Schema with the XML DOM
You can transform your Schema with XSLT

XML Schemas Secure Data Communication


When sending data from a sender to a receiver, it is essential that both parts have the
same "expectations" about the content.
Example:
With XML Schemas, the sender can describe the data in a way that the receiver will
understand. A date like: "03-11-2004" will, in some countries, be interpreted as
3.November and in other countries as 11.March.

Computer Science Engineering Department 28 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

However, an XML element with a data type like this:


<date type="date">2004-03-11</date>
ensures a mutual understanding of the content, because the XML data type "date"
requires the format "YYYY-MM-DD".
XML Schemas are Extensible
XML Schemas are extensible, because they are written in XML.
With an extensible Schema definition you can:
• Reuse your Schema in other Schemas
• Create your own data types derived from the standard types
• Reference multiple schemas in the same document

XML Schema
Valid XML Document for XML Schema (employee.xml)
<?xml version="1.0"?>
<Employee_Info xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="employee.xs">
<Employee Employee_Number="105">
<Name>Masashi Okamura</Name>
<Department>Design Department</Department>
<Telephone>03-1452-4567</Telephone>
<Email>[email protected]</Email>
</Employee>
<Employee Employee_Number="109">
<Name>Aiko Tanaka</Name>
<Department>Sales Department</Department>
<Telephone>03-6459-98764</Telephone>
<Email>[email protected]</Email>
</Employee>
</Employee_Info>

Employee Information XML Schema employee.xs)


<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" ><xs:element
name="Employee_Info" type="EmployeeInfoType" />
<xs:complexTypename="EmployeeInfoType">
<xs:sequence>
<xs:element ref="Employee" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>

Computer Science Engineering Department 29 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

</xs:complexType>
<xs:element name="Employee" type="EmployeeType" />
<xs:complexType name="EmployeeType">
<xs:sequence >
<xs:element ref="Name" />
<xs:element ref="Department" /><xs:element ref="Telephone" />
<xs:element ref="Email" />
</xs:sequence
<xs:attribute name="Employee_Number" type="xs:int" use="required"/>
</xs:complexType>
<xs:element name="Name" type="xs:string" />
<xs:element name="Department" type="xs:string" />
<xs:element name="Telephone" type="xs:string" />
<xs:element name="Email" type="xs:string" />
</xs:schema>

Employee Information DTD (emp.dtd)


<!ELEMENT Employee_Info (Employee)*>
<!ELEMENT Employee (Name, Department, Telephone, Email)>
<!ELEMENT Name (#PCDATA)>
<!ELEMENT Department (#PCDATA)>
<!ELEMENT Telephone (#PCDATA)>
<!ELEMENT Email (#PCDATA)>
<!ATTLIST Employee Employee_Number CDATA #REQUIRED>
<?xml version="1.0"?>
<!DOCTYPE note SYSTEM "http://www.w3schools.com/dtd/emp.dtd"><note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body></note>

8.Explain in detail about X-Files.[ CO1 – L2 - Nov/Dec 2016]


The XML Path Language provides a standard syntax for querying an XML document for
specific pieces of information. This syntax provides an independent mechanism for
―querying‖ or locating the desired elements or attributes within the XML document.
XPath, itself, is a very powerful mechanism for finding the elements or attributes.
XPath was created—to reduce the amount of time to find the elements and attributes
desired by an author or developer.

Computer Science Engineering Department 30 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

XLink allows an XML document to specify a link from the current document to another
document in another location.
XPointer expands on the functionality of XLink by building on the XPath specification
and identifying a node or node set to link to in the target document. This provides much
the same functionality as a foreign key within a table of a database.XPointers provide
the same functionality within a group of XML documents.XPath The XML Path
Language (XPath) is a standard for creating expressions that can be used to find
specific pieces of information within an XML document.XPath expressions are used by
both XSLT (for which XPath provides the core functionality) and XPointer to locate a set
of nodes.XPath expressions have the ability to locate nodes based on the nodes‗ type,
name, or value or by the relationship of the nodes to other nodes within the XML
document.In addition to being able to find nodes based on these criteria, an XPath
expression can also return any of the following:
1. A node set
2. A Boolean value
3. A string value
4. A numeric value

Operators and Special Characters


XPath expressions are composed using a set of operators and special characters, each
with its own meaning. Table lists the various operators and special characters used
within the XML Path Language.
The priority for evaluating XPath expressions is as follows:
1. Grouping
2. Filters
3. Path operations
XPath Syntax
The XML Path Language provides a declarative notation, termed a pattern, used to
select the desired set of nodes from XML documents.
Each pattern describes a set of matching nodes to select from a hierarchical XML
document.
Each pattern describes a ―navigation‖ path to the desired set of nodes similar to the
Uniform Resource Identifier (URI) syntax.
A location path is, itself, made up of one or more location steps.
Each step is further comprised of three pieces:
An axis
A node test
A predicate
The basic syntax for an XPath expression:axis::node test[predicate]

Computer Science Engineering Department 31 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

Axis
The axis portion of the location step identifies the hierarchical relationship for the
desired nodes from the current context.
Every axis has a principal node type:
If an axis is an element, the principal node type is element; otherwise, it is the type of
node the axis can contain.
If the axis is attribute, the principal node type is attribute.
A node test may also contain a node name, or QName. In this case, a node with the
specified name is sought, and if found, it‗s returned in the node set. However, the nodes
selected in this manner must be the principal node type sought and have an expanded
name equal to the QName specified.
This means that if the node belongs to a namespace, the namespace must also be
included in the node test for the node to be selected.
For instance, ancestor::div and ancestor::test:div will produce two entirely different node
sets. In this first case, only nodes that have no namespace specified and have a name
of div will be selected. In the second case, only those div nodes belonging to the test
namespace will be selected.
In addition to specifying an actual node name, other node tests are available to select
the desired nodes. Here‗s a list of these node tests:
 comment()
 node()
 processing-instruction()
 text()

The comment() node test selects comment nodes from an XML document.
The node() node test selects a node of any type, whereas the text() node test selects
those nodes that are text nodes.
The processing-instruction() node test, because this node test will accept a literal string
parameter to specify the name of a desired processing instruction.

Predicates
The predicate portion of a location step filters a node set on the specified axis to create
a new node set. Each node in the preliminary node set is evaluated against the
predicate to see whether it matches the filter criteria.
If it does, the node ends up in the filtered node set. Otherwise, it doesn‗t.
A predicate may consist of a filter condition that is applied to an axis that either directs
the condition in a forward or reverse direction.

Computer Science Engineering Department 32 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

A forward axis predicate contains the current context node and nodes that follow the
context node.
A reverse axis predicate contains the current context node and nodes that precede the
context node.
XPath Functions
XPath functions are used to evaluate XPath expressions and can be divided into one of
four main groups:
 Boolean
 Node set
 Number
 String

XPointer
An XPointer uses location steps the same as XPath but with two major differences:
Because an XPointer describes a location within an external document, an XPointer can
target a point within that XML document or a range within the target XML document.
Because XPointer builds on the XPath specification, the location steps within an
XPointer are comprised of the same elements that make up XPath location steps.
The node tests already listed for XPath expressions

XPointer provides two more important node tests:


1. point()
2. range()
point can represent the location immediately before or after a specified character or the
location just before or just after a specified node.
A range consists of a start point and an endpoint and contains all XML information
between those two points.
An XPath expression, the result from a location step is known as a node set; for an
XPointer expression, the result is known as a location set.
To reduce the confusion, the XPointer specification uses a different term for the results
of an expression:
An XPointer expression can yield a result consisting of points or ranges, the idea of the
node set had to be extended to include these types. Therefore, to prevent confusion,
theresults of an XPointer expression are referred to location sets.
Four of the functions that return location sets, id(), root(), here(), and origin().
The id() function works exactly the same as the id() function for an XPath expression.
The root() function works just like the / character—it indicates the root element of an
XML document

Computer Science Engineering Department 33 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

The next two functions, here() and origin(), are interesting functions in their own right.
The here() function, as indicated, refers to the current element.
Points
Many times a link from one XML document into another must locate a specific point
within the target document.
Two different types of points can be represented using XPointer points:
1. Node points
2. Character points
Node points are location points in an XML document that are nodes that contain child
nodes. For these node points, the index position indicates after which child node to
navigate to. If 0 is specified for the index, the point is considered to be immediately
before any child nodes. A node point could be considered to be the gap between the
child nodes of a container node.
When the origin node is a text node, the index position indicates the number of
characters. These location points are referred to as character points. Because you are
indicating the number of characters from the origin, the index specified must be an
integer greater than or equal to 0 and less than or equal to the total length of the text
within the text node.

Ranges
An XPointer range defines just that—a range consisting of a start point and an endpoint.
A range will contain the XML between the start point and endpoint but does not
necessarily have to consist of neat sub trees of an XML document. A range can extend
over multiple branches of an XML document. The only criterion is that the start point
and endpoint must be valid.
Within the XPointer Language, a range can be specified by using the keyword to within
the XPointer expression in conjunction with the start-point() and end-point() functions.

Abbreviating XPointer Notation


1. XPointer expressions, generally elements will be referenced by ID or
by location. For just this reason, the XML Pointer Language added a
few abbreviated forms of reference.
2. In addition to all the standard XPath abbreviations, XPointer goes one
step beyond that:
3. XPointer allows you to remove the [ and ] characters from the index
position. Therefore, the expression
4. /People/Person[1]/Name[1] becomes this:
5. Overall, it‗s a much shorter expression. However, speaking from
experience, this does

Computer Science Engineering Department 34 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

6. not tend to lend itself well to actual implementation.


7. The reasoning behind this goes back to what XML was designed for in
the first place: to give meaning and structure to data.
8. By specifying the XPointer expression as 1/1/1, lose all documentation
regarding what it is we‗re looking for—have to know, off the tops of our
heads, that are going to be selecting the first <Name> element of the
first <Person> element of the <People> element.
XLink
1. The anchor element, <a>, within HTML indicates a link to another resource on an
HTML page. This could be a location within the same document or a document
located elsewhere. In HTML terms, the anchor element creates a hyperlink to
another location.
2. The hyperlink can either appear as straight text, a clickable image, or a
combination of both.
3. The XML Linking Language creates a link to another resource through the use of
attributes specified on elements, not through the actual elements themselves.

1. xlink:type:
The xlink:type attribute must contain one of the following values:
Simple - A value of simple creates a simple link between resources.
Extended - A value of extended creates an extended link.
Locator - A value of locator creates a link that points to another resource.
Arc - A value of arc creates an arc with multiple resources and various traversal paths.
Resource - A resource value creates a link to indicate a specific resource.
Title - A value of title creates a title link
none - a value of none for the xlink:type attribute, the parent element has no XLink
meaning, and no other XLink-related content or attributes have any relationship to the
element.

2.xlink:href:
The xlink:href attribute supplies the location of the resource to link to. This attribute is a
URI reference that can be used to find the desired resource.

3.xlink:role:
The xlink:role attribute specifies the function of the link. This attribute may only be used
for the following XLink types:
• Extended
• Simple
• Locator

Computer Science Engineering Department 35 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

• Resource

4.xlink:arcrole
The xlink:arcrole attribute may only be used with two types of XLinks:
• Arc
• Simple

5.xlink:title
The xlink:title attribute is completely optional and is provided for us to make some
sense of and document, in a way, what a particular link is. If the xlink:title attribute is
specified, it should contain a string describing the resource.

6.xlink:show
The xlink:show attribute is an optionally specified attribute for a link for the simple and
arc XLink types and will accept the following values:
New- A value of new is specified, the resource will be loaded into a new window.
Replace - A value of replace indicates that the resource should be loaded into the
current window
Embed - A value of embed will load the resource into the specified location and wrap
the originating resource around it, as appropriate.
Other - A value of other allows each application using XLinks to look for other
indications within the XML document to determine what needs to be done.
None - A value of none has essentially the same effect as specifying a value of other,
with the exception that the application is not expected to look for other indications as to
what to do to display the link.

7. xlink:actuate
The xlink:actuate attribute is used to indicate when the linked resource should be
loaded. This attribute will accept the following values:
Onload - A value of onLoad indicates that when the current resource is loading, the
linked resource should be loaded as well.
onRequest - A value of onRequest means the linked document should only be loaded
when some post-loading event triggers a message for traversal.
other - A value of other indicates, again, that the application should look for other
indications as to what the desired behavior is.
none - A value of none specifies that the application is free to handle the loading of the
linked resource in whatever manner seems appropriate.

Computer Science Engineering Department 36 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

8. xlink:label, xlink:from and xlink:to:


The xlink:label attribute is used to name resource and locator XLink types. This value
will end up being used as values within the xlink:from and xlink:to attributes to indicate
the starting and ending resources for an arc XLink type.
The XML Linking Language offers two major types of links:
Simple - a simple link is a convenient, shorthand notation by which to associate two
resources. These resources—one local and one remote—are connected by an arc,
always making a simple link an outbound link.
Extended - An extended link associates any number of resources together.
Furthermore, those resources may be both local and remote.
Simple Links
A simple link combines the functionality provided by the different pieces available
through an extended link together into a short and notation.
1. A simple link consists of an xlink:type attribute with a value of simple and,
optionally, an xlink:href attribute with a specified value.
2. A simple link may have any content, and even no content; it is up to the
application to provide some means to generate a traversal request for the link.
3. If no target resource is specified with the xlink:href attribute, the link is simply
considered―dead‖ and will not be traversable.
4. Simple links play multiple roles in linking documents. For instance, the simple
link, itself, acts as a resource XLink type for the local document.
5. It is the combination of this functionality that shortens the XLink definition for a
simple link.
6. simple links are just that—simple.
7. They link exactly two resources together: one local and one remote. Therefore, if
something more complex must be handled, an extended link is necessary.
Extended Links
a. The XML Linking Language, extended links gives the ability to specify
relationships between an unlimited number of resources, both local and
remote.
b. In addition, these links can involve multiple paths between the linked
resources.
c. Local resources are part of the actual extended link, whereas remote
resources identify external resources to the link.
d. An out-of-line link is created when there are no local resources at all for a
link.It is up to individual applications to decide how to handle extended
links; there‗s no magic formula for this one.

Computer Science Engineering Department 37 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

Unit - II
Building Xml- Based Applications
Part – A
1. What are the different XSLT elements?.[ CO1 - L1]
Style sheet
Value-of
For-each
Sort
Text

2. What is XQuery?.[ CO1 - L1]


XQuery is a W3C initiative to define a standard set of constructs for querying and
searching XML documents.XQuery brings database query processing to XML.

3.What is XForm?.[ CO1 - L1]


XForm is an XML approach that overcomes the limitations of HTML forms.
XForm includes a variety of buttons, scrollbars and menus.
It generates XML form data as output. XForm\'s model has the capability to work with
the variety of user interfaces.

4.What is XPath?.[ CO1 - L1]


Xpath is used to navigate XML tree structures. XPath gets its name from its use of a
path notation to navigate through the hierarchical tree structure of an XML document.
It is an important XML technology due to its role in providing a common syntax and
semantics for functionality in both XSLT and XPointer.

5.What are complex types?.[ CO1 - L1]


 Complex types are important aspects of xml schema that allow application
developers to define application-specific data types that can be checked by
programs that check XML document for validity.
 XML schema divides complex types into two categories: those with simple
content & those with complex content.

Computer Science Engineering Department 38 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

6.What all are the presentation technologies? .[ CO1 - L1]


CSS - cascading style sheets
XSL - provides users with ability to describe how xml data & document are to be
formatted.
Xforms - it is a GUI toolkit for creating user interfaces & delivering the results in XML.
Xhtml - it is used to replace HTML with more flexible approach to display web content.
VoiceXML - it is an emerging standard for speech enabled application.

7.What are all the Transformation techniques?.[ CO1 - L1 - Nov/Dec 2016]


XSL - it is an XML- based languages used to transform XML documents into others
format such as HTML for web display.
XLINK - highlighting that element or taking the user directly to that point in the
document.
XPATH - Xpath gets its name from its use of a path notation to navigate through the
hierarchical tree structure of an XML document XQUERY - it is w3c initiative to define a
standard set of constructs for querying & searching XML document.

8.Explain any two XForm implementations?.[ CO1 - L1]


X-Smiles - it is a java based XML browser. it implements a large part of X-forms & uses
X-form together with XSL-FO on user interface side.
Mozquito Xforms preview - is an XML based Web development s/w that implements
Xforms & gives current Web browser the ability to send, receive & process XML
document.

9. What are the Important of SAX?.[ CO1 - L1]


SAX is an event driven.
SAX supports processing pipelines.
SAX requires programmers to maintain state.

10. What is metadata?.[ CO1 - L1]


Literally data about data. XML element and attribute names are considered Metadata in
that they may be used to describe the data contained in document.Metadata isn‗t
needed but it certainly helps 11.Mention any 3 XML Parsers,SAX (Simple API for XML)
Parser,DOM (Document Object Model) Parser and XSLT (XML Style Sheet) Parsers

12.What is XSL Programming?.[ CO1 - L1]

Computer Science Engineering Department 39 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

XSL (XML Style sheet) Programming is the Next Generation of the CSS (Cascading
Style Sheet Programming).In CSS, users can use certain style tags which the browsers
can understand and are predefined by W3 consortium.
XSL takes to one step ahead and users can define any tags in the XML file.
XML sheets can help in showing the same data in different formats.
<?xml-stylesheet href="doc.xsl" type="text/xsl"?>

13.What is XSLT? .[ CO1 - L1 - Nov/Dec 2016]


XSLT stands for XSL Transformations
XSLT is the most important part of XSL
XSLT transforms an XML document into another XML document
XSLT uses XPath to navigate in XML documents
XSLT is a W3C Recommendation

14.How is XML parsing done with SAX? .[ CO1 - L1]


SAX parser is work differently with DOM parser, it either load any XML document
intomemory nor create any object representation of the XML document.
Instead, the SAX parser use callback function (org.xml.sax.helpers.DefaultHandler) to
informs clients of the XML document structure.
SAX Parser is faster and uses less memory than DOM parser.

15.What is the purpose of XSLT? .[ CO1 - L1]


The XSLT language transforms XML into a format interpreted by an Internet browser.
XML presents as a text document of XML code, which is not particularly useful.
XML does not do anything on its own.
It is luggage that carries information for you, but has no idea what to do with that
information. It just knows you need it carry

16.What does XSLT mean? .[ CO1 - L1]


XSL stands for EXtensible Stylesheet Language, and is a style sheet language for XML
documents.
XSLT stands for XSL Transformations. In this tutorial you will learn how to use XSLT to
transform XML documents into other formats, like XHTML

17. Define DOM.[ CO1 - L1]


The Document Object Model (DOM) provides a way of representing an XML document
in memory so that it can be manipulated by your software.
DOM is a standard application programming interface (API) that makes it easy for
programmers to access elements and delete, add, or edit content and attributes.

Computer Science Engineering Department 40 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

18.Why Do I Need DOM? .[ CO1 - L1]


The main reason for using DOM is to create or modify an XML document
programmatically.To create a document, first start by creating a root element and then
add attributes, content, sub-elements, and so on. Finally write the document out to disk
or send it over a network.The representation in memory is a tree structure that starts
with a root element that contains attributes, content, and sub-elements.Traverse this
tree, search for a specific node, and change its attributes or data. Also add attributes or
elements anywhere in the tree, as long as you don‗t violate the rules of a well formed
document. Finally write the modified document back out to disk or to the network.It is
possible to process XML documents using other, simpler techniques, such XSLT.The
problem is that XSLT is not always expressive enough to solve complex problems.

19.What are the Disadvantages of Using DOM.[ CO1 - L1]


One of the big issues is that DOM can be memory intensive.
A large document will require a large amount of memory to represent it.
Other parsing methods, such as SAX, don‗t read in the entire document, so they are
better in terms of memory efficiency for some applications.
The DOM API is too complex.

20. Define DOM Traversal and Range.[ CO1 - L1]


Traversal
Traversal is a convenient way to walk through a DOM tree and select specific nodes.
Range
Range interfaces provide a convenient way to select, delete, extract, and insert content.
A range consists of two boundary points corresponding to the start and the end of the
range.

21.Define SAX .[ CO1 - L1]


SAX is an API that can be used to parse XML documents.
A parser is a program that reads data a character at a time and returns manageable
pieces of data.
SAX provides a framework for defining event listeners, or handlers. These handlers are
written by developers interested in parsing documents with a known structure.
The handlers are registered with the SAX framework in order to receive events. Events
can include start of document, start of element, end of element, and so on. The
handlers contain a number of methods that will be called in response to these events.

Computer Science Engineering Department 41 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

PART B

1. Explain how XML is processed with the help of SAX.[ CO1 – L2]
When such an event occurs, the handler automatically calls back to a particular method
overridden by the client, and feeds as arguments the method what it sees
SAX parser is event-based; it works like an event handler in Java.

The program consists of two classes:


Sample -- This class contains the main method; it
Gets a factory to make parsers
Gets a parser from the factory
Creates a Handler object to handle callbacks from the parser
Tells the parser which handler to send its callbacks to Reads and parses the input XML
file

The following interfaces and classes used SAX Parser


interface ContentHandler -- reports on document events
interface ErrorHandler–reports on validity errors
class DefaultHandler – implements both of the above plus two others
public interface Content Handler
This is the main interface that most SAX applications implement: if the application.
needs to be informed of basic parsing events, it implements this interface and registers
an instance with the SAX parser using the set Content Handler method.
The parser uses the instance to report basic document-related events like the start and
end of elements and character data.

Handler -- This class contains handlers for three kinds of callbacks:


p start Element callbacks, generated when a start tag is seen
q end Element callbacks, generated when an end tag is seen
r characters callbacks, generated for the contents of an element
Default Handler is an adapter class that defines these methods and others as do-
nothing methods, to be overridden as desired
We will define three very similar methods to handle (1) start tags, (2) contents, and (3)
end tags--our methods will just print a line Each of these three methods could throw a
SAX Exception interface XML Reader -- defines parser behavior a This interface
allows an application to set and query features and properties in the parser, to register
event handlers for document processing, and to initiate a document parse.

Computer Science Engineering Department 42 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

public void startDocument() throws SAXException


//This is called just once, at the beginning of parsing
public void endDocument() throws SAXException
//This is called just once, and is the last method called by the parser

If the parser is namespace-aware,namespaceURI will hold the prefix (before the colon)
localName will hold the element name (without a prefix) qualifiedName will be the empty
stringIf the parser is not using namespaces,namespaceURI and localName will be
empty strings qualifiedName will hold the element name (possibly with prefix) When
SAX calls startElement, it passes in a parameter of type Attributes .Attributes is an
interface that defines a number of useful methods; o getLength() returns the number of
attributes getLocalName(index) returns the attribute‗s local name o getQName(index)
returns the attribute‗s qualified name o getValue(index) returns the attribute‗s value As
with elements, if the local name is the empty string, then the attribute‗s name is in the
qualified name public void end Element()throws SAX Exception Receive notification of
the end of an element

Program1- SAXCountEmployees.java
Import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.XMLReader;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
class SAXCountEmployees {
static public void main(String args[]) { try {
String FEED_URL = "employee.xml";
SAXParserFactory saxFactory = SAXParserFactory.newInstance(); XMLReader parser
= saxFactory.newSAXParser().getXMLReader();
parser.setContentHandler(new CountElementsHelper()); parser.parse(FEED_URL);
}
catch (Exception e)
{
e.printStackTrace();
}
return;
}
private static class CountElementsHelper extends DefaultHandler { int numElements;
CountElementsHelper() {

Computer Science Engineering Department 43 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

super();
}
public void startDocument() throws
SAXException { numElements = 0;
return; }
public void startElement(String namespaceURI, String localName, String qName,
Attributes atts) throws SAXException
{
if (qName.equals("Employee")) { numElements++;
}
return;
}
public void endDocument() throws SAXException
{
System.out.println("Input document has " + numElements + " 'Employee' elements.");
return;
}}}

Program 2 -- employee.xml
<?xml version = "1.0" ?>
<Employee-Detail>
<Employee>
<Emp_Id> 11032 </Emp_Id>
<Emp_Name> Geetha </Emp_Name>
<Emp_E-mail>[email protected] </Emp_E-mail>
</Employee>
<Employee>
<Emp_Id> 11022 </Emp_Id>
<Emp_Name> sumalatha</Emp_Name>
<Emp_E-mail> [email protected] </Emp_E-mail>
</Employee>
<Employee>
<Emp_Id> 11011 </Emp_Id>
<Emp_Name> Lakshmanan </Emp_Name>
<Emp_E-mail> [email protected] </Emp_E-mail>
</Employee></Employee-Detail>
Input document has 3 Employee elements

Computer Science Engineering Department 44 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

Advantage:
It is simple. SAX supported in almost all programming languages
Quantity of memory usage is low. (3) It works well in stream application
Only for reading xml-documents

Disadvantage:
The data is broken into pieces and clients never have all the information as a whole
unless they
create their own data structure

Difference between SAX and DOM


DOM reads the entire XML document into memory and stores it as a tree data structure
SAX reads the XML document and calls one of your methods for each element or block
of text that it encounters Consequences:DOM provides ―random access‖ into the XML
document o SAX provides only sequential access to the XML documentDOM is slow
and requires huge amounts of memory, so it cannot be used for large XML documents
SAX is fast and requires very little memory, so it can be used for huge documents (or
large numbers of documents)

2. Explain about DOM based XML processing.[ CO1 – L2]


Introduction to Parser-It reads a text-formatted XML file or stream and converts it to a
document to be manipulated by the application.

DOM-Tree Based Parser


The Document Object Model (DOM) is an application programming interface (API) for
HTML and XML documents It defines the logical structure of documents and the way a
document is accessed and manipulated

Properties of DOM
Programmers can build documents, navigate their structure, and add, modify, or delete
elements and content.
Provides a standard programming interface that can be used in a wide variety of
environments and applications.
XML Parser
The XML DOM contains methods (functions) to traverse XML trees, access, insert, and
delete nodes. However, before an XML document can be accessed and manipulated, it
must be loaded into an XML DOM object.

Computer Science Engineering Department 45 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

An XML parser reads XML, and converts it into an XML DOM object that can be
accessed with JavaScript. Most browsers have a built-in XML parser.

Program1- DOMCountEmployees.java
// JAXP classes
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
// DOM classes
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
// JDK classes
import java.io.File;
class DOMCountEmployees
{
static public void main(String args[])
{
try {
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder parser = docBuilderFactory.newDocumentBuilder();
Document document = parser.parse(new File("employee.xml"));
NodeList emplist = document.getElementsByTagName("Employee");
System.out.println("Input document has"+emplist.getLength() + " 'Employee'
elements.");
}
catch (Exception e)
{
e.printStackTrace();
} return;
}
}

Program employee.xml
<?xml version = "1.0" ?>
<Employee-Detail>
<Employee>
<Emp_Id> 11032 </Emp_Id>
<Emp_Name> Geetha </Emp_Name>
<Emp_E-mail>[email protected] </Emp_E-mail>
</Employee>

Computer Science Engineering Department 46 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

<Employee>
<Emp_Id> 11022 </Emp_Id>
<Emp_Name> sumalatha</Emp_Name>
<Emp_E-mail> [email protected] </Emp_E-mail>
</Employee>
<Employee>
<Emp_Id> 11011 </Emp_Id>
<Emp_Name> Lakshmanan </Emp_Name>
<Emp_E-mail> [email protected] </Emp_E-mail>
</Employee>
</Employee-Detail>

Input document has 3 Employee elements


• Advantage:
It is good when random access to widely separated parts of a document is
required
It supports both read and write operations
• Disadvantage:
It is memory inefficient
It seems complicated, although not really

3. Explain detail about Parsing XML Using Document Object Model.[ CO1 – L2 -
Nov/Dec 2016]
The Document Object Model (DOM)
provides a way of representing an XML document in memory so that it can be
manipulated by your software.
DOM is a standard application programming interface (API) that makes it easy for
programmers to access elements and delete, add, or edit content and attributes.

What DOM Is Not


DOM is not a mechanism for persisting, or storing, objects as XML documents. Think of
it the other way: DOM is an object model for representing XML documents in your code.
DOM is not a set of data structures; rather it is an object model describing XML
documents.
DOM does not specify what information in a document is relevant or how information
should be structured.
DOM has nothing to do with COM, CORBA, or other technologies that include the words
objectmodel.

Computer Science Engineering Department 47 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

Why Do I Need DOM?


The main reason for using DOM is to create or modify an XML document
programmatically.
To create a document, first start by creating a root element and then add attributes,
content, sub-elements, and so on. Finally write the document out to disk or send it over
a network.
The representation in memory is a tree structure that starts with a root element that
contains attributes, content, and sub-elements.
Traverse this tree, search for a specific node, and change its attributes or data. Also
add attributes or elements anywhere in the tree, as long as you don‗t violate the rules of
a well formed document. Finally write the modified document back out to disk or to the
network.
It is possible to process XML documents using other, simpler techniques, such XSLT.
The problem is that XSLT is not always expressive enough to solve complex problems.
Disadvantages of Using DOM
 One of the big issues is that DOM can be memory intensive.
 A large document will require a large amount of memory to represent it.
 Other parsing methods, such as SAX, don‗t read in the entire document, so they
are better in terms of memory efficiency for some applications.
 The DOM API is too complex.

DOM Levels
The DOM working group works on phases (or levels) of the specification.
Level 1:
Allows traversal of an XML document as well as the manipulation of the content in that
document.
Level 2 :
Extends Level 1 with additional features such as namespace support, events, ranges,
and so on.
Level 3:
it is currently a working draft. This means that it is under active development and
subject to change.
DOM Core
The DOM core is available in DOM Level 1 and beyond. It permits to create and
manipulate XML documents in memory. DOM is a tree structure that represents
elements, attributes, and content.

Simple XML Document

Computer Science Engineering Department 48 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

<purchase-order>
<customer>James Bond</customer>
<merchant>Spic</merhant>
<items>
<item>Night vision camera</item>
<item>Vibrating massager</item>
</items>
</purchase-order>

Tree structure
Parents, Children, and Siblings
The DOM specification uses the words parents, children, and siblings to represent
nodes and their relationships to one another.
Parent nodes may have zero or more child nodes.
Parent nodes themselves may be the child nodes of another parent node. The ultimate
parent of all nodes is, of course, the root node.
Siblings represent the child nodes of the same parent. These abstract descriptions of
nodes are mapped to elements, attributes, text, and other information in an XML
document.

DOM interfaces contain methods for obtaining the parent, children, and siblings of any
node
The root node has no parent, and there will be nodes that have no children or siblings.
DOM Interfaces
The DOM interfaces are defined in IDL so that they are language neutral.

SimpleWalker.java
package com.madhu.xml;
import java.io.*;
import org.w3c.dom.*;
import javax.xml.parsers.*;
public class SimpleWalker {
protected DocumentBuilder docBuilder;
protected Element root;
public SimpleWalker() throws Exception {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
docBuilder = dbf.newDocumentBuilder();
DOMImplementation domImp = docBuilder.getDOMImplementation(); if
(domImp.hasFeature(―XML‖, ―2.0‖))

Computer Science Engineering Department 49 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

{
System.out.println(―Parser supports extended interfaces‖);
}
}
public void parse(String fileName) throws Exception {
Document doc = docBuilder.parse(new FileInputStream(fileName));
root = doc.getDocumentElement();
System.out.println(―Root element is ― + root.getNodeName());
}
public void printAllElements() throws Exception { printElement(―‖, root);
}
public void printElement(String indent, Node aNode)
{
System.out.println(indent + ―<‖ + aNode.getNodeName() + ―>‖);
Node child = aNode.getFirstChild(); while (child != null) {
printElement(indent + ―\t‖, child); child = child.getNextSibling();
}
System.out.println(indent + ―</‖ + aNode.getNodeName() + ―>‖);
}
public static void main(String args[]) throws Exception
{
SimpleWalker sw = new SimpleWalker(); sw.parse(args[0]);
sw.printAllElements();
}
}

Output from SimpleWalker


Parser supports extended interfaces
Root element is library
<library>
<#text>
</#text>
<fiction>
<#text>
</#tex>
<book>
<#text>
</#text>
</book>

Computer Science Engineering Department 50 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

<#text>
</#text>
<book>
<#text>
</#text>
</book>
<#text>

</#text>
</fiction>
<#text>
</#text>
<biography>
<#text>
</#text>
<book>
<#text>
</#text>
</book>
<#text>
</#text>
</biography>
<#text>
</#text>
</library>

Modified printElement() Method


public void printElement(String indent, Node aNode) {
if (aNode.getNodeType() == Node.TEXT_NODE)
{
System.out.println(indent + aNode.getNodeValue());
} else {
System.out.println(indent + ―<‖ + aNode.getNodeName() + ―>‖);
Node child = aNode.getFirstChild(); while (child != null) {
printElement(indent + ―\t‖, child); child = child.getNextSibling();
}
System.out.println(indent + ―</‖ + aNode.getNodeName() + ―>‖);
}
}

Computer Science Engineering Department 51 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

Output After print Element() Modification


Parser supports extended interfaces Root element is library
<library>
<fiction>
<book>
Moby Dick </book>
<book>
The Last Trail </book>
</fiction>
<biography>
<book>
The Last Lion, Winston Spencer Churchill </book>
</biography>
</library>

4. Explain in detail about Parsing XML Using SAX.[ CO1 – L2 - Nov/Dec 2016]
SAX is an API that can be used to parse XML documents.
A parser is a program that reads data a character at a time and returns manageable
pieces of data.
SAX provides a framework for defining event listeners, or handlers. These handlers are
written by developers interested in parsing documents with a known structure.
The handlers are registered with the SAX framework in order to receive events. Events
can include start of document, start of element, end of element, and so on. The
handlers contain a number of methods that will be called in response to these events.

What SAX Is Not


SAX by itself is just an API, and a number of implementations are available from many
of the familiar sources..
SAX was originally developed in Java, but similar implementations are available in other
languages as well.

Why Do I Need SAX?


SAX is completely free, so it can be embedded in a larger application without royalty
fees or even copyright notices. Some SAX parsers can validate a document against a
Document Type Definition (DTD).
Validating parsers can also tell you specifically where validation has failed.

Computer Science Engineering Department 52 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

SAX vs. DOM


DOM is an in-memory tree structure of an XML document or document fragment. DOM
is a natural object model of an XML document, but it‗s not always practical. Large
documents can take up a lot of memory.
SAX is, in many ways, much simpler than DOM. There is no need to model every
possible type of object that can be found in an XML document. This makes the API easy
to understand and easier to use.
DOM contains many interfaces, each containing many methods. SAX is comprised of a
handful of classes and interfaces. SAX is a much lower level API when compared with
DOM. For these reasons, SAX parsers tend to be smaller than DOM implementations.
SAX is an event-based API. SAX parsers send events continuously, telling what was
found next.
The DOM parses XML in space, whereas SAX parses XML in time.
SAX can be significantly more efficient for large documents.
SAX can also be faster.

Disadvantages
SAX parsing is ―single pass,‖ so can‗t back up to an earlier part of the document any
more than you can back up from a serial data stream. No random access at all.
Handling Parent/child relationships can be more challenging as well.
The current SAX implementations are read-only parsers.
They do not provide the ability to manipulate a document or its structure.
There is no way to validate a SAX parser or to determine whether it works correctly.

Advantages:
 lightweight
 simple
 Easy to use.

SAX Versions
The first version, SAX 1.0, was released in May 1998. It provided the basic functionality
needed to read elements, attributes, text, and to manage errors.
The current version, SAX 2.0, was released two years later in May 2000. Many of the
SAX 2.0 interfaces are departures from SAX 1.0. Older interfaces are included, but
deprecated, for backward compatibility.

Computer Science Engineering Department 53 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

SAX Basics
<?xml version=‖1.0‖ encoding=‖UTF-8‖?>
<fiction>
<book author=‖Herman Melville‖>Moby Dick</book>
</fiction>
Parse this document using SAX, you would build a content handler by creating a Java
class that implements the Content Handler interface in the org.xml.sax package.

SAX Packages
The SAX 2.0 API is comprised of two standard packages and one extension package.
The two standard packages are,
org.xml.sax - It contains the basic classes, interfaces, and exceptions needed for
parsing documents.
org.xml.helpers - It contains additional classes that can simplify some of coding and
make it more portable.
The one extension package is,
org.xml.sax.ext- It is an extension that is not shipped with all implementations. It
contains two handler interfaces for capturing declaration and lexical events.

5 Explain how XSLT transforms the document from one word type to other.[ CO1
– L2 – Nov/Dec 2016]
XSL
XSL is a language that allows one to describe a browser how to process an XML file.
XSL can convert an XML file into another XML with different format.
XSL can convert an XML file into a non-XML file.
XSL consists of three languages:
XSLT (XSL Transformations) is a language used to transform XML documents into
other kinds of documents (most commonly HTML, so they can be displayed)XPath is a
language to select parts of an XML document to transform with XSLT
XSL-FO (XSL Formatting Objects) is a replacement for CSS
There are no current implementations of XSL-FO.
A style sheet stores formatting options for a document, usually separately from
document o E.g. an HTML style sheet may specify font colors and sizes for headings,
etc.
The XML Style sheet Language (XSL) was originally designed for generating HTML
from XML
XSLT is a general-purpose transformation language
Can translate XML to XML, and XML to HTML

Computer Science Engineering Department 54 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

XSLT transformations are expressed using rules called templates


Templates combine selection using XPath with construction of results

How does it work?


The XML source document is parsed into an XML source tree
You use XPath to define templates that match parts of the source tree
You use XSLT to transform the matched part and put the transformed information into
the result tree
The result tree is output as a result document
Parts of the source document that are not matched by a template are typically copied
unchanged

XSLT templates
<xsl:template match=―/bank-2/customer‖>
<xsl:value-of select=―customer_name‖/>
</xsl:template>
<xsl:template match=―*‖/>
The match attribute of xsl:template specifies a pattern in XPath Elements in the XML
document matching the pattern are processed by the actions within the xsl:template
element xsl:value-of selects (outputs) specified values (here, customer_name) For
elements that do not match any template
Attributes and text contents are output as is Templates are recursively applied on sub
elements
The <xsl:template match=―*‖/> template matches all elements that do not match any
other template Used to ensure that their contents do not get output.
If an element matches several templates, only one is used based on a complex priority
scheme/user-defined priorities

6.Write XSLT code to display employee details in a table form which is stored is
XML. [ CO1 – L2]
Program1- empdetail.xsl
<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" indent="yes"/>
<xsl:template match="Employee-Detail">
<html>
<head>
<title>XSLT Style Sheet</title>

Computer Science Engineering Department 55 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

</head>
<body>
<h1>
<p align="center">Employee Details</p>
</h1>
<table border="2" width="50%" align="center">
<tr>bgcolor="LIGHTBLUE">
<th>Emp_Id</th>
<th>Emp_Name</th>
<th>Emp_E-mail</th>
</tr>
<xsl:for-each select="Employee"><tr>
<td>
<i>
<xsl:value-of select="Emp_Id"/>
</i>
</td><td>
<xsl:value-of select="Emp_Name"/>
</td>
<td><xsl:value-of select="Emp_E-mail"/></td>
</tr></xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

Program 2 - employee.xml
<?xml version = "1.0" ?>
<?xml-stylesheet href="empdetail.xsl" type="text/xsl"?>
<Employee-Detail>
<Employee>
<Emp_Id> 11032 </Emp_Id>
<Emp_Name> Geetha </Emp_Name>
<Emp_E-mail>[email protected] </Emp_E-mail>
</Employee>

<Employee>
<Emp_Id> 11022 </Emp_Id>

Computer Science Engineering Department 56 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

<Emp_Name> sumalatha</Emp_Name>
<Emp_E-mail> [email protected] </Emp_E-mail>
</Employee>
<Employee>
<Emp_Id> 11011 </Emp_Id>
<Emp_Name> Lakshmanan </Emp_Name>
<Emp_E-mail> [email protected] </Emp_E-mail>
</Employee>
</Employee-Deta>

7.Explain in detail about XSL Formatting Objects.[ CO1 – L2]


The XSL technology is also composed of XSL Formatting Objects (XSL-FO). XSL-FO
was designed to assist with the printing and displaying of XML data. The main emphasis
is on the document layout and structure. This includes the dimensions of the output
document, including page headers, footers, and margins.
XSL-FO also allows the developer to define the formatting rules for the content, such as
font style, color, and positioning. XSL-FO is a sophisticated version of Cascading Style
Sheets (CSS).

XSL-FO Formatting Engines


The XSL-FO formatting engines implement a subset of the XSL-FO specification.
Engines are available that allow you to experiment with the basic features of XSL-FO.
The Apache XSL-FOP formatter to convert the document to a PDF file.
Apache XSL-FOP generating PDF documents.
The following code snippet shows the basic document setup for XSL-FO:
<?xml version=‖1.0‖ encoding=‖utf-8‖?>
<fo:root xmlns:fo=‖http://www.w3.org/1999/XSL/Format‖>
<!-- layout master set -->
<!-- page masters: size and layout --><!-- page sequences and content -->
</fo:root>
The element <fo:root> is the root element for the XSL-FO document.

An XSL-FO document can contain the following components:


Page master
Page master set
Page sequences
Page Master:
<fo:page-master>

Computer Science Engineering Department 57 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

The page master describes the page size and layout.


The <fo:simple-page-master> element defines the layout of a page.
<fo:simple-page-master master-name=‖simple‖ page-height=‖11in‖ page-width=‖8.5in‖
margin-top=‖1in‖ margin-bottom=‖1in‖ margin-left=‖1.25in‖ margin-right=‖1.25in‖>
</fo:simple-page-master>

Components of the page master


The attributes for <fo:simple-page-master> define the height and width of the page,
along with the size of the margins. Each page is divided into five regions. Regions serve
as containers for the document content.

Five regions of a page.


The size of the regions using the following elements:
 <fo:region-before>
 <fo:region-after>
 <fo:region-body>
 <fo:region-start>
 <fo:region-end>
The region-before and region-after areas are commonly used for page headers and
footers. The region-body area is the center of the page and contains the main content.
The region-start and region-end sections are commonly used for left and right sidebars,
respectively.
Page Master Set: <fo:page-master-set>
A document can be composed of multiple pages, each with its own dimensions. The
page master set refers to the collection of page masters.
<fo:layout-master-set>
<fo:simple-page-master master-name=‖simple‖ page-height=‖11in‖ page-width=‖8.5in‖
margin-top=‖1in‖ margin-bottom=‖1in‖ margin-left=‖1.25in‖ margin-right=‖1.25in‖>
<fo:region-body margin-top=‖0.5in‖/>
<fo:region-before extent=‖3cm‖/>
<fo:region-after extent=‖1.5cm‖/>
</fo:simple-page-master></fo:layout-master-set
Page Sequences: <fo:page-sequence> A page sequence defines a series of printed
pages. Each page sequence refers to a page master for its dimensions.The page
sequence contains the actual content for the document. The <fo:page-sequence>
element contains <fo:static-content> and <fo:flow> elements. The <fo:static-content>
element is used for page headers and footers.

Computer Science Engineering Department 58 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

The <fo:flow> element contains a collection of text blocks. The <fo:flow> element is
similar to a collection of paragraphs. A body of text is defined using the <fo:block>
element.
The <fo:block> element is a child element of <fo:flow>
<!-- page sequences and content --><fo:page-sequence master-name=‖simple‖>
<fo:flow flow-name=‖xsl-region-body‖>
<!-- this defines a level 1 heading with orange background --><fo:block font-size=‖18pt‖
font-family=‖sans-serif‖ line-height=‖24pt‖ space-after.optimum=‖15pt‖ background-
color=‖orange‖ color=‖white‖ text-align=‖center‖ padding-top=‖3pt‖>
Ez Books Online </fo:block>
<!-- Paragraph that contains info about the company --><fo:block font-size=‖12pt‖
font-family=‖sans-serif‖ line-height=‖15pt‖ space-after.optimum=‖14pt‖ text-
align=‖justify‖>

Welcome to Ez Books Online, the world‗s smallest online book store.


Our company‗s mission is to sell books on Java, Thrillers and Romance.
We have something for everyone...so we think. Feel free to browse our catalog and if
you find a book of interest then send us an e-mail. Thanks for visiting!

</fo:block>
</fo:flow></fo:page-sequence>
Generating a PDF Document
Follow these steps to generate a PDF document from simple.fo:
Open an MS-DOS window.
 Move to the directory <install_dir>\ch9_xsl\xsl_fo\.
 Set up the Java classpath by typing setpaths.
 Execute Apache-FOP by typing fop simple.fo simple.pdf.
The Apache-FOP formatter now reads the input file simple.fo and generates the output
file simple.pdf.
View the simple.pdf file in Adobe Acrobat Reader.
Page Headers and Footers
The <fo:static-content> element defines content that should appear on every page.The
<fo:static-content> element is commonly used to set up page headers and footers. The
<fo:static-content> element is a component of <fo:page-sequence>. The header is
defined using the following code fragment: <fo:static-content flow-name=‖xsl-region-
before‖> <fo:block text-align=‖end‖ font-size=‖10pt‖ font-family=‖serif‖ line-
height=‖14pt‖ >
Ez Books Catalog - page <fo:page-number/></fo:block>

Computer Science Engineering Department 59 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

</fo:static-content>
The footer is defined using the following code fragment:
<!-- footer -->
<fo:static-content flow-name=‖xsl-region-after‖>
<fo:block text-align=‖center‖ font-size=‖10pt‖ font-family=‖serif‖ line-height=‖14pt‖ >
Visit our website http://www.ezbooks.web </fo:block>
</fo:static-content>
Graphics
XSL-FO also allows for the insertion of external graphic images. The graphic formats
supported are dependent on the XSL-FO formatting engine. The Apache-FOP
formatting engine supports the
popular graphics formats: GIF, JPEG, and BMP.
The following code fragment inserts the image smiley.jpg:
<fo:block text-align=‖center‖>
<fo:external-graphic src=‖smiley.jpg‖ width=‖200px‖ height=‖200px‖/>
</fo:block>

Inserting a graphic image in a PDF document.


Tables
XSL-FO has rich support for structuring tabular data. In fact, there are many similarities
between HTML tables and XSL-FO tables.
The following code fragment defines the basic structure of the table:
<fo:table>
<!-- define column widths --><
fo:table-column column-width=‖120pt‖/>
<fo:table-column column-width=‖200pt‖/>
<fo:table-column column-width=‖80pt‖/>
<fo:table-header>
<fo:table-row>
<fo:table-cell>
<fo:block font-weight=‖bold‖>Author</fo:block>
</fo:table-cell><fo:table-cell>
<fo:block font-weight=‖bold‖>Title</fo:block>
</fo:table-cell><fo:table-cell>
<fo:block font-weight=‖bold‖>Price (USD)</fo:block>
</fo:table-cell></fo:table-row>
</fo:table-header>
<!-- insert table body and rows here -->
</fo:table>

Computer Science Engineering Department 60 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

Generating XSL-FO Tables Using XSLT


Generating XSL-FO tables with XSLT.
Generating a PDF Document
1.Open an MS-DOS window.
2.Move to the directory <install_dir>\ch9_xsl\xsl_fo\dynamic\table.
3.Set up the Java classpath by typing setpaths.
4.Execute Apache-FOP by typing the following: fop -xml booklist.xml -xsl
booklist_table.xsldyntable.pdf
5.View the dyntable.pdf file in Adobe Acrobat Reader.
Web Application Integration: Java Servlets, XSLT, and XSL-FO
6.A Web application that integrates Java servlets, XSLT, and XSL-FO. Develop a Java
servlet to pass an XML document and XSL style sheet to the Apache-FOP formatting
engine.
7.The XML document
8.itis booklist.xml. The XSL style sheet, booklist_table.xsl, contains the XSL-FO
template code to generate a table. The servlet will respond with the PDF document
generated by the Apache-FOP formatting engine.
9.Web application integration: Java servlets, XSLT, and XSL-FO.
8.Describe in detail about Modeling Databases in XML
Model a database; provide an external representation of the database contents. A
sample program, utilize a database that contains information on rental properties. Model
the rental property database as an XML document. Figure shows the desired output.
Desired output for rental properties
In the JAXB framework, we can parse XML documents into a suitable Java object. This
technique is referred to as unmarshaling.
JAXB marshaling and unmarshaling.
JAXB is easier to use and a more efficient technique for processing XML documents
than the SAX or DOM API.
JAXB Solution
It takes the JAXB binding schema and generate the appropriate Java classes.
1. Review the database schema.
2. Construct the desired XML document.
3. Define a schema for the XML document.
4. Create the JAXB binding schema.
5. Generate the JAXB classes based on the schema.
6. Develop a Data Access Object (DAO).
7. Develop a servlet for HTTP access.

Computer Science Engineering Department 61 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

Unit – III
Service Oriented Architecture
Part – A

1.What is architecture?.[ CO3 - L1 - Nov/Dec 2013]


Architecture refers a systematic arrangement of computerized automation technological
solutions.
It is to an application development team, a blueprint to the team of construction workers.
Different organizations document different levels of application architecture.

2. Define Service-oriented architecture?.[ CO3 - L1 - Nov/Dec 2013]


SOA is a form of technology architecture that adheres to the principles of service-
orientation. When realized through the Web services technology platform, SOA
establishes the potential to support and promote these principles throughout the
business process and automation domains of an enterprise.

3. Define contemporary SOA.[ CO3 - L1 - Nov/Dec 2016]


Contemporary SOA represents an architecture that promotes service-orientation
through the use of web services.
Contemporary SOA is an extended variation of service-oriented architecture which
builds increasingly powerful XML and Web services support into current technology
platforms.

4.List out some characteristics of contemporary SOA.[ CO3 - L1 - Nov/Dec 2016]


Contemporary SOA is at the core of the services-oriented computing platform.
Contemporary SOA increase quality of service.
Contemporary SOA is fundamentally autonomous.
Contemporary SOA is based on open standards.
Contemporary SOA supports vendor diversity.
Contemporary SOA fosters intrinsic interoperability.
Contemporary SOA promotes discovery.
Contemporary SOA promotes federation.
Contemporary SOA promotes architectural compos ability.
Contemporary SOA fosters inherent reusability.

5.What are the benefits of SOA?.[ CO3 - L1]


Improved integration(and intrinsic interoperability)

Computer Science Engineering Department 62 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

Inherent reuse
Streamlined architectures and solutions
Leveraging the legacy investment
Establishing standardized XML data representation.
Focused investment on communications infrastructure
"Best-of-breed" alternatives
Organizational agility(Flexibility)

6.What are the common mistakes/pitfalls of adopting SOA?.[ CO3 - L1]


Building service –oriented architecture like traditional distributed architectures
Not standardizing SOA
Not creating a transition plan
Not starting with an XML foundation architecture
Not understanding SOA performance requirements
Not understanding web services security
Not keeping in touch with product platforms and standards development

7. What are the requirements is needed to fill QoS gaps between contemporary
and primitive SOA?.[ CO3 - L1]
In a secure manner
Reliably
With appropriate performance
Protecting business integrity
Executing exception logic in case of failure

8.What is autonomous principle and expand UDDI?.[ CO3 - L1]


Autonomous principle represents the ability of a service to carry out its logic
independently of outside influences.
UDDI stands for Universal Description Discovery and Integration.

9.List out the different levels of autonomy?.[ CO3 - L1]


Runtime autonomy- Run time autonomy represents the amount of control a
service has over its execution environment at runtime.

Computer Science Engineering Department 63 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

Design-time autonomy- Design-time autonomy represents the amount of governance


control a service owner has over the service design.

10.What are the design characteristics require facilitating interoperability in


contemporary SOA .[ CO3 - L1]
The designs characteristics require to facilitate interoperability are
Standardization
Scalability
Behavioral predictability
Reliability

11.List out some of the characteristics of the reusable services in SOA? [ CO3 -
L1]
Reusable services have the following characteristics:
Define by an unbelievable functional context
Logic is highly generic
Has a generic and extensible contract
Can be accessed concurrently

12.How is loosely coupling concept achieved in SOA? .[ CO3 - L1]


The loosely coupling concept is achieved by implementing standardized service
abstraction layers when service-orientation principles are applied to both business
modeling and technical design.

13. What is referred as organizational agility? .[ CO3 - L1]


Organizational Agility refers to efficiency with which an organization can respond to
change.

14. What is application architecture?.[ CO3 - L1 - May/June 2014]


Application architecture is a template for all others specifically explained the technology,
boundaries, rules, limitations, and design characteristics that apply to all solution based
on the template.Application architecture is to an application development team what a
blueprint is to a team of construction workers.
Different organizations document different levels of application architecture. Some keep
it high-level, providing abstract physical and logical representations of the technical
blueprint. Others include more detail, such as common data models, communication
flow diagrams, application-wide security requirements, and aspects of infrastructure.

15. What is Enterprise architecture? .[ CO3 - L1]

Computer Science Engineering Department 64 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

Enterprise architecture is a creation of master specification when numerous, disparate


and integrate application architectures exists within an organization.
An enterprise architecture specification is to an organization what an urban plan is to a
city.

16. What is single-tier client-server architecture? .[ CO3 - L1]


Single-tier client-server architecture is an environment in which bulky mainframe back-
ends server served the thin clients.

17.List out the primary characteristics of the two tier client server architecture?.[
CO3 - L1]
Application logic
Application processingTechnology
Security and Administration

18.What is multi-tier client-server architecture?.[ CO3 - L1]


Multi-tier architecture is a client-server architecture in which the
presentation, the application processing, and the data management are logically
separate processes.

19.List out the types of communication of mainframe systems?.[ CO3 – L1]


Synchronous communication- It allows the client and server to wait for each other to
transfer the message. That is, the client will not continue until the server has received
the message.Asynchronous communication- It allows the server to continuously receive
messages from the client without waiting for the server to respond.

20.List out the types of service autonomy.[ CO3 - L1 ]


Service level autonomy
Pure autonomy

21.What are the key benefits of service reuse? .[ CO3 - L1]


 Accommodate future requirements with less development effort.
 Reduce the need for creating wrapper services
 Reduction of cost by not just avoiding duplication of code
 Reducing risks by reusing well-tested code and runtime environments.

22.State separation of concerns.[ CO3 - L1]

Computer Science Engineering Department 65 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

It is an established software engineering theory based on the idea of breaking down a


large problem into a series of individual concerns.

23.What are the parts of automation logic? [ CO3 - L1 - May/Jun 2013]


The four identified parts of automation login
Messages=units of communication
Operations=units of work
Services=units of processing logic(collection of units of work
Processes=units of automation logic(coordinated aggregation of units of works)

24.What is the use of RPC?.[ CO3 - L1]


The remote procedure call (RPC) connections are used for
remotecommunication between components residing on client workstations and
servers.

25.Write down the advantages of RPC?.[ CO3 - L1]


Better load balancing: more evenly distributed processing
More scalable: only servers experiencing high demand need be upgraded.
Multiple concurrent requests are processed.

26.Write down the disadvantages of RPC? .[ CO3 - L1]


p Heavily loaded network
q More distributed processing necessitates more data exchange
r Difficult to program and test due to increased complexity

27.What are the proprietary communication protocols promotes by distributed


internet architecture for usage? .[ CO3 - L1 - Nov/Dec 2014]
DCOM – Distributed Component Object Model
CORBA – Common object request broker architecture

28. What’s the difference between services and components? .[ CO3 - L1]
Services are logical grouping of components to achieve business functionality.
Components are implementation approaches to make a service.

29.What is meant by Entity-centric business service?.[ CO3 - L1]


Entity-centric business service is a service that encapsulates a specific business entity
(such as an invoice or timesheet). Entity-centric services are useful for creating highly
reusable and business process-agnostic services that are composed by an

Computer Science Engineering Department 66 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

orchestration layer or by a service layer consisting of task-centric business services (or


both).

30.Define Coarse-Grained Services.[ CO3 - L1 - Nov/Dec 2012]


A service-based system controls the network access to the objects within the service
through a set of coarse-grained interfaces.
A service may still be implemented as a set of fine-grained objects, but the objects
themselves are not accessible over a network connection. A service implemented as
objects has one or more coarse-grained objects that act as distributed look.

31.Define XSD?.[ CO3 - L1]


SOA services communicate with messages formally defined via XML Schema
Communication among consumers and providers or services typically happens in
heterogeneous environments, with little or no knowledge about the provider.
Messages between services can be viewed as key business documents processed in
an enterprise.

32.What do you mean by Quality of Service? .[ CO3 - L1]


Each SOA Services have QOS the key QoS elements are security requirements, such
as authentication and authorization, reliable messaging, and policies regarding who can
invoke services.

33.Define Service Proxy? .[ CO3 - L1]


The service provider supplies a service proxy to the service consumer.
The service consumer executes the request by calling an API function on the proxy. It
then formats the request message and executes the request on behalf of the consumer.

34.List the Principles of service orientation.[ CO3 - L1 - Nov/Dec 2014]


Services are reusable
Services share a formal contract
Services are loosely coupled
Services abstract underlying logic
Services are compos able
Services are autonomous
Services are stateless
Services are discoverable

35.Define Service-Orientation and Interoperability.[ CO3 - L1]

Computer Science Engineering Department 67 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

Service-oriented computing, is that services must be interoperable. Each of the eight


SOA principles supports or contributes to interoperability in some man

36.Define service loose coupling.[ CO3 - L1]


The Service Loose Coupling promotes the independent design and evolution of a
service‘s logic and implementation while still guaranteeing baseline interoperability with
consumers that have come to rely on the service‘s capabilities.

37.What are the logical components of web service frameworks?.[ CO3 - L1 -


May/June 2012]
Web Services
Web Service operations
SOAP Messages
Activities.

38.How Contemporary SOA characteristics are influenced by services


specifications and service oriented principles?.[ CO3 - L1 - May/June 2012]
Fundamentally autonomous
QoS capable
Architecturally composable
Vendor diversity
Intrinsic interoperability
Discoverability
Promotes federation
Inherent reusability

39.What are all the Unsupported SOA characteristics?.[ CO3 - L1]


intrinsic interoperability
extensibility
enterprise-wide loose coupling
service-oriented business modeling
organizational agility
layers of abstraction
40.What is meant by task centric business service? .[ CO3 - L1]
Task-centric business service is a service that encapsulates business logic specific to a
task or business process. This type of service generally is required when business

Computer Science Engineering Department 68 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

process logic is not centralized as part of an orchestration layer. Task-centric business


services have limited reuse potential.

PART-B

1. Write briefly on Characteristics of Contemporary SOA.[ CO1 - L1 - MAY/JUNE


2012]
Definition of SOA:
Contemporary SOA represents an open, agile, extensible, federated, compostable
architecture comprised of autonomous, QoS-capable, vendor diverse, interoperable,
discoverable, and potentially reusable services, implemented as Web services.

Common characteristics of Contemporary SOA


 Contemporary SOA increase quality of service.
 Contemporary SOA is fundamentally autonomous.
 Contemporary SOA is based on open standards.
 Contemporary SOA supports vendor diversity.
 Contemporary SOA fosters intrinsic interoperability.
 Contemporary SOA promotes discovery.
 Contemporary SOA promotes federation.
 Contemporary SOA promotes architectural composability.
 Contemporary SOA fosters inherent reusability.
 Contemporary SOA emphasizes extensibility.
 Contemporary SOA supports a service-oriented business modeling paradigm.
 Contemporary SOA implements layers of abstraction.
 Contemporary SOA promotes loose coupling throughout the enterprise.
 Contemporary SOA Promotes organizational agility.
 Contemporary SOA is a building block.
 Contemporary SOA is an evolution.

A.Contemporary SOA is at the core of the services-oriented computing platform:


When a product, design, or technology is prefixed with ―SOA‖ it is something that was
created in support of an architecture based on service-orientation principles.
Contemporary SOA represents an architecture that promotes service-orientation
through the use of Web services

Computer Science Engineering Department 69 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

B. Contemporary SOA increase quality of service:


Contemporary SOA is striving to fill the QoS gaps of the primitive SOA model
with the following requirements,
 In a secure manner
 Reliably
 With appropriate performance
 Protecting business integrity
 Executing exception logic in case of failure.
C. Contemporary SOA is fundamentally autonomous:
Autonomous principle:
 Represents the ability of a service to carry out its logic independently of outside
influences.
 Message-level autonomy- Messages are ―intelligence-heavy‖ and control the way
they are processed by recipients
 Autonomy concept is expanded to solution environment and the enterprise i.e.
applications.
Levels of autonomy
Runtime autonomy-represents the amount of control a service has over its execution
environment at runtime.
Design-time autonomy- represents the amount of governance control a service owner
has over the service design.
Primary benefits
Increased reliability
Behavioral predictability
D. Contemporary SOA is based on open standards:
Based on open standards, messages travel between services via a set of protocols that
is globally standardized and accepted Messages format is standardized, too.
SOAP, WSDL, XML, and XML schema allow messages to be fully self-contained For
services to communicate, they only need to know of each other‘s service description.
This supports loose-coupling. Standard open technologies are used within and outside
of solution boundaries.
E. Contemporary SOA supports vendor diversity:
The communications framework bridges the heterogeneity within and between
corporations Integration technologies encapsulate legacy logic through service
adapters. Platform neutral communication such as .NET solution J2EE solution.
F. Contemporary SOA fosters intrinsic interoperability:
The design characteristics required to facilitate interoperability are
 Standardization

Computer Science Engineering Department 70 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

 Scalability
 Behavioral predictability
 Reliability
G. Contemporary SOA promotes discovery:
Universal description discovers and integration(UDDI) provided for service
registries.Some SOA systems used UDDI service registry or directory to manage
service descriptions.
 Services are supplemented with communication meta data by which they can be
effectively discovered and interpreted.
 Store Meta data in a service registry or profile documents
H. Contemporary SOA promotes federation:
Establishing and standardizing the ability to encapsulate legacy and non-legacy
application logic and by exposing it via an open, common standard communications
framework. Communication channels are all uniform and standardized. Services enable
standardized federation of disparate legacy systems.
I. Contemporary SOA promotes architectural composability:
Supports the automation of flexible, adaptable business process by composing loosely
coupled services. Flexible service contracts to allow different types of data exchange
requirements for similar functions
Services are effective composition participants, regardless of the size and complexity of
the composition. Ensures services are able to participate in multiple compositions to
solve multiple larger problems-related to reusability principle
Advantages
• Composite applications faster than writing a program from scratch. Building new
services and application becomes quicker and cheaper
J. Contemporary SOA fosters inherent reusability
Service-oriented design principles encourage reuse of software
Services can be composed into larger services which in turn can be reused
Services contain and express logic and can be positioned as reusable enterprise
resources
Reusable services have the following characteristics:
Defined by an agnostic functional context
Logic is highly generic
Has a generic and extensible contract
Can be accessed concurrently
K. Contemporary SOA emphasizes extensibility:
When encapsulating functionality through a service description, you are encouraged to
think beyond a point-to-point solution. Extensibility can be achieved less significantly
due to loosely coupled relationship fostered among all services.

Computer Science Engineering Department 71 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

L.Contemporary SOA implements layers of abstraction:


SOA introduce layers of abstraction by positioning services as the sole access points to
a Variety of resources and processing logic. The abstraction is targeted at business and
application logic and the functionality is offered via the service interfaces. Application
logic created with proprietary technology can be abstracted through a dedicated service
layer.
M. Contemporary SOA supports a service-oriented business modeling paradigm:
Partitioning business logic into services that can be composed has significant
implications as to how business processes can be modeled.
BPM models, entity models and other forms of business intelligence can be accurately
represented through coordinated composition of business-centric services.
A collection (layer) of services encapsulating business process logic.
N. Contemporary SOA promotes loose coupling throughout the enterprise:
The loose coupling concept is achieved by implementing standardized service
abstraction layers when service-orientation principles are applied to both business
modeling and technical design.
Each domain are allowed to evolve more independently which result in an better
accommodate business and technology-related change-quality environment known as
organizational agility.
Through the implementation of service layers that abstract business and application
logic, the loose coupling paradigm can be applied to the enterprise as a whole.
O. Contemporary SOA Promotes organizational agility:
Organizational agility refers to efficiency with which an organization can respond to
change. High dependency between parts of an enterprise means that changing
software is more complicated and expansive, leveraging service business
representation, service abstraction, and loose coupling promotes agility

P. Contemporary SOA is a building block:


Services are composed into larger services.Multiple SOA applications can be pulled into
service-oriented integration technologies to help build a service-oriented Enterprise
(SOE).An SOA consists of services within services, to the point that a solution based on
SOA itself is one of many services within an SOE.
Definition of SOA after applying the above characteristics:
SOA can establish an abstraction of business logic and technology, resulting in a loose
coupling between these domains‘. These changes foster service-orientation in support
of a service-oriented enterprise.
Q. Contemporary SOA is an evolution:

Computer Science Engineering Department 72 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

SOA is a distinct architecture from the previous. It is influenced by concepts in service-


orientation and web services Promotes reuse, encapsulation, componentization, and
distribution of application logic like previous technologies
R. Contemporary SOA is still maturing:
Standards organization and vendors are continuing to develop new SOA technologies.
They are extended to support the creation of enterprise SOA solutions.
S. Contemporary SOA is an achievable ideal:
Many organizations begin with a single application and then begin leveraging service
into other applications Changing to SOA requires cultural changes in an organization

2. Compare SOA with client-server and distributed internet architectures. .[ CO3 –


L2 - Nov/Dec 2016
1.SOA vs. client-server Architecture:
Client-server architecture is architecture in which one piece of software requests or
receives information from another. The industry term "client-server architecture"
generally refers to a particular generation of early environments during which the client
and the server played specific roles and had distinct implementation characteristics.
Client-server architecture:
Single-tier client-server architecture
Single-tier client-server architecture is an environment in which bulky mainframe back-
ends server served the thin clients.
Thin –client model:
In a thin client model, all of the application processing and data management is carried
out on the server. The client is simply responsible for running the presentation software
Types of communication:
Synchronous communication - Allow the client and server to wait for each other to
transfer the message. That is, the client will not continue until the server has received
the message.
Asynchronous communication- Allow the server to continuously receive message
from the client without waiting for the server to respond.
Disadvantage
Places a heavy processing load on both the server and the network.
2. Two-tier client-server architecture
Two-tier client-server architecture consists of multiple fat clients, each with its own
connection to a database o a central server.
Fat-client model:
 In fat-client model, the server is only responsible for data management.

Computer Science Engineering Department 73 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

The software on the client implements the application logic and the
interactions with the system user.
 Operation of Two-tier client-server architecture:
 The client accepts user requests and performs the bulk of application logic
that produces database requests and transmits them to the server.
 The server accepts the requests, performs the data access logic, and
transmits the results to the client.
 The client accepts the results and presents them to the end user.

Characteristics of Two-tier client-server architecture:


The primary characteristics of the two tier client server architecture is given below which
is compared to SOA
o Application logic
o Application architecture
o Technology
o Security
o Administration
Application logic:
Client Server Architecture - The application or business logic either resides on the client
or on the database server in the form of stored procedures.
SOA - The processing logic is partitioned into autonomous units which facilitate design
qualities, future compos ability and reusability.
Client server architecture
 Client is responsible for the bulk of processing
 80/20 ratio is used as a rule of thumb.
 Communication is predictably synchronous
 Client establish its own database connection-persistent
 Client –side executables are fully state ful
 Client is independently responsible for its actions; server doesn‘t track set of
clients or ensure that cached data stays up to date.
 Consume a steady chunk of PC memory
 All available resources are offered to the application
SOA:
 Processing in SOA is highly distributed.
 Communication between services and requestor can be synchronous or
asynchronous
SOA provides stateless and autonomous nature or services: Server tracks its client,
takes actions to keep their cached states ―current ―. Client can trust its cached data.

Computer Science Engineering Department 74 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

Further processing is made easier by reducing the need for runtime caching of state
information

3. Explain in detail about Benefits of SOA.[ CO3 – L2]


SOA can result in the creation of solutions that consist of inherently interoperable
services. Utilizing solutions based on interoperable services is part of service-oriented
integration (SOI) and results in service-oriented integration architecture.Because of the
vendor-neutral communications framework established by Web services-driven SOAs,
the potential is there for enterprises to implement highly standardized service
descriptions and message structures.

The net result is intrinsic interoperability, which turns a cross-application integration


project into less of a custom development effort, and more of a modeling exercise. The
bottom line: The cost and effort of cross-application integration is significantly lowered
when applications being integrated are SOA-compliant.

Inherent reuse
Service-orientation promotes the design of services that are inherently reusable.
Designing services to support reuse from the get-go opens the door to increased
opportunities for leveraging existing automation logic.
The bottom line: Building services to be inherently reusable results in a moderately
increased development effort and requires the use of design standards. Subsequently
leveraging reuse within services lowers the cost and effort of building service-oriented
solutions.

Streamline architectures and solutions


The aspect of service-oriented architecture can lead to highly optimized automation
environments, where only the technologies required actually become part of the
architecture.
The bottom line: Realizing this benefit requires adherence to design standards that
govern allowable extensions within each application environment. Benefits of
streamlined solutions and architectures include the potential for reduced processing
overhead and reduced skill-set requirements (because technical resources require only
the knowledge of a given application, service, or service extension).

Leveraging the legacy investment


The bottom line: The cost and effort of integrating legacy and contemporary solutions is
lowered. The need for legacy systems to be replaced is potentially lessened.

Computer Science Engineering Department 75 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

Establishing standardized XML data representation


An adoption of SOA leads to the opportunity to fully leverage the XML data
representation platform. A standardized data representation format (once fully
established) can reduce the underlying complexity of all affected application
environments.
XML documents and accompanying XML Schemas (packaged within SOAP messages)
passed between applications or application components fully standardize format and
typing of all data communicated. The result is a predictable and therefore easily
extensible and adaptable communications network.
 The bottom line: The cost and effort of application development is reduced after a
proliferation of standardized XML data representation is achieved.
 Web services establish a common communications framework; SOA can
centralize inter-application and intra-application communication as part of
standard IT infrastructure. This allows organizations to evolve enterprise-wide
infrastructure by investing in a single technology set responsible for
communication.
 The bottom line: The cost of scaling communications infrastructure is reduced, as
only one communications technology is required to support the federated part of
the enterprise.
 IT departments are frequently required to push back and limit or even reject
requests to alter or expand upon existing automation solutions.
 SOA won't solve these problems entirely, but it is expected to increase
empowerment of both business and IT communities. A key feature of service-
oriented enterprise environments is the support of "best-of-breed" technology.
 SOA establishes a vendor-neutral communications framework, it frees IT
departments from being chained to a single proprietary development and/or
middleware platform.
 The bottom line: The potential scope of business requirement fulfillment
increases, as does the qualityof business automation.

Organizational agility
 Agility is a quality inherent in just about any aspect of the enterprise. A simple
algorithm, a software component, a solution, a platform, a process all of these
parts contain a measure of agility related to how they are constructed,
positioned, and leveraged. How building blocks such as these can be realized
and maintained within existing financial and cultural constraints ultimately
determines the agility of the organization as a whole.
 The bottom line: The cost and effort to respond and adapt to business or
technology-related change isreduced.

Computer Science Engineering Department 76 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

4. Discuss in detail about the Common principles of service- orientation.[ CO3 –


L2 - May/June 2015]
A service-oriented architecture is an environment standardized according to the
principles of service-orientation in which a process that uses services (a service-
oriented process) can execute.

Separation of concerns:
―Separation of concerns‖ is an established software engineering theory based on the
idea of breaking down a large problem into a series of individual concerns.
Allows the logic required to solve the problem to be decomposed into a collection of
smaller, related pieces. Each piece of logic addresses a specific concern.
Implemented in different ways with different development platforms

Principles of Service orientation:


 Services are reusable
 Services share a formal contract
 Services are loosely coupled
 Services abstract underlying logic
 Services are compos able
 Services are autonomous
 Services are stateless
 Services are discoverable
(i). Services are reusable
Service reusability is a design principle that is used to create services (collection of
related operations) that have the potential to be reused across the enterprise resources.
The more generic a services operations are, the more reusable the service.
Messaging also supports service reusability through the use of SOAP headers.
Reusability includes,
 Inter-application interoperability
 Composition
 Creation of cross-cutting or utility services
Benefits
 Accommodate future requirements with less development effort.
 Reduce the need for creating wrapper services
 Reduction of cost by not just avoiding duplication of code
 Reducing risks by reusing well-tested code and runtime environments

Computer Science Engineering Department 77 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

(ii).Services share a formal contract:


Service contract provide a formal definition for all of the primary parts of an SOA
The service endpoint
Each service operation
Every input and output message supported by each operation
Rules and characteristics of the service and its operations
Benefits
Provide semantic information of how a service accomplishes a particular task.
Services express their purpose and capabilities via a service contract.
Shared among services-need careful maintenance and versioned

(iii).Services are loosely coupled:


Loose coupling is a condition wherein a service acquires knowledge of another services
while still remaining independent of that services.
It is achieved through the use of services contract that allow services to interact within
predefined
parameters
Note: service contracts impose low consumer coupling requirements and are
themselves decoupled from theirsurrounding environment.

(iv).Services abstract underlying logic:


Service interface-level abstraction is this principle that allows a service details are
hidden from the potential customers.
Service provides the following,
 Simple task to perform
 Gateway to an entire automation solution
 Represent limitless amount of logic
 Act as a container for the operations that abstract the logic
Benefits
Directly enables and preserves the previously described loosely coupled relationship.
(v). Services are composable:
o Services are effective composition participants, regardless of the size and
complexity of the composition. It is controlled by a parent process service
that compose process participants
o A service composition is an aggregate of services collectively composed
to automate a particular task or business process.
Benefits
Reusability

Computer Science Engineering Department 78 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

(vi). Services are autonomous:


Note: Does not necessarily grant a service exclusive ownership of the logic
encapsulates
Types of autonomy:
Service-level autonomy: Service boundaries are distinct from each other, but the service
may share underlying resources. It governs the legacy system but also shares
resources with other legacy clients.
Pure autonomy :When the underlying logic is built from the ground up in support of the
service which has complete control and ownership of that logic.

(vii). Services are stateless:


State refers to something‘s particular condition. They are two primary conditions can be
invoked:
Stateful : A Stateful services a service that is actively engaged in the process of
retaining or processing state information.
Stateless : A stateless service is a service whose response does not require access or
use of information
• Stateless services do scale better
• Promotes reusability and scalability
(viii). Services are discoverable:
In SOA level, discoverability refers to the architectures ability to provide a discovery
mechanism, such as a service registry or directory.
On a service level, the principle of discoverability refers to the design of an individual
service so that it can be as discoverable as possible.
Benefits
Avoids the accidental creation of redundant services or services that implement
redundant logic.

5. Explain about Service Layers in detail.[ CO3 – L2 - May/June 2015] ]


1. Service-orientation and contemporary SOA
The majority of Web services specifications are open and vendor neutral.QoS
capableThe quality of service improvements provided by contemporary SOA are, for the
most part, realized via vendor implementations of individual WS-extensions.

Architecturally composable While compos ability, on a service level, is one of our


service-orientation principles, for an architecture to be considered composable requires
that the technology from which the architecture is built support this notion. For the most
part, the specifications that comprise the WS-―landscape fully enable architectural

Computer Science Engineering Department 79 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

compos ability by allowing a given SOA to only implement extensions is actual requires.
Vendor diversity This is really more of a benefit of SOA than an actual characteristic.
Regardless, it is primarily realized through the use of the open standards provided by
the Webservices platform. Intrinsic interoperability.

The standardized communications framework provided by Web services establishes the


potential to foster limitless interoperability between services. This is no big secret. To
foster intrinsic interoperability among services,though,requires forethought and good
design standards. Although supported by a number of WS –specifications, this
characteristic is not directly enabled by our identified influences. discoverabilityService
level discoverability is one of our fundamental principles of service-orientation,
implementing discoverability on an SOA level typically requires the use of directory
technologies, such as UDDI (one of the first generation Web services specifications).

Promotes federation Federation is a state achieved by extending SOA into the realm of
service-oriented integration. A number of key WS- extensions provide features sets that
supports the attainment of federation. Most notable among these are the specifications
that implement the concepts of orchestration and choreography.Inherent
reusabilityReusability is one of the primary principles of service orientation and one that
can be applied across service oriented solution environments.

SOA promotes the creation of inherently reusable service logic within individual services
and across service design compositions benefit attainable through quality service
design extensibility Given that Web services are composable and based on open
standards,extensibility is a natural benefit of this platform. Several WS extensions
introduce architectural mechanisms that build extensibility into a solution. However, for
the most part, this is a characteristic that must be intentionally designed into services
individually and into SOA as a whole.

(i)Mapping the origins and supporting sources of concrete SOA Characteristics


(ii)Unsupported SOA characteristics
intrinsic interoperability
extensibility
enterprise-wide loose coupling
service-oriented business modeling
organizational agility
layers of abstraction
enterprise-wide loose coupling
support for service-oriented business modeling

Computer Science Engineering Department 80 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

organizational agility
layers of abstraction
The service layer is between the application layer and the business process layer

2. SERVICE LAYER ABSTRACTION:


The service layer is between the application layer and the business process layer
Problems solved by layering services:
(i) What logic should be represented by services?
Enterprise logic can be divided into two primary domains
Business logic
Application logic
(ii) How should services relate to existing application logic?
Existing legacy application logic needs to be exposed via services or whether new logic
is being developed in support of services number of constrains, limitations, and
environmental requirements
(iii) How can services best represent business process logic
When modeling service to represent business logic, the service representation of
business logic should be alignment with existing business models.
(iv) How can services be built and positioned to promote agility?
The key to building an agility SOA is in minimizing the dependencies each services has
within its own processing logic.
Layers of abstraction
Each layer can abstract a specific aspect of the solution, addressing to one of the
issues that are identified. The three layers of abstraction identified for SOA are:
• The application service layer
• The business service layer
• The orchestration service layer

3. APPLICATION SERVICE LAYER (NOV/DEC 2012)


The application service layer consists of application services that represent technology
specific logic. Typically incarnations of application services are the Utility models
Wrapper modelsIt consists of services that encapsulate some or all parts of a legacy
environment to expose legacy functionality to service requestors.
Characteristics
• Expose functionality within a specific processing context
• Draw upon available resources within a given platform
• Solution-agnostic
• Generic and reusable
• Achieve point-to-point integration with other application services

Computer Science Engineering Department 81 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

• Inconsistent in terms of the interface granularity they expose


• Mixture of custom-developed and third-party purchased services
Application integration services or simply integration services
Application integration services that exist solely to enable integration between system
often are referred to as application integration services or simply integration services. It
is implemented as controllers
Wrapper Services
Wrapper Services most often are utilized for integration purposes. They consist of
services that encapsulate ("wrap") some or all parts of a legacy environment to expose
legacy functionality to service requestors.
Proxy services
Proxy services, also known as an auto-generated WSDL, simply provide a WSDL
definition that mirrors an existing component interface.

4. BUSINESS SERVICE LAYER


The business service layer is comprised of business services, a direct implemented of
the business services model
Business services are ideally also controllers that compose application services to
execute their business logic
Types
Business service layer abstraction leads to the creation of two further business service
models:
Task-centric business service -A service encapsulation business logic specific to a task
or business process
Limited reusability
Entity centric business service
A service encapsulates a specific business entity ,Highly reusability- Even though hybrid
services contain both business and application logic, they are not classified as business
services.

5. ORCHESTRATION SERVICE LAYER


The orchestration service layer consists of one or more process services that compose
business and application services according to business rules and business logic
embedded within process definitions.
Orchestration abstracts business rules and services execution sequence logic from
other services, promoting agility and reusability.

6. AGNOSTIC SERVICES:

Computer Science Engineering Department 82 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

A key aspect of delivering reusable services is that they introduce service layers that
are not limited to a single process or solution environment.
Entity-centric business services are designed to provide a set of features that provide
data management related only to their corresponding entities. They are therefore
business process-agnostic. The same entity-centric business services can (and should)
be reused by different process or task-centric business services.
Application services ideally are built according to the utility service model. This makes
them highly generic, reusable, and very much solution-agnostic. Different service-
oriented solutions can (and should) reuse the same application services.

7. SERVICE LAYER CONFIGURATION SCENARIOS:


Types of services:
hybrid application services (services containing both business process and application
logic)
utility application services (services containing reusable application logic)
task-centric business services (services containing business process logic)
entity-centric business services (services containing entity business logic)
process services (services representing the orchestration service layer)

(i)Scenario #1: Hybrid application services only


When Web services simply are appended to existing distributed application
environments, or when a Web services-based solution is built without any emphasis on
reuse or service-oriented business modeling, the resulting architecture tends to consist
of a set of hybrid application services.
(ii)Scenario #2: Hybrid and utility application services
The hybrid services may compose some of the reusable application services. This
configuration achieves an extent of abstraction, as the utility services establish a
solution-agnostic application layer.
(iii) Scenario #3: Task-centric business services and utility application services
This approach results in a more coordinated level of abstraction, given that business
process logic is entirely represented by a layer of task-centric business services. These
services rely on a layer of application services for the execution of all their business
logic.
(iv) Scenario #4: Task-centric business services, entity-centric business services, and
utility application services
The task-centric services as parent controllers that may compose both entity-centric and
application services to carry out business process logic.
(v) Scenario #5: Process services, hybrid application services, and utility application
services

Computer Science Engineering Department 83 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

In this scenario, a parent process service composes available hybrid and application
services to automate a business process. This is a common configuration when adding
an orchestration layer over the top of an older distributed computing architecture that
uses Web services.
(vi) Scenario #6: Process services, task-centric business services, and utility application
services
Even though task-centric services also contain business process logic, a parent process
service can still be positioned to compose both task-centric and utility application
services. Though only partial abstraction is achieved via task-centric services, when
combined with the centralized business process logic represented by the process
services, business logic as a whole is still abstracted.
(vii) Scenario #7: Process services, task-centric business services, entity-centric
business services, and utility application services This variation also introduces entity-
centric business services, which can result in a configuration that actually consists of
four service layers. Sub-processes can be composed by strategically positioned task-
centric services, whereas the parent process is managed by the process service, which
composes both task-centric and entity-centric services.
(viii) Scenario #8: Process services, entity-centric business services, and utility
application services
The process service contains all business process-specific logic and executes this logic
through the involvement of available entity-centric business services, which, in turn,
compose utility application logic to carry out the required tasks.

Computer Science Engineering Department 84 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

Unit – IV
Web Services
Part – A
1.What is a web service? .[ CO2 - L1 - May/June 2015]
Definition 1:
A web service is used to implement architecture according to service-oriented
architecture (SOA)concepts. The basic unit of communication is a message.
Definition 2:
Web services are application components.
Web services communicate using open protocols.
Web services are self-contained and self-describing.
Web services can be discovered using UDDI .
Web services can be used by other applications XML is the basis for Web services.

2.What are the parts comprised in the web services framework? .[ CO2 - L1 ]
One or more architectures
Technologies
Concepts
Models
Sub-frameworks.

3.List out the characteristics of web services framework? .[ CO2 - L1]


1. An abstract existence defined by standards organizations and implemented by
technology platforms
2. Core building blocks that include web services, service descriptions, and
messages
3. A communications agreement centered around service descriptions based on
WSDL
4. A messaging framework comprised of SOAP technology and concepts
5. A service description registration and discovery architecture sometimes realized
through UDDI
6. A well-defined architecture that supports messaging patterns and compositions
7. A second generation of web services extensions continually broadening its
underlying feature-set.

4.Define service and List the fundamental roles of service? .[ CO2 - L1]

Computer Science Engineering Department 85 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

A service is a unit of software capable of altering its role, depending on its processing
responsibility in a given scenario.
• Service provider
• Service requestor
• Intermediaries
• Initial sender and ultimate receiver
• Service composition

5.What is the use of service provider? .[ CO2 - L1]


The service provider is used to identify the organization responsible for actually
providing the web service. It simply referred as the service being invoked.

6.What is service requestor? .[ CO2 - L1]


Service requestor is a processing logic unit capable of issuing a request message that
can be understood by the service provider.

7.What are referred to as intermediaries and list its types? .[ CO2 - L1]
Web services and service agent‘s route and process a message after it is initially sent
and before it arrives at its ultimate destination are referred to as intermediaries or
intermediary services
Passive intermediary
Active intermediary

8..What is initial sender and Ultimate receiver? CO2 - L1]


Initial senders are simply service requestors that initiate the transmission of a message.
It is the first web service in a message path. Ultimate receiver identifies service
providers that exist as the last web service along a messages path.

9. What is service composition? .[ CO2 - L1]


A service composition is a coordinated aggregate of services each is assigned with
service composition number to complete a given task. Service compositions also are
referred to as service assemblies.

10. What is referred as service models? .[ CO2 - L1]


Service models refer to permanent classification that represents the logic housed by the
service, as well as its role within the overall solution
11. List out the elements in the WSDL document structure.[ CO2 - L1]
Element defines
<types> the data types used by the web service

Computer Science Engineering Department 86 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

<message> the message used by the web service


<porttype> the operation performs by the web service
<binding> the communication protocols used by the web service
<service> the service location used by the web service

12.Define SOAP message.[ CO2 - L1 - Nov/Dec 2016]


A SOAP message is specified as an XML Information Set . While all SOAP message
examples in this document are shown using XML 1.0 syntax, other representations
MAY be used to transmit SOAP messages between nodes.

13.What is the use of SOAP? .[ CO2 - L1 - Nov/Dec 2014]


The simple object access protocol (SOAP) is used to define a standard message format
which is used for communication between services running on different operating
systems.

14.List out some of the characteristics of SOAP messaging framework?.[ CO2 -


L1 - May/June 2012]
SOAP messaging framework has the following three characteristics that is
Extensible
Interoperable
Independent

15.What are the parts of SOAP message? .[ CO2 - L1 May/June 2013]


SOAP message consists of three parts:
SOAP envelope
SOAP header
SOAP Body
SOAP Fault

16.List out messaging styles offered by SOAP.[ CO2 - L1 ]


RPC(Remote procedure call)
Document-style

17.Sketch the anatomy of a SOAP message.[ CO2 - L1]


<? Xml version=‖1.0‖?>
<soap:envelope Xmlns:soap=http://www.w3.org/2001/12/soap-envelope
Soap:encodingstyle=http://www/w3/org/2001/12/soap-encoding>
<soap:Header>
</soap:Header>

Computer Science Engineering Department 87 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

<soap:Body>
<soap:fault>
</soap:fault>
</soap:Body>
</soap:Envelope>

18.What is a SOAP node? .[ CO2 - L1]


The programs that services use to transmit and receive SOAP messages are referred to
as SOAP nodes.

19.List out the SOAP concepts.[ CO2 - L1]


SOAP sender
SOAP receiver
SOAP intermediary
Initial SOAP sender
Ultimate SOAP receiver

20.What is called the SOAP message path? .[ CO2 - L1]


The route taken by the message is called the SOAP message path. The set of SOAP
nodes through which the SOAP message passes, including the initial sender, the
ultimate receiver and one or more intermediaries, are called the SOAP message path.

21.What are the basic sets of common service models? .[ CO2 - L1]
Utility service model
Controller service model

22.What is business service model? .[ CO2 - L1]


The business service model is a model that encapsulates a distinct set of business logic
within a well-defined functional boundary. The business service model corresponds to
the business service layer in SOA abstraction layer.

23.List out some of the usage of business service model? .[ CO2 - L1]
Business services are used within SOAs as follows:
As fundamental building blocks for the representation of business logic
To represent a corporate entity or information set
To represent business process logic
As service composition members

24.What is utility service model? .[ CO2 - L1]

Computer Science Engineering Department 88 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

Utility service is generic and non-application specific web service or service agent that is
designed for potential reuse.
Example:
Utility services are used within SOAs as follows:
As services that enable the characteristics of reuse within SOA
As solution-agnostic intermediary services
As services that promote the intrinsic interoperability characteristics of SOA
As the services with the highest degree of autonomy.

25.What does controller service model represent? .[ CO2 - L1]


The controller service represents a service within a capability that is executing the
parent composition logic required to compose capabilities within other services. The
controller services can become subordinate service composition members.
Usage:
Controller services are used within SOAs as follows:
To support and implement the principle of compos ability
To leverage reuse opportunities
To support autonomy in other services

26. What are service descriptions and list its categories? .[ CO2 - L1]
A WSDL endpoint description explains how the service description document itself is
organized. It is also known as WSDL service definition or just WSDL definition.
Categories:
Service descriptions is divided into two categories
Abstract description
Concrete description

27.What does abstract description establish and list its parts? .[ CO2 - L1]
An abstract description establishes the interface characteristics of the web service
without any reference to the technology used to host or enable a web service to transmit
messages.

Parts:
The three mail parts that comprise an abstract description are
Port type
Operation
Message

Computer Science Engineering Department 89 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

28.What does port type in abstract description provide? .[ CO2 - L1]


Port type provides a high-level view of the service interface by sorting the messages a
service can process into groups of functions.

29. Define concrete description and What are the parts that comprise concrete
description?.[ CO2 - L1]
The concrete description portion of the WSDL file defines the connection needed from
the abstract web service interface to a physical transport protocol.
The three main parts that comprise concrete description are
Binding
Port
Service

30.List the Web services platform elements.[ CO2 - L1]


SOAP (Simple Object Access Protocol)
UDDI (Universal Description, Discovery and Integration)
WSDL (Web Services Description Language)

31.DefineWeb API.[ CO2 - L1]


Web API is a development in Web services (in a movement called Web 2.0) where
emphasis has been moving away from SOAP based services towards Representational
State Transfer (REST) based communications.[3] REST services do not require XML,
SOAP, or WSDL service-API definitions. Web APIs allow the combination of multiple

32. Define Subscribe-Push [CO2 - L1]


A third pattern for interaction is called Subscribe-Push. In this pattern, one or more
clients register subscriptions with a service to receive messages based on some
criteria.
Subscriptions may remain in effect over long periods before being canceled or revoked.
A subscription may, in some cases, also register another service endpoint to receive
notifications.

33. Define Data paging.[ CO2 - L1]


Some services automatically facilitate the paging of large data sets, enabling
developers to focus on core application business logic instead of worrying about basic
data management infrastructure.

34. Define Orchestration.[ CO2 - L1]

Computer Science Engineering Department 90 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

Refers to an executable business process that may interact with both internal and
external Web services. Orchestration describes how Web services can interact at the
message level, including the business logic and execution order of the interactions.
These interactions may span applications and/or organizations, and result in a long-
lived, transactional process. With orchestration, the process is always controlled from
the perspective of one of the business parties.

35. Define Choreography.[ CO3 - L1 - Nov/Dec 2016]


More collaborative in nature, where each party involved in the process describes the
part they play in the interaction. Choreography tracks the sequence of messages that
may involve multiple parties and multiple sources. It is associated with the public
message exchanges that occur between multiple Web services.

36. What are Wrapper Services? .[ CO2 - L1]


It consists of services that encapsulate some or all parts of a legacy environment to
expose legacy functionality to service requestors.

37. List out the characteristics of ACID transactions.[ CO2 - L1]


The acronym ACID refers to the four key properties of a transaction:
1.Atomicity
It follows an all or nothing rule. Either all changes or no changes succeed.
2.Consistency
System restored to a constant state after completion.
3.Isolation
Multiple transaction don‘t interface
4.Durability
Changes made as part of transaction survive subsequent failures.

38.What are the functions of UDDI? .[ CO2 - L1]


A description of a service‘s business function (called the business Service) Information
about the organization that published the service (business Entity), The service‘s
technical details (binding Template), including a reference to the service‘s programmatic
interface or API, and Various other attributes or metadata such as taxonomy, transports,
digital signatures, etc. (tModels).

39. Define tModel elements.[ CO2 - L1]


tModel elements have several uses within a UDDI registry, in particular, representing
technical specifications for wire protocols (such as SOAP), interchange formats

Computer Science Engineering Department 91 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

(WSDL), and sequencing rules. Each specification registered as a tModel in a UDDI


registry receives a unique GUID.

40. What are all the steps to follow to create the appropriate tModel? .[ CO2 - L1]
Set the name field of the tModel to the target Namespace attribute of the definitions
element in the interface document. This field is used to locate the appropriate tModel.
The description field of the tModel corresponds to the documentation element of the
interface document. This field can have a maximum of 256 characters. Set the
overviewURL field of the tModel to the URL and binding specification in the interface
document. Set the category Bag field of the tModel so that its keyed reference is
uddiorg: types and its key Value is wsdlSpec. This defines the UDDI entry as a WSDL
service interface definition

PART-B

1. Explain in detail about Services as Web services? .[ CO2 – L2]


This flexibility has allowed Web services to become part of many existing application
environments and has been one of the reasons behind their popularity. It also reveals
the fact that Web services are not necessarily inherently service-oriented.
Fundamentally, every Web service can be associated with:

A temporary classification based on the roles it assumes during the runtime processing
of a message .A permanent classification based on the application logic it provides and
the roles it assumes within a solution environment
Design classifications of Web Services
Service roles (temporary classifications)
Service models (permanent classifications)
Service roles
A Web service is capable of assuming different roles, depending on the context within
which it is used. For example, a service can act as the initiator, re layer, or the recipient
of a message. A service is therefore not
labeled exclusively as a client or server, but instead as a unit of software capable of
altering its role, depending on its processing responsibility in a given scenario.
Provided here are descriptions of the fundamental service roles.
• Service Provider
• Service Requestor
• Intermediaries
• Initial Sender and Ultimate Receiver
• Service Composition

Computer Science Engineering Department 92 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

Service provider:
The service provider role is assumed by a Web service under the following conditions:
• The Web service is invoked via an external source, such as a service requestor.
• As the recipient of a request message, the Web service is classified as a service
provider.
• The Web service provides a published service description offering information
about its features and behavior.
As the recipient of a request message, the Web service is classified as a service
provider.
The term "service provider" also is used to identify the organization (or individual)
responsible for actually providing te Web service.To help distinguish the service role
from the service's actual provider, the following, more qualified terms are sometimes
used:
• Service provider entity (the organization or individual providing the Web service)
• Service provider agent (the Web service itself, acting as an agent on behalf of its
owner)
• Any unit of processing logic capable of issuing a request message that can be
understood by the service provider is classified as a service requestor.
The sender of the request message is classified as a service requestor
• The Web service searches for and assesses the most suitable service provider
by studying available service descriptions.

Difference between Service provider and Service requestor:


The service requestor is the natural counterpart to the service provider, comparable to
the client in a typical client-server environment.
It is important to note that a service provider is not acting as a service requestor when it
sends a message in response to a request message.
A service requestor is best viewed as a software program that initiates a conversation
with a service provider.
A service requestor can represent both the Web service itself as well as the Web
service owner.
Therefore, the following extended terms are available (but not really used that often):
• Service requestor entity (the organization or individual requesting the Web
service)
• Service requestor agent (the Web service itself, acting as an agent on behalf of
its owner)

Intermediaries:

Computer Science Engineering Department 93 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

Though less flexible and less scalable, point-to-point communication was a great deal
easier to design. Web services communication is based on the use of messaging paths,
which can best be described as point-to-* paths.
This is because once a service provider submits a message; it can be processed by
multiple intermediate routing and processing agents before it arrives at its ultimate
destination.

Intermediary Services:
Web services and service agents that route and process a message after it is initially
sent and before it arrives at its ultimate destination are referred to as intermediaries or
intermediary services. Because an intermediary receives and submits messages, it
always transitions through service provider and service
The intermediary service transitions through service provider and service requestor
roles while processing a message. There are two types of intermediaries.
Passive Intermediaries
Active Intermediaries
Passive Intermediary, is typically responsible for routing messages to a subsequent
location It may use information in the SOAP message header to determine the routing
path, or it may employ native routing logic to achieve some level of load balancing. The
intermediary passive is that it does not modify the message.
A passive intermediary service processing a message without altering its contents.
Active intermediaries also route messages to a forwarding destination. Prior to
transmitting a message, however, these services actively process and alter the
message contents
Typically, active intermediaries will look for particular SOAP header blocks and perform
some action in response to the information they find there. They almost always alter
data in header blocks and may insert or even delete header blocks entire

An active intermediary service.


 Initial sender and ultimate receiver:
 Initial senders are simply service requestors that initiate the transmission of a
message. Therefore, the initial sender is always the first Web service in a
message path.
 Ultimate receiver. This label identifies service providers that exist as the last
Web service along a message‘s path

Computer Science Engineering Department 94 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

Service compositions:
It does not apply to a single Web service, but to a composite relationship between a
collections of services. Any service can enlist one or more additional services to
complete a given task. Any of the enlisted services can call other services to complete a
given sub-task.
Therefore, each service that participates in a composition assumes an individual role of
service composition member

service composition
Web services need to be designed with service composition in mind to be effective
composition members. Service-orientation principles place an emphasis on compos
ability, allowing some Web services to be designed in such a manner that they can be
pulled into future service compositions without a foreknowledge of how they will be
utilized.

(ii). Service Models:


The manner in which services are utilized in the real world, based on the nature of the
application logic they provide as well as their business related roles within overall
solution are called as service models.

Business service model


It encapsulates a distinct set of business logic within a well-defined functional boundary.
It is fully autonomous but still not limited to executing in isolation, as business services
are frequently expected to participate in service compositions.

Business services are used within SOAs as follows:


Fundamental building blocks for the representation of business logic o represent a
corporate entity or information set Represent business process logic o As service
composition members
Utility service model Any generic Web service or service agent designed for potential
reuse classified as a utility service.
Utility services are used within SOAs as follows:
 Services that enable the characteristic of reuse within SOA o Solution-
agnostic intermediary services
 Services that promote the intrinsic interoperability characteristic of SOA o The
services with the highest degree of autonomy

Computer Science Engineering Department 95 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

 A utility service is most commonly associated with the application service


layer. As a result, a utility service can be referred to as a utility application
service.
 The primary function of a dedicated service or as the secondary function of a
service that is fully capable of executing a business task independently.
 The controller service fulfills this role, acting as the parent service to service
composition members.
 Controller services are used within SOAs as follows:
 Support and implement the principle of compos ability o Leverage reuse
opportunities
 Support autonomy in other services
A service composition consisting of a master controller, a sub-controller, four business
services, and one utility service.

2. Explain in detail about Service descriptions (with WSDL)? .[ CO2 – L2 –


May/June 2013]
There exists a loosely coupled form of communication between services implemented
as Web services. For this purpose, description documents are required to accompany
any service wanting to act as an ultimate receiver. The primary service description
document is the WSDL definition.
A WSDL describes the point of contact for a service provider, also known as the service
endpoint orjust endpoint. It provides a formal definition of the endpoint interface (so that
requestors wishing tocommunicate with the service provider know exactly how to
structure request messages) and also establishes the physical location (address) of the
service.
A WSDL service description (also known as WSDL service definition or just WSDL
definition) can be separated into two categories:
Abstract description
Concrete description
WSDL document consisting of abstract and concrete parts that collectively describe a
service endpoint.

Abstract description:
An abstract description establishes the interface characteristics of the Web service
without any reference to the technology used to host or enable a Web service to
transmit messages.By separating this information, the integrity of the service description
can be preserved regardless of what changes might occur to the underlying technology

Computer Science Engineering Department 96 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

platform.port Type, operation, and message:The parent port Type section of an abstract
description provides a high-level view of the service interface by sorting the messages a
service can process into groups of functions known as operations.

Each operation represents a specific action performed by the service. A service


operation is comparable to a public method used by components in traditional
distributed applications. Much like component methods, operations also have input and
output parameters Because Web services rely exclusively on messaging-based
communication, parameters are represented as messages. Therefore, an operation
consists of a set of input and output messages.

Note: The term "port Type" is being renamed to "interface" in version 2.0 of the WSDL
specification.Binding represents one possible transport technology the service can use
to communicate. SOAP is the most common form of binding, but others also are
supported. A binding can apply to an entire interface or just a specific operation. The
port, which represents the physical address at which a service can be accessed with a
specific protocol. This piece of physical implementation data exists separately to allow
location information to be maintained independently from other aspects of the concrete
description. WSDL definitions frequently rely on XSD schemas to formalize the structure
of incoming and outgoing messages. Another common supplemental service description
document is a policy.

Policies can provide rules, preferences, and processing details above and beyond what
is expressed through the WSDL and XSD schema documents.
So now we have up to three separate documents that each describes an aspect of a
service:
• WSDL definition
• XSD schema
• policy
Service description documents can be collectively viewed as establishing a service
contract a set of conditions that must be met and accepted by a potential service
requestor to enable successful communication. A service contract can refer to additional
documents or agreements not expressed by service descriptions. For example, a
Service Level Agreement (SLA) agreed upon by the respective owners of a service
provider and its requestor can be considered part of an overall service contractMost of
the time service semantics are assessed by humans, either verbally by discussing the
qualities of a service with its owner, or by reading supplementary documentation
published alongside service descriptions.The ultimate goal is to provide sufficient

Computer Science Engineering Department 97 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

semantic information in a structured manner so that, in some cases, service requestors


can go as far as to evaluate and choose suitable service providers independently.

Semantic information is usually of greater importance when dealing with external


service providers, where your knowledge of another party's service is limited to the
information the service owner decides to publish. But even within organizational
boundaries, semantic characteristics tend to take on greater relevance as the amount of
internal Web services grows.

Service description advertisement and discovery:


The sole requirement for one service to contact another is access to the other service's
description. As the amount of services increases within and outside of organizations,
mechanisms for advertising and discovering service descriptions may become
necessary.For example, central directories and registries become an option to keep
track of the many service descriptions that become available. These repositories allow
humans (and even service requestors) to:Locate the latest versions of known service
descriptions Discover new web services that meet certain criteria When the initial set of
Web services standards emerged, UDDI formed part of the first generation of Web
services standards. Though not yet commonly implemented, UDDI provides us with a
registry model.

Private and public registries:


UDDI specifies a relatively accepted standard for structuring registries that keep track of
service descriptions. These registries can be searched manually and accessed
programmatically via a standardized API.Service description locations centralized in a
registry.Public registries accept registrations from any organizations, regardless of
whether they have Web services to offer. Once signed up, organizations acting as
service provider entities can register their services. Private registries can be
implemented within organization boundaries to provide a central repository for
descriptions of all services the organization develops, leases, or purchases.Descriptions
of the primary parts that comprise UDDI registry records: Business entities and
business services Binding templates and tModels:
The WSDL definitions stored implementation information separately from the actual
interface design. This resulted in an interface definition that existed independently from
the transport protocols to which it was eventually bound.
Registry records follow the same logic in that they store binding information in a
separate area, called the binding template.
Each business service can reference one or more binding templates. The information
contained in a binding template may or may not relate to an actual service.

Computer Science Engineering Department 98 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

For example:
a binding template may simply point to the address of a Web site. However, if a Web
service isbeing represented, then the binding template references a tModel. The tModel
section of a UDDI record provides pointers to actual service descriptions .

3. Write in detail about XML Schemas and WSDL with examples. .[ CO2 – L2 -
Nov/Dec 2012]
The WSDL Document Structure
A WSDL document describes a web service using the major elements:
Element Defines
<types> The data types used by the web service
<message> The message used by the web service
<portType> The operations performed by the web service
<binding> The communication protocols used by the web service
<service> The Service location used by the web service
Abstract Definition
The abstract definition contains a series of parts that include
Types
Message
Port type (or interface),
Concrete Definition
The concrete definition is comprised of
Binding parts
Service parts
Description
xmlns –specifies default name space
xmlns:tns –means this name space i.e. namespace used for particular WSDL.
xmlns:xsd –specifies all the elements within WSDL belong to the XML Scheme
Definition Language
xmlns:soap –establish the soap: qualifier used by elements defined in bindings.
name –name of the service
targetNamespace–it lets the WSDL document make references to itself as an
XML schemanamespace.

The types element

Computer Science Engineering Department 99 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

The types construct is where XSD schema content is placed. It consist of the following
elements Actual XSD schema markup (an entire schema construct containing
type definitions)
Import elements that reference external schema definitions o Contain both embedded
and imported XSD types.

Examples
A types construct containing an XSD schema construct in which a complex Type is
defined <types>
<schemaxmlns=http://www.w3.org/2001/XMLSchema
targetNamespace=‖http:www.xmltc.com/railco/transform/schema/‖>
<complexType name=‖ReturnCodeType‖>
<sequence>
<element name=‖code‖type=‖xsd:integer‖/>
<element name=‖Message‖type=‖xsd:string‖/>
</sequence></complexType></schema></types>
The WSDL types construct populated by XSD schema types used by the message
construct to represent the SOAP message body.
Examples
Two message constructs likely representing the input (request) and output (response)
messages for an operation are given below
<message name=‖getEmployeeWeeklyHoursRequestMessage‖><part
name=‖RequestParameter‖ element=‖act:EmployeeHoursRequest Type‖/>
</message>
<message name-
―getEmployeeWeeklyHoursResponseMessage‖><partname=‖ResponseParamat
er‖ element=‖act:EmployeeHoursResponseType‖/>
</message>
The part element is simply assigned a native XSD schema data type using the type
attributes.
<message name=‖getID‖><part type=‖xsd:integer‖/>
</message>
The portType, interface, and operation elements
The WSDL portType element, also known as interface, defines a group of service
operations which is defined using the operation element.
Example
The portType construct hosting two operation constructs.
<portType name=‖EmployeeInterface‖><operation name=‖GetWeeklyHoursLimit‖>
</operation>

Computer Science Engineering Department 100 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

<operation name=‖UpdateHistory‖>
</operation>
</portType>
The input and output elements (when used with operation)
The input and output elements, child element of operation, represent the request and
response messages the operation is capable of processing.
Example
Each operation has one input and one output message. The respective input and output
elements are assigned messages defined in the message constructs via their message
attributes.
<operation name=‖GetWeeklyHoursLimit‖>\
<input message=‖tns:getWeeklyHoursRequestMessage‖/><output
message=‖tns:getWeeklyHoursResponseMessage‖/>
</operation>
<operation name=‖UpdateHistory‖>
<input message=‖tns:updateHistoryRequestMessage‖/><output
message=‖tns:updateHistoryResponseMessage‖/>
</operation>
One-way MEP
Placing a single input element within the operation construct expresses the one-way
MEP.
<operation name =‖Submit‖>
<input message=‖tns:receiveSubmitMessage‖/>
</operation>
The binding element
The binding element begins the concrete portion of the service definition, to assign a
communications protocol that can be used to access and interact with the WSDL.
The binding construct contains one or more operation elements.
<binding name=‖EmployeeBinding‖type=‖tns:EmployeeInterface‖><soap:binding
style=‖document‖ transport=‖http://schemas.xmlsoap.org/soap/http/‖>
<operation name=‖GetWeeklyHoursLimit‖><soap:operation soapAction=‖…‖/>
</operation>
<operation name=‖UpdateHistory‖><soap:operataion soapAction=‖…‖/>
</operation></binding>
The style attribute of the soap:binding element defines whether the SOAP messages
used to support an operation are to be formatted as

4.Document –style messages


• Contain a fully definable XML document structure.

Computer Science Engineering Department 101 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

• RPC –style messages


• Requires compliance to a body structure defined a SOAP
specification
The input and output elements (when used with binding)
Within a binding construct, however, the input and output elements do not reference the
message elements again. They contain protocol details that establish how the
messages are going to be processed and interpreted by the chosen communication
technology.
Example
The input and output elements provide message processing information.
<operation name=‖GetWeeklyHoursLimit‖>
<soap:operation soapActiojn=‖…‖/>
<input><soap:bodyuse=‖literal‖/></input>
<output><soap:bodyuse=‖literal‖/></output>
</operation><operation name=‖UpdateHistory‖>
<soap:operation soapAction=‖…‖/>
<soap:bodyuse=‖literal‖/><input></output></operation>

The service element simply provides a physical address at which the service can be
accessed. It hosts the port element that contains this location information.
The port element contains a child soap: address element with the physical address
information. Note :The port element is replaced with a end point element in version 2.0
of the WSDL specification.

Example
<service name=‖EmployeeService‖>
<port binding=‖tns:EmployeeBinding‖ name=‖EmployeePort‖>
<soap:address location=‖http://www.xmltc.com/tls/employee/‖/></port></service>

The import element


The import element is used to import parts of the WSDL definition as well as XSD
schemas.
Example: The import element references a schema document.
<import namespace=‖http://www.xmltc.com/tls/schemas/‖
Location=‖http://www.xmltc.com/tls/schemas/employee.xsd‖/>

The documentation element

Computer Science Engineering Department 102 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

The documentation element is used to add descriptive, human – readable annotations


within a WSDL definition.
Example: The documentation element provides a description of the overall service
interface.
<portType name=‖TransformInterface‖>
<documentation>
Retrieves an XML document and converts it into the native accounting document format
</documentation>
</portType>

4. Write in detail about SOAP with examples.[ CO2 – L2 - May/June 2015]


The simple object access protocol (SOAP) is used to define a standard message format
which is used for communication between services running on different operating
systems.
SOAP Characteristics
SOAP messaging framework has the following three characteristics that is
• Extensible
• Interoperable
• Independent
Format Basic structure
SOAP message consists of four parts:
SOAP envelope, HEADER,BODY AND FAULTY
SOAP envelope
The SOAP <envelope> is the root element in every SOAP message, and contains two
child elements, an optional <Header> and a mandatory<Body>. Every SOAP message
is packaged into a container known as an envelope. It defines an overall framework for
expressing what is in a message and who should deal with it.
The basic structure of a SOAP message.
SOAP Header (optional) Header determines how a recipient of a SOAP message
should process the message.
SOAP Body -Body contains the actual message content which consists of XML
formatted data. The contents of a message body are often referred to as the message
payload.
Header Blocks -The immediate child elements of the <header> element are called
blocks. A header block is an application-defined XML element, and represents a logical
grouping of data which can be targeted at SOAP nodes that might be encountered in
the message path from a sender to an ultimate receiver.
Header Processing

Computer Science Engineering Department 103 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

The attributes on the header blocks indicate how the header blocks are to be processed
by the SOAP nodes.
SOAP messages are allowed to pass through many intermediaries before reaching their
destination.Intermediary=some unspecified routing application The final destination
processes the body of the message
Headers are allowed to be processed independently of the body Processed by
intermediaries. Message styles
The SOAP offers two messaging styles:
RPC(Remote Procedure Call)-style
Creating tightly coupled, inter-object style interfaces for web services components It is
also known as section 5 encoding Attachments
SOAP attachments are used to send large quantities binary data with the SOAP
message which may not fit well into a XML SOAP element.
Faults
The SOAP fault element holds errors and status information for a SOAP message. It
appear as an immediate child of the body element.<fault code> and <fault string> are
required.
Anatomy of a SOAP message
<? Xml version=‖1.0‖?>
<soap:Envelope xmlns:soap=http://www.w3.org/2001/12/soap-envelope soap:encoding
style=http://www.w3.org/2001/12/soap-encoding><soap:header>
</soap:header>
<soap:body>
<soap:fault>
</soap:fault></soap:body></soap:envelope>

5. Explain in detail about Web Service building block UDDI.[ CO2 – L2 - Nov/Dec
2014]
Universal Description, Discovery, and Integration (UDDI) is a platform-independent,
open framework for describing services, discovering businesses, and integrating
business services using the Internet as well as public registries of Web Services
designed to store information about businesses and the services they offer.UDDI is also
a specification for building such registries as well as an application programming
interface (API) that exposes the functionality of the registries.UDDI Basics Public UDDI
registries are hosted by operator nodes, which are companies such as Microsoft and
IBM that have committed to running public UDDI nodes.The public registry system is
loosely modeled after the Domain Name Service (DNS) system, in that there are
multiple registries responsible for synchronizing their data with each other

Computer Science Engineering Department 104 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

The DNS system provides for unique domain names, UDDI relies on globally unique
identifiers (GUIDs), which are URNs that uniquely identify the resources in each
registry.There are three levels of information available in each UDDI registry, which
correspond roughly to the features of a phone book: White pages. These pages provide
listings of companies that can be queried by name, text description, contact information,
and known identifiers (like Dun and Bradstreet‘s DUNS numbers).Yellow pages. These
pages allow for the looking up of companies by the kind of services they offer,
organized into established business categories (industry codes, location, and products
and services). These categories are organized into taxonomies. Green pages.
These pages provide information about how to interact with companies‘ Web Services
by exposing service descriptions and binding information

The Structure of UDDI


UDDI Structure
 This element is the top-level information manager for the information in the
registry about a particular business.
 Service information. Provided by thebusinessServiceelement. This element
supports the ―greengages‖ functionality. The business Service structure
contains a group of Web Services related to a category of services or possibly
a business process. Each business Service element contains one or more
technical Web Services descriptions, which describe how to find and bind to
each of the Web Services.
 Binding information. Provided by thebindingTemplateelement, which is the
element contained within the business Service element that provides the
information needed to bind to and invoke a Web Service.‖
 Specifications for services. Enclosed within eachbindingTemplateelement are
special elements that list references to information about specifications for
services. These elements, called tModel elements (from ―technical models‖),
are metadata about each specification, providing information on a
specification‘s name, publishing organizations, and URLs to the specifications
themselves.
 tModel elements: tModel elements have several uses within a UDDI registry,
in particular, representing technical specifications for wire protocols (such as
SOAP), interchange formats (WSDL), and sequencing rules. Each
specification registered as a tModel in a UDDI registry receives a unique
GUID.

Computer Science Engineering Department 105 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

 tModel Structure :tModel elements is critical to understanding how UDDI


works, because they form the basis of how UDDI deals with the meaning of
the various specifications it deals with.
 The concept of a tModel is necessarily somewhat nebulous, because tModel
elements consist of metadata (data about data). tModel elements provide a
reference system for UDDI registries that is based on abstraction.
 The primary use for tModel elements within UDDI is to represent a technical
specification.
 Example, wire protocols (such as SOAP), interchange formats, and the like.
When two parties wish to communicate using a particular specification, they
must share mutually agreed on technical identity for the specification they
share. This technical identity can be registered in a tModel. Once such a
specification is uniquely defined in this way, other parties can refer to it by
referring to its unique tModel identifier, which is
 WSDL documents can be organized as service implementation and service
interface documents.
 The service implementation document maps to the UDDI business Service
element, whereas the service interface document maps to the tModel
elements.
 The first step in publishing a WSDL description in a UDDI registry is
publishing the service interface as a tModel in the registry.
Here are the steps to follow to create the appropriate tModel:
Set the name field of the tModel to the target Namespace attribute of the definitions
element in the interface document. This field is used to locate the appropriate tModel.
The description field of the tModel corresponds to the documentation element of the
interface document. This field can have a maximum of 256 characters.
Set the overviewURL field of the tModel to the URL and binding specification in the
interface document. Set the categoryBag field of the tModel so that its keyed reference
is uddiorg: types and its keyValue is wsdlSpec. This defines the UDDI entry as a WSDL
service interface definition

6. Explain in detail about Message Exchange Patters(MEP) .[ CO1 - L1 - Nov/Dec


2016]
Definition:
Message exchange pattern defines the way that SOAP message are exchanged
between the web services requester and web service providers. It represents a set of
templates

Computer Science Engineering Department 106 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

Example
Request - response pattern.
i)Request-response
In a request-response message exchange the SOAP client sends a SOAP request
message to the service. The service responds with a SOAP response message.
ii)Fire-and-forgot
Fire-and-forgot is a simple asynchronous message exchange pattern is based on the
unidirectional transmission of messages from a source to one or more destinations.
Response to a transmitted message is not permitted.
The fire-and-forget MEP.

Types
Single-destination pattern- A source sends a message to one destination only
Multi-cast pattern A source sends message to a predefined set of destination
Broadcast pattern -Similar to the multi-cast pattern, except that the message is sent out
to a broader range of messaging models.
Complex MEPs
Complex MEPs is a message pattern in which primitive MEPs are assembled to create
different types of messaging models

Example
Publish-and-subscribe pattern:
Publish-and-subscribe pattern is a asynchronous MEP in which publishers sends
messages to all interested subscribers.
Step 1:
The subscriber sends a message to notify the publisher that it wants to receive
messages on a particular topic.
Step 2:
Upon the availability of the requested information, the publisher broadcast messages on
the particular topic to all of the topics subscribers.

MEPs and SOAP:


A MEPs specification MUST conform to the requirements for SOAP features
specifications are
Provides a one-way message transfer
Generate countless messages implements through SOAP header blocks
Identify the MEP associated with a message with an optional parameter

Computer Science Engineering Department 107 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

MEPs and WSDL:


MEPs and WSDL service description coordinate the input and output messages
associated with an operation. The association of MEPs to WSDL operations embeds
expected conversational behavior into the interface definition
Basic patterns supported by WSDL 1.1

WSDL specification
Request-response operation: upon receiving a message, the service must respond with
a standard message or a fault message. Solicit-response operation: upon submitting a
message to a service requestor, the service expects a standard response message or a
fault message. One-way operation: the service expects a single message and is not
obligated to respond.
Patterns supported by WSDL 2.0
 The in-out pattern, comparable to the request-response MEP
 The out-in pattern, which is the reverse of the previous pattern where the
service provider initiate the exchange by transmitting the request
 The in-only pattern, which essentially supports the standard fire-and-forgot
MEP
 The out-only pattern, which is the reverse of the in-only pattern. it is used
primarily in support of event notification
 The robust in-only pattern, a variation of the in-only pattern that provides the
option of launching a fault response message as a result of a transmission or
processing error
 The robust out-only pattern, which is similar to the in-out pattern with one
exception. This variation introduces a rule stating that the delivery of a
response message is optional and should therefore not be expected by the
service requestor that originated the communication. This pattern also
supports the generation of a fault message.
 The in-optional-out pattern, which is similar to the in-out pattern with one
exception. This variation introduces a rule stating that the delivery of a
response message is optional and should therefore not be expected by the
service requestor that originated the communication. This pattern also
supports the generation of a fault message.
 The out-optional-in pattern is the reverse of the in-optional-out pattern, where
the incoming message is optional. Fault message generation is again
supported.

Computer Science Engineering Department 108 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

7.Discuss in detail about Orchestration and Choreography.[ CO1 - L1 - May/June


2015]
Orchestration:
Orchestration, also called as a heart of SOA, which facilitates connecting of different
processes/services without having to redevelop the solution that originally automated
the processes individually. It introduces workflow logic, consist of numerous business
rules, conditions, and events, which is abstracted and more easily maintained.
Business protocols and process definition:

1.Business protocols
Defines how participants can interoperate to achieve the completion of a business task.

2.Process definition
Encapsulates and expresses the details of the workflow logic.
Process services and partner services:

3.Process services
A process service is the process itself represented as a service. It coordinates and
exposes functionality from the partner services.
Partner services :Partner services or partner links is the services allowed to interact with
the process service. The process service, after first being invoked by a partner service,
then invokes another partner service.

Basic activities and structured activities:


WS-BPEL breaks down workflow logic into a series of predefined primitive activities
Basic activities represent fundamental workflow
• Invoke
• Receive
• Reply
• Throw
• Wait
Sequences, flows, and links:
Sequences -Sequences align a group of related activities in a list that determines
sequential execution order. Flows- Flows also contains group of related activities but
activities can be executed concurrently. The flow does not finish till the time all the
activities are completed.Links-Links are used to establish formal dependencies between
activities that are part of a flow. Links are also knows as synchronization dependencies.

Orchestration and activities:

Computer Science Engineering Department 109 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

A single orchestration scope can be classified as a complex, and most likely, long-
running activity.

Orchestration and coordination:


WS-BPEL fully utilize WS-Coordination context management framework by
incorporating the WS-Business activity coordination type.

Orchestration and SOA:


Through the use of orchestrations, service-oriented solution environments achieves the
following characteristics
Composability
Interoperability
Extensibility
Vendor diver

8. Explain Choreography in detail.[ CO2 – L2 - Nov/Dec 2016]


Choreography is a complex activity comprised as a service composition and a series of
MEPs. The web services choreography description language (WS-CDL) is the
specification that represents the Choreography.
Collaboration
The goal is to enables an organized collaboration between services representing
different service entities, only no one entity necessarily controls the collaboration logic.

Roles and participants:

Roles
Roles establish what the service does and what the service can do within the context of
a particular business task.
Participants
Participants are the roles that bounded to WSDL definitions, and those related are
grouped.

Relationships and channels: Relationship


Relationship defines potential exchange between two roles in choreography. Every
relationship consequently consists of exactly two roles.
Channels
Channels define the characteristics of the message exchange between two specific
roles.
Interaction and work units:

Computer Science Engineering Department 110 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

Interaction
Interaction encapsulates the actual logic behind a message exchange.
Work units
Work units are the rules and constrains that must be adhered to for an interaction to
successfully completed
Designed choreography can be applied to different business tasks comprised of the
same fundamental actions.
Modularity
Choreography can be assembled from independent modules that can represent distinct
sub-task.
Compos ability
Choreography composes a set of non-specific services to accomplish a task.
Orchestrations and choreographies:
Although orchestrations and choreographies look very similar to each other there are
significant differences among them.
• An orchestration expresses organization specific business workflow
• An organization controls the logic behind an orchestration even if it involves
external businesses
• Choreography is not owned by a single entity, it acts as a community interchange
pattern used for collaborative purpose by services from different provider entities.

9. Explain in detail about Atomic Transaction Process with suitable diagrams .[


CO2 – L2 - Nov/Dec 2016]
Atomic transaction:
An atomic transaction is a series of database operation either all occur, or nothing
occur. It implements commit and rollback features to enable cross-service transaction
support.
ACID transactions The acronym ACID refers to the four key properties of a transaction:
Atomicity
It follows an all or nothing rule. Either all changes or no changes succeed.
Consistency
System restored to a constant state after completion.
Isolation
Multiple transaction don‘t interface
Durability
Changes made as part of transaction survive subsequent failure
Transaction protocols
The atomic transaction defines the following protocols
1.Completion protocol-Used to initiate the commit or abort states of the transaction.

Computer Science Engineering Department 111 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

2.Durable 2PC protocol-Used by services for representing permanent data repositories‘


should register.
3.Volatile 2PC protocol-Used by services for managing non-persistent data.
The atomic transaction coordinator
When ES-atomic transaction protocols are used, the coordinator controller service can
be referred to as an atomic transaction coordinator used to manage the participants of
the transaction process and in deciding the transactions ultimate outcome.
The atomic transaction process
The atomic transaction coordinator is responsible for deciding the outcome of a
transaction based on feedback it receives from all of the transaction participants.
Feedback collection
The feedback collection is divided into two phases
1. Prepare phase
2. Commit phase
Prepare phase
All participants are notified by the coordinator to prepare and then issue a vote The
Coordinator requesting that transaction participants prepare to vote
Vote consists of either a ―commit‖ or ―abort‖ request
The transaction participants voting on the outcome of the atomic transaction participants
prepare to vote Commit phase Based on voting of the participants, the coordinator
decides whether to commit or abort the transaction, and notifies the result to all the
participants.
Not only do atomic transactional capabilities lead to a robust execution environment for
SOA activities, they promote interoperability when extended into integrated
environments. This allows the scope of an activity to span different solutions built with
different vendor platforms, while still being assured a guaranteed all-or-nothing
outcome.
WS-Atomic Transaction is supported by the affected applications, this option broadens
the application of the two-phase commit protocol beyond traditional application
boundaries.
Atomic transactions and SOA
Atomic transactions therefore play an important role in ensuring quality of service

Computer Science Engineering Department 112 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

Unit – V
Building Soa-Based Applications
Part – A

1. What is service oriented analysis?.[ CO3 - L1 – May/June 2013]


The service-oriented analysis is the process of determining how business automation
requirements can be represented through service-orientation.

2.What are the goals needed for performing a service-oriented analysis? .[ CO3 -
L1 - Nov/Dec 2011]
The overall goals of performing a service-oriented analysis are as follows:
Define a preliminary set of service operation candidates.
Group service operation candidates into logical contexts. These contexts represent
service candidates.
Define preliminary service boundaries so that they do not overlap with any existing or
planned services.
Identify encapsulated logic with reuse potential.
Ensure that the context of encapsulated logic is appropriate for its intended use.
Define any known preliminary composition models.

3.Give the step-by-step process in the service-oriented analysis.[ CO3 - L1 -


Nov/Dec 2016]
Step 1: Define business automation requirements
Step 2: Identify existing automation systems
Step 3: Model candidate services.

4. What is service modeling? .[ CO3 - L1]


Service modeling is a process of identifying candidate service operation and then
grouping them into a logical context.

5.List out the types of logic suitable for orchestration layer.[ CO3 - L1]
Business rules
Conditional logic
Exception logic
Sequence logic

6.List out the types of derived business services [CO3 - L1]

Computer Science Engineering Department 113 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

Business service are derived from the following sources


0) Task-centric business services
1) Entity-centric business services

7.What is the use of service candidates? .[ CO3 - L1 - Nov/Dec 2014]


The service candidates are used to distinguish a conceptualized service from an actual
implemented service.

8.What is the key service-orientation principles applied to the service candidate?


[ CO3 - L1 - Nov/Dec 2014]
Reusability
Autonomy
Statelessness
Discoverability

9.What is service oriented design? .[ CO3 - L1]


Service-oriented design phase is a process that transforms previously modeled service
candidates into physical service designs.

10. Give the overall goals for performing a service-oriented design.[ CO3 - L1]
The overall goals of performing a service-oriented design are as follows:
Determine the core set of architectural extensions.
Set the boundaries of the architecture.
Identify required design standards.
Define abstract service interface designs.
Identify potential service compositions.
Assess support for service-orientation principles.
Explore support for characteristics of contemporary SOA

11.What does abstract definition contain?.[ CO3 - L1]


The abstract definition contains a series of parts that include
Types
Messages
Port type (or interface)

12.What does concern definition comprised of?.[ CO3 - L1]


Binding parts and Service parts

13.What is Service-oriented analysis? .[ CO3 - L1]

Computer Science Engineering Department 114 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

Service-oriented analysis establishes a formal analysis process completed jointly by


business analysts and technology architects. Service modeling, a sub-process of
service-oriented analysis, produces conceptual service definitions called service
candidates.

14.What is the responsibility of the service? .[ CO3 - L1]


This provides the basic description of WHY the service should exist. Services are
expensive. If you cannot stand in front of an executive and make a purely business-
oriented case for the existence of a service, you need to rethink it. You are doing
something wrong.

15.What rules does the service own? .[ CO3 - L1]


This provides the basic scope of the service. In a well devised, Enterprise SOA, you will
have a rule implemented in a relatively small number of services (hopefully in one
service) which makes it easier to change that rule. This means that you need to
describe the collection of rules owned by a service.
.
16.List out some guidelines for service modeling.[ CO3 - L1]
Abstract orchestration logic
Create business service candidates
Refine and apply principles of service-orientation
Identify candidate service compositions

17.Define Task-centric business service design process [CO3 - L1]


Task services are also known as task-centric business services.
Complete the business service layer(s)
The primary input is the corresponding service candidates we produced in the service
modeling process during the service-oriented analysis.

18.Expand WS-BPEL and What is WS-BPEL? .[ CO3 - L1 - Nov/Dec 2016]


WS-BPEL stands for web services business process execution Language.
WS-BPEL is an XML based language enabling users to describe business process
activities as web services and define how they can be connected to accomplish specific
tasks.

19.What is the process element? .[ CO3 - L1]


An <process> element is the root element and must have a name attribute for assigning
the name value. It is used to establish the process definition-related namespace.

Computer Science Engineering Department 115 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

20.What does the partner links element define? .[ CO3 - L1]


The partner Links define the services that are orchestration by the process. It contains a
set of <partner link> element each represent the communication exchange between two
partners-the process service being one partner and another service being the other.

PART-B

1. Discuss in detail about service oriented analysis.[ CO3 – L2 - Nov/Dec 2014]


The service oriented analysis is the process of determining how business automation
requirements can be representation through service orientation.

Goals
The overall goals of performing a service oriented analysis are as follows:
Define a preliminary set of service operation candidates. Group service operation
candidates into logical contexts. These contexts represent service candidates. Service
Operation CandidatesService Candidates (Logical context)
Define preliminary service boundaries so that they do not overlap with any existing or
planned services.
• Identify encapsulated logic with reuse potential.
• Ensure that the context of encapsulated logic is appropriate for its
intended use.
• Define any known preliminary composition models.
The service-oriented analysis process
The service-oriented analysis process is a sub-process of the overall SOA delivery
lifecycle.

Step 1: Define business automation requirements


Business requirements related to the scope of that solution are normally collected.
Documentation is prepared for this analysis.
Should be sufficiently mature so that a high-level automation process can be defined.
Used as the starting point of the service modeling process.

Step 2: Identify existing automation systems


Requirements identified in step 1 need to be identified for automation.
Information of how web services relate to existing systems are used to identify
application service candidates during the service modeling process described in step3.

Computer Science Engineering Department 116 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

Step 3: Model candidate service


Service modeling is a process of identifying candidate service operation and then
grouping them into a logical context Groups eventually are assembled into a tentative
composite model representation the combined logic of the planned service-oriented
application.

2.Discuss in detail about Service modeling. .[ CO3 – L2 - May/June 2015]


Service modeling is fundamentally a process of gathering and organizing business
model information.
―Services” versus “Service candidates”
Services
Services are defined on a preliminary basic and still subject to a great deal of change
and refinement before they are handed over to the service-oriented design project stage
responsible for producing physical service contracts.
Service candidates
The service candidate is used to distinguish a conceptualized service from an actual
implemented service. Service candidates and service operation candidates are the end-
result of a process called service modeling.
Process description
The service modeling process consists of 12 steps for the modeling of an SOA
consisting of application, business, and orchestration service layers.

Step 1: Decompose the business process


The documented business process is decomposed into a series of granular process
steps. Process‘s workflow logic is decomposed into processing steps.
Step 2: Identify business service operation candidates
Business service operation candidates are identified to filter of steps not suitable for
service encapsulation.
Step 3: Abstract orchestration logic
An orchestration layer is build by identifying the parts of the processing logic that this
layer would potentially abstract.
• Orchestration logic may or may not be represented accurately by a step
description.
• Some of the identified workflow logic likely will be dropped eventually.
Step 4: Create business service candidates
The processing steps are grouped according to one or more logical contexts that
represent a service candidate which are created.
Step 5: Refine and apply principles of service-orientation

Computer Science Engineering Department 117 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

Each identified service operation candidates is refined by ensuring that it is potentially


reusable and as autonomous as possible
The following four key service-orientation principles are applied to the service candidate
Reusability
Autonomy
Statelessness
Discoverability
Step 6: Identify candidate service compositions
The most common scenario are identified that can take place within the boundaries of
the business process. For each scenario, the required processing steps are listed below
It gives you a good idea as to how appropriate the grouping of your process steps is.
It demonstrates the potential relationship between orchestration and business service
layers.
It identifies potential service compositions.
It highlights any missing workflow logic or processing steps.
Steps 7: Revise business service operation grouping
Based on the composition results in step6, the business grouping process steps and its
organization of service operation candidates are revised by consolidating or creating
new groups.
Steps 8: Analyze application processing requirements
The underlying application processing step requirements of all service candidates are
analyzed to abstract any further technology-centric service candidates from this view
that will complete a preliminary application services layer.
Step 9: Identify application service operation candidates
Each application logic processing requirement is broken down into a series of steps
which reference the performed function and do not reference the business process step.
Step 10: Create application service candidates
The processing steps are grouped according to a predefined context which shows
logical relationship between operation candidates of the application services.
 This relationship can be based on any number of factors, including:
 Association with a specific legacy system
 Association with one or more solution components
 Logical grouping according to type of function.

Step 11: Revise candidate service compositions

The original scenarios that are identified in step 5 are revisited and the new application
service candidates are incorporated by expanding the service compositions.

Computer Science Engineering Department 118 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

Step 12: Revise application service operation grouping


The motions of mapping the activity scenarios from step 11 usually are gone through
which will results in Changes to the grouping and definition of application service
operation candidates.
• Point out any omission in application-level processing steps.
• Resulting in the addition of new service operation candidates and even new
service candidates
Types of logic
The types of logic suitable for this layer include:
• Business rules
• Conditional logic
• Exception logic
• Sequence logic

3. Write in detail about Service Oriented Design.[ CO3 – L2 - Nov/Dec 2012]


Service-oriented design phase is a process that transforms previously modeled service
candidates into physical service designs.
Goals (i.e steps or tasks)
The overall goals of performing a service-oriented design are as follows:
Determine the core set of architectural extensions.
Set the boundaries of the architecture.
Identify required design standards.
Define abstract service compositions.
Identify potential service compositions.
Asses support for service-orientation principles.
Explore support for characteristics of contemporary SOA.
STANDARD TYPES
1. DESIGN STANDARDS
Design standards represent custom standards created by an organization to ensure that
services and SOAs are built according to a set of consistent conventions.
2. INDUSTRY STANDARDS
Industry standards are provided by standards organizations and are published in web
services and XML specifications.
The Service-Oriented Design Process

Step 1: Compose SOA

Computer Science Engineering Department 119 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

 Each instance of a service-oriented architecture is uniquely composable


which is used to implement a common set of shared technologies based on
key XML and first-generation web services specification
 The step consists of the following three Choose service layers
 Position core SOA standards
 Choose SOA extensions
Step 2: Entity-centric business service design process
 Entity services are also known as entity-centric business services
 Establish the business service layer
Based on its functional boundary and context on one or more related business entities
Step 3: Application (utility) services design process
Utility services are also known as application service
Step 4: Task-centric business service design process
• Task services are also known as task-centric business services.
• Complete the business service layer(s)
• The primary input is the corresponding service candidates we
produced in the service modeling process during the service-
oriented analysis.
Step 5: Design service-oriented business process
The formal, executable definitions of workflow logic are translated into the creation of a
WS-BPEL process definition

4.Explain in detail about Design standards and guidelines.[ CO3 – L2 - Nov/Dec


2014]
1. Service design overview
2. Entity-centric business service design (a step-by-step process)
3. Application service design (a step-by-step process)
4. Task-centric business service design (a step-by-step process)
5. Service design guidelines
1) Service design overview
The ultimate goal of these processes is to achieve a balanced service design.
 encapsulate the required amount of logic
 conform to service-orientation principles
 meet business requirements
Four main types of service layers:
 Entity-centric business services
 Application services
 Task-centric business services

Computer Science Engineering Department 120 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

 Process services
(i)Design standards
It is important to note that a firm set of design standards is critical to achieving a
successful SOA. Because the design we are defining as part of this phase is concrete
and permanent, every service produced needs to be as consistent as possible.
Otherwise, many key SOA benefits, such as reusability, compos ability, and
especially agility, will be jeopardized. It is therefore assumed that prior to starting this
phase, design standards are already in place.
• Entity-centric business service design (a step-by-step process)
Entity-centric business services represent the one service layer that is the least
influenced by others. Its purpose is to accurately represent corresponding data entities
defined within an organization's business models
Process description
Step 1: Review existing services
Step 2: Define the message schema types
Step 3: Derive an abstract service interface
Step 4: Apply principles of service-orientation
Step 5: Standardize and refine the service interface
Step 6: Extend the service design
Step 7: Identify required processing
SERVICE DESIGN GUIDELINES
• Apply naming standards
• Apply a suitable level of interface granularity
• Design service operations to be inherently extensible
• Identify known and potential service requestors
• Consider using modular WSDL documents
• Use namespaces carefully
• Use the SOAP document and literal attribute values

5.Explain about SOA Composition Guidelines.[ CO3 – L2 - May/June 2012])


Fundamental components of SOA
• XML data representation architecture
• Web services built upon industry standards
• A platform capable of hosting and processing XML data and web
services Concerns at this stage
• What types of services should be built and orchestrated?
• How should the first generation standards be implemented?

Computer Science Engineering Department 121 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

Steps for Composing SOA

Step 1: Choose Service layers


Study the candidate service layers produced during the service-oriented analysis phase.
Explore service layers and service layer configuration scenarios.
Decide on the design configuration for the service layers.

Step 2: Position Core Standards


Assess which core standards should comprise our SOA.
How it should be implemented.
Best support the features and requirements of our service-oriented solution.

Step 3: Choose SOA Extensions


Determine which contemporary SOA characteristics are supported by SOA
Decide which of the available WS_* specification should become part of out service-
oriented environment.

6. Explain about WS-Coordination with code example.[ CO3 – L2 - Nov/Dec 2014]


WS-coordination is a framework for coordinating distributed activities
Coordinator
 Activation service for creating coordination instance.
 Registration service for registering participating applications.
 Additional protocol specific services.
The coordination context element
The coordination context is used to carry information about active coordination to
participants,
• Information inside context is coordination protocol specific
• Context format is not mandated by the standard
• Typically passed in SOAP headers
Structure
<Envelope Xmlns=http://schemas.xmlsoap.org/soap/envelope/
Xmlns:wsc=http://schemas.xmlsoap.org/ws/2002/08/wscoor‖
Xmlns:wsc=http://schemas.xmlsoap.org/ws/2002/07/utility‖
<header>
<wsc:coordinationcontext><
wsu:identifier>....</wsu:identifier>
<wsu:expires>...</wsu:expires>
<wsc:coordinationType>....</ wsc:coordinationType>

Computer Science Engineering Department 122 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

<wsc:registrationservice>
</ wsc:registrationservice>
</ wsc:coordinationcontext></header><body>...</body></Envelope>
The identifier and expires elements
Identifier- The identifier elements is used to associate a unique ID value with the
current activity
Expires - The expires element sets an expiry date that establishes the extent of the
activity‘s possible lifespan.
The coordination type element
The specific protocols that establish the rules and constraints of the activity are
identified within the coordination type element.The coordination type element is used to
represent the WS-business activity and WS-atomic transaction coordination types
section.

Designating the WS-business activity coordination type


The coordination type element is assigned the WS-atomic transaction coordination type
identifier, which communicates the fact that the headers context information is part of a
short running transaction.
Structure
<wsc:coordinationType>
http://schemas.xmlsoap.org/ws/2003/09/wsat</ wsc:coordinationType>
The registration service element
The registration service construct simply hosts the endpoint address of the registration
service. It uses the address element also provide by the utility schema.
Structure
The value inside address tag containing a URL pointing to the location of the
registration service. <wsc:registrationservice>
<wsu:address>http://www.xmltc.com/bpel/reg </wsu:address>
</wsc:registrationservice>

7. Explain about WS-Policy with code example.[ CO3 – L2 - Nov/Dec 2014]


WS-policy defines a framework for allowing web services to express their constraints
and requirements in relation to security, processing, or message content.
Goal:It provides the mechanisms needed to enable web services applications to specify
polices.
Specification
The WS-policy framework is comprised of the following specifications:

1. WS-policy

Computer Science Engineering Department 123 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

2. WS-policy assertions
1.The policy element
The policy element establishes the root construct used to contain the various policy
assertions that comprise the policy.
2.Policy assertions
A policy assertion represents an individual preference, requirement, capability, or other
characteristics It is basic building block of a policy expression
An XML element with a well-known name and meaning.
Standard policy assertions
WS-policy assertions define four general policy assertions for any subject.
Policy assertions description
Wsp:textencoding Specifies a character encoding
Wsp:language Specifies a natural language
Wsp:specversion Specifies a version of a particular specification
Wsp:messagepredicate It can be tested against the message

8. Explain about WS-Security with code example.[ CO3 – L2 - Nov/Dec 2011]


WS-security, also known as web services security or WSS, is a flexible and extensible
framework to SOAP to apply security to web services.
Why WS-security?
The WS-security is used to implement
Message-level security measures
Protect message contents during transport and during processing by service
intermediaries.
Authentication and authorization control
Protect service provides from malicious requestors.
WS-security specification
The WS-security framework is comprised of numerous specification, some are listed
below:
WS-security
XML-encryption
XML-signature
WS-security elements
The security element (WS-security)
The security header block contains the security-related information for the message
targeted at a specific receiver.
It consists of the following child elements
XML-encryption and XML-signature constructs
Token elements provided by the WS-security specification itself

Computer Science Engineering Department 124 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

The username Token, username, and password elements (WS-security)


The <username Token> is a way of providing a username and optional password
information for authentication and authorization purpose.
Example
<wsse:UsernameToken>
<wsse:username> Joe <//wsse:username>
<wsse:password> ILoveJava </wsse:password>
</wsse:usernameToken>
The binarySecurityToken element (WS-security)
The binarySecurityToken element defines a security token that is binary encoded. It has
two attributes that are used to interpret it
o valueType - identifies the type of the security token
o encodingType - indicates how the security token is encoded.
Syntax
<BinarySecurityToken Id=....EncodingType=....ValueType=.../>
The securityTokenRefrence element (WS-security)
The securityTokenReference element provides a pointer to a token that exist outside of
the SOAP message document.
Syntax
<securityTokenReference Id=‖...‖><reference URI=‖...‖/>
</securityTokenReference>
XML-Encryption Elements
The XML-Encryption elements are used to define how to encrypt the contents of an
XML element.
The Encryption Data element (XML-Encryption)
The Encryption Data element hosts the encryption portion of an XML document. If
located at the root of an XML document, the entire document contents are encrypted.
Type attribute
Type attribute indicates what is included in the encrypted content
The cipherData, CipherValue, and CipherReference elements (XML-Encryption)
The cipherdata is a mandatory element that provides the encrypted data. It consists of
the,
• cipherValue-hosting the character representing the encrypted text.
• cipherReference-provides a pointer to the encrypted values.
• XML-signature elements
• The XML-signature elements provides message integrity and authentication
information about the originator of the message.
• Basic structure
• The basic structure of the XML signature is as follows: <signature>

Computer Science Engineering Department 125 Service Oriented Architecture


S.K.P. Engineering College, Tiruvannamalai VII SEM

• <signedinfo>
• <canonicalizationmethod/>
• <signaturemethod/>
• <reference>
• <transforms>
• <digestmethod>
• <digestValue>
• </reference>
• <reference/>
• </signedinfo>
• <signaturevalue/>
• <keyinfo/>
• <object/>
• </signature>

************************

Computer Science Engineering Department 126 Service Oriented Architecture

You might also like