Lecture1 - SOA, XML, XSD

Содержание

Слайд 2

Confidential Introduction Senior Software Test Automation Engeneer More than 2 year

Confidential

Introduction

Senior Software Test Automation Engeneer
More than 2 year in

EPAM
Expertise:
UI Test Automation based on Java
WS Test Automation using tools and custom frameworks
BDD approaches

Anastasiya Babovich
E-mail: Anastsiya_Babovich@epam.com
Skype: anastasiya_babovich

Слайд 3

Confidential Some rules Listen attentively The rule of hand Turn off

Confidential

Some rules

Listen attentively

The rule of hand

Turn off your phones

Be punctual

(song or poem)
Слайд 4

Confidential Training objectives and schedule

Confidential

Training objectives and schedule

Слайд 5

Confidential Service- Oriented Architecture

Confidential

Service-
Oriented
Architecture

Слайд 6

Confidential What is SOA? Service-oriented architecture (SOA) is a flexible set

Confidential

What is SOA?

Service-oriented architecture (SOA) is a flexible set of design

principles used during the phases of systems development and integration in computing.

A system based on a SOA will package functionality as a suite of interoperable services that can be used within multiple, separate systems from several business domains.

Слайд 7

Confidential What is SOA? SOA also generally provides a way for

Confidential

What is SOA?

SOA also generally provides a way for consumers of

services, such as web-based applications, to be aware of available SOA-based services.

SOA defines how to integrate widely disparate applications for a Web-based environment and uses multiple implementation platforms.

Rather than defining an API, SOA defines the interface in terms of protocols and functionality. An endpoint is the entry point for such a SOA implementation.

Слайд 8

Confidential Example of SOA From Life

Confidential

Example of SOA From Life

Слайд 9

Confidential Example of SOA From Life getBook(Pushkin); setBook(Dostoevski); removeBook(Tolstoy);

Confidential

Example of SOA From Life

getBook(Pushkin);
setBook(Dostoevski);
removeBook(Tolstoy);

Слайд 10

Confidential SOA Goals Reducing costs when developing applications, due to streamlining

Confidential

SOA Goals

Reducing costs when developing applications, due to streamlining the development

process;

Increased code reuse.

Independence of the platform, tools, development languages​​;

Increased scalability posed systems;

Improved manageability of systems produced;

Слайд 11

Confidential SOA Principles Architecture is not tied to any particular technology.

Confidential

SOA Principles

Architecture is not tied to any particular technology.

Independence of the

organization system on your computing platform (platforms).

Independence of the organization system used by programming languages.

Use services that are independent of specific applications, with a uniform interface to access them.

Organization of services as a weakly-coupled components for building systems.

Слайд 12

Confidential Web- Service

Confidential

Web-
Service

Слайд 13

Confidential Why do we need Web Services?

Confidential

Why do we need Web Services?

Слайд 14

Confidential The Intelligence is in the Connections

Confidential

The Intelligence is in the Connections

Слайд 15

Confidential How do people communication? Medium & Shared vocabulary

Confidential

How do people communication?

Medium
&
Shared vocabulary

Слайд 16

Confidential How does software communicate? Client Server Java … .NET …

Confidential

How does software communicate?

Client

Server

Java

.NET

Desktop

Mobile

Request

Response

Слайд 17

Confidential Web Service - Definition W3C Definition "Web Service is a

Confidential

Web Service - Definition

W3C Definition

"Web Service is a software application identified

by a URI, whose interfaces and bindings are capable of being defined, described, and discovered by XML artifacts and which supports direct interactions with other software applications using XML-based messages via internet-based protocols".

A Web service is a method of communication between two electronic devices over a network. It is a software function provided at a network address over the Web with the service always on as in the concept of utility computing. 

Wikipedia

The term Web services describes a standardized way of integrating Web-based applications using the XML, SOAP, WSDL and UDDI open standarts over an Internet protocol backbone  

Vangie Beal

Слайд 18

Confidential Web Service – what are? Web services are application components

Confidential

Web Service – what are?

Web services are application components

Communicate using open

protocols

Can be used by other applications

Self-contained and self-describing

Слайд 19

Confidential Web Service – type of usage

Confidential

Web Service – type of usage

Слайд 20

Confidential Reusable application-components Source: https://developers.facebook.com/docs/plugins/like-button/ Facebook like Standard Box count Button count Button

Confidential

Reusable application-components

Source: https://developers.facebook.com/docs/plugins/like-button/

Facebook like

Standard

Box count

Button count

Button

Слайд 21

Confidential Connect existing software Google maps Source: https://developers.google.com/maps/

Confidential

Connect existing software

Google maps

Source: https://developers.google.com/maps/

Слайд 22

Confidential Real project example Epam - Expedia

Confidential

Real project example

Epam - Expedia

Слайд 23

Confidential Real project example Epam - Expedia

Confidential

Real project example

Epam - Expedia

Слайд 24

RPC – remote procedure call Confidential

RPC – remote procedure call

Confidential

Слайд 25

RPC – types Confidential

RPC – types

Confidential

Слайд 26

Confidential How does software communicate? Client Server Java … .NET …

Confidential

How does software communicate?

Client

Server

Java

.NET

Desktop

Mobile

Request

Response

Слайд 27

RPC – XML – example Confidential

RPC – XML – example

Confidential

Слайд 28

Confidential Web services & Web applications

Confidential

Web services & Web applications

Слайд 29

Confidential Widely Well-known words Web Application Usually a collection of dynamic

Confidential

Widely Well-known words

Web Application
Usually a collection of dynamic

web pages
Usually restricted to the intranet
Can be implemented as desktop application
Information accessible using front end user interfaces
Accessed by authorised users only
Web Site
Collection of static and dynamic web pages
Available on the internet, or an organization's intranet
Cannot be implemented as desktop application
Information accessible using front end user interfaces
Accessed by anybody
Слайд 30

Confidential Widely Well-known words Web Server Software designed to serve web

Confidential

Widely Well-known words

Web Server
Software designed to serve web pages/web

sites/web
services. Examples are IIS, Apache, etc.
Web Service
Application run by a web server, performing tasks and
returning structured data to a calling program, rather
than html for a browser.
Only “provides” information; does not “present”
information
Publicly available and standardized for use by all
programmers
Слайд 31

Confidential Web applications and Web services

Confidential

Web applications and Web services

Слайд 32

Confidential Extensible Markup Language (XML)

Confidential

Extensible Markup Language (XML)

Слайд 33

Confidential Based on Standard Generalized Markup Language (SGML) Language similar to

Confidential

Based on Standard Generalized Markup Language (SGML)
Language similar to HTML
Created for

data description
XML tags are not defined by default in XML, they should be defined by ourselves
DTD or XML scheme are used for description of rules

XML

Слайд 34

Confidential XML data can be stored as in separate file as

Confidential

XML data can be stored as in separate file as well

as inside of HTML, that will be responsible just for the format, but not for the data
XML can be used for communication between two incompatible systems
XML is used for as for data storage in file system as well as for storage and operation
Make the information available for internet users

XML

Слайд 35

Confidential Give the life for derived from the XML languages like

Confidential

Give the life for derived from the XML languages like WAP

and WML
For communication between client and server in Web applications (Ajax)

XML

Слайд 36

Confidential Well-formed XML Peter Kress John Doe XML document has just one root element

Confidential

Well-formed XML



Peter
Kress



John
Doe


XML document has just one root element

Слайд 37

Confidential Well-formed XML All elements must have closing tags Kress

Confidential

Well-formed XML

All elements must have closing tags



Kress


Слайд 38

Confidential Well-formed XML Names of elements are case-sensitive, so the opening

Confidential

Well-formed XML

Names of elements are case-sensitive, so the opening and closing

tags must be in the same case.

This is correct
This is incorrect 

Слайд 39

Confidential Well-formed XML Elements can not overlap This is bold text.

Confidential

Well-formed XML

Elements can not overlap


This is bold text. This

is bold italic text. This is italic text.

This is bold text. This is bold italic text. This is italic text.
Слайд 40

Confidential Well-formed XML All attribute values must be enclosed in quotes

Confidential

Well-formed XML

All attribute values must be enclosed in quotes


name="John" surname='Doe'/>



I & my dog

I & my dog

<,>, & Can not be used in text blocks

Слайд 41

Confidential Well-formed XML Unlike HTML, XML does not cut blanks and

Confidential

Well-formed XML

Unlike HTML, XML does not cut blanks and blank lines

Hello my name is Tove

Hello my name is Tove

For example, in HTML

We will get

Слайд 42

Confidential XML and HTML. Semantics The values of the elements defined

Confidential

XML and HTML. Semantics

The values of the elements defined in the

HTML rigidly
Semantics and structure of elements in XML can be different
There are several approaches to describe the structure of XML (Schema and DTD)
XSLT can be used to effectively transform the XML document in any format: HTML, Plain text, XML, JavaScript, and others.
Слайд 43

Confidential Pros of XML format Creation of own named structures for

Confidential

Pros of XML format

Creation of own named structures for storage of

information
Task of analysis (parsing) XML is well-formalized and there are many implementations
XML uses Unicode, that is simplifies internationalization
Checking the document structure and data types is a standard operation
XML - is a text format, easy to read and debug
Tools for work with XML are available on all platforms
XML allows you to use the infrastructure, created for HTML, including HTTP and some browsers
Слайд 44

Confidential Cons of XML format XML documents are usually less concise

Confidential

Cons of XML format

XML documents are usually less concise than comparable

binary formats
Transferring of XML creates more traffic or more CPU overhead when using compression
XML parsing can be slower and more demanding of memory than parsing optimized binary documents
Слайд 45

Confidential Component parts of XML document Prologue Elements Processing instructions Comments

Confidential

Component parts of XML document

Prologue
Elements
Processing instructions
Comments
Attributes
Pointers
Text blocks
CDATA blocks
Namespaces

Слайд 46

Confidential Prologue href="show_book.xsl"?> … Prologue Prologue - this is part of

Confidential

Prologue


href="show_book.xsl"?>



Prologue

Prologue - this is part of the XML document from the beginning to the opening tag of the root element
Prologue includes information relating to the entire document, such as the encoding of the document structure
Prolog can contains comments

Слайд 47

Confidential XML declaration version="1.0" encoding="UTF-8" standalone="yes" XML declaration is usually the

Confidential

XML declaration


version="1.0"

encoding="UTF-8"

standalone="yes"

XML declaration is usually the first line

in the XML document
XML declaration may contains the following information:
Version number:
- An indication of the character encoding in which the document is written: - Parameter «standalone» which indicates whether the prohibited links to external documents:
Слайд 48

Confidential Processing instructions href="show_book.xsl"?>

Confidential

Processing instructions

href="show_book.xsl"?>

try /style.css ?>
Слайд 49

Confidential The DOCTYPE declaration declarations ]>

Confidential

The DOCTYPE declaration
declarations
]>

Слайд 50

Confidential Elements Kress, Peter Paradox Lost Science Fiction 6.95

Confidential

Elements


Kress, Peter
Paradox Lost
Science Fiction
6.95

Слайд 51

Confidential Tags att2Name="att2Value" ...> att2Name="att2Value" ... /> Tags define the boundaries

Confidential

Tags

att2Name="att2Value" ...>


att2Name="att2Value" ... />

Tags define

the boundaries of the element
Opening tags indicate the start of an element:
End tags mark the end of an element. They haven’t attributes:
Empty tags are used to create elements without text content. They may include attributes:
It is believed that the element includes an opening and closing tags and everything in between
Слайд 52

Confidential Comments Here some notes about document can be placed -->

Confidential

Comments


-->
>



Слайд 53

Confidential Text blocks Instead of characters , & the& lt; &

Confidential

Text blocks

Instead of characters <,>, & the& lt; & gt; and

& amp should be used;


This is text block

This is another text block. Symbols <, > and & can’t be used directly.

Слайд 54

Confidential Pointers to characters and entities Pointers are used when it

Confidential

Pointers to characters and entities

Pointers are used when it is impossible

or undesirable to include a character or string "directly“
Pointer to start with an ampersand & and end with a semicolon (;)
Pointers to characters provide an opportunity to include in the document Unicode characters using the number
& # value; - The syntax for the decimal indicator
& # xvalue; - The syntax for hexadecimal pointers.
Слайд 55

Confidential Pointers to characters Some of the most frequently used pointers to characters.

Confidential

Pointers to characters

Some of the most frequently used pointers to characters.

Слайд 56

Confidential CDATA Blocks CDATA sections give information for parser that there

Confidential

CDATA Blocks

CDATA sections give information for parser that there are no

markup characters within them;
CDATA can not contains another CDATA blocks;
Characters inside CDATA should be from class of allowed XML documents
John Smith
John Smith]]>

,]]>

Слайд 57

Confidential Attributes #ff08ff white name="Arial">Black

Confidential

Attributes
#ff08ff
white
name="Arial">Black

Слайд 58

Confidential Usage of Namespaces XML namespace – is the collection of

Confidential

Usage of Namespaces

XML namespace – is the collection of the names

identifiable by reference URI [RFC2396], that is used in XML documents to indicate the element types and attribute naming.
XML namespace differs from the "namespaces", that are commonly used in computer science, in that it is an XML option has an internal structure, and from a mathematical point of view, is not a set.
Слайд 59

Confidential The scope of namespace Namespace refers to an element where

Confidential

The scope of namespace

Namespace refers to an element where it was

declared and to all child elements





Frobnostication



Moved tohere.



Слайд 60

Confidential XSD

Confidential

XSD

Слайд 61

Confidential What is XML schema (XSD)? XML Schema definition language (XSD)

Confidential

What is XML schema (XSD)?

XML Schema definition language (XSD) –

language for XML documents and data
2 May 2001, World Wide Web Consortium (W3C) published version 1.0 standard XSD.
XML Schema describes elements of XML document
Describes attributes in XML
Describes child nodes, following and size
Describes types of data for elements and attributes
Слайд 62

Confidential Why we need schemes? Server-side programmer Client-side programmers

Confidential

Why we need schemes?

Server-side programmer

Client-side
programmers

Слайд 63

Confidential Creation of XML Schema targetNamespace="http://www.epam.com" xmlns="http://www.epam.com" elementFormDefault="qualified"> ... Element -

Confidential

Creation of XML Schema


targetNamespace="http://www.epam.com"
xmlns="http://www.epam.com"
elementFormDefault="qualified">
...

Element

- root element of every XML schema
xmlns:xs="http://www.w3.org/2001/XMLSchema" - Namespace declaration of the XML schema with the prefix xs
targetNamespace="http://www.epam.com" – namespace for this scheme is applied
xmlns="http://www.epam.com" – the default namespace (no prefix)
elementFormDefault="qualified" - all elements must be namespace qualified
Слайд 64

Confidential Simple elements Elements are declared using the element . A

Confidential

Simple elements

Elements are declared using the element .
A simple element can

only contain text.
A simple element can not contain attributes.
Declares a simple type (basic type or the new type with the extension or restriction of the base type using the element c simpleType).










Слайд 65

Confidential Attributes Attributes are declared using the element Attribute is always

Confidential

Attributes

Attributes are declared using the element
Attribute is always declared simple

type
For an attribute, you can specify a default value or a fixed value


Smith



Слайд 66

Confidential Simple Type SimpleType element defines a simple type elements or

Confidential

Simple Type

SimpleType element defines a simple type elements or attributes, imposing

restrictions or extensions on the basic types
Can be named or anonymous within an element (attribute)
Describe the elements of "age" which can have numeric values from 0 to 100 inclusive








101

Not valid element

Слайд 67

Confidential Complex Type Composite type describes the element that contains other

Confidential

Complex Type

Composite type describes the element that contains other elements and

/ or attributes
The composite type is described by an element complexType
Can be named or anonymous inside the cell











Слайд 68

Confidential Element simpleContent For expansion / composite type restrictions that may

Confidential

Element simpleContent

For expansion / composite type restrictions that may contain only

the contents of the text element is used simpleContent
Used to add attributes










Слайд 69

Confidential Element complexContent ComplexContent element serves to expand or limit the types of compound, previously announced

Confidential

Element complexContent

ComplexContent element serves to expand or limit the types of

compound, previously announced


















Слайд 70

Confidential Types Types of elements / attributes can be Local and

Confidential

Types

Types of elements / attributes can be
Local and anonymous (in the

body of the element element)
Global and named (directly in the element schema)

















Слайд 71

Confidential Using of elements and attributes On the named element and

Confidential

Using of elements and attributes

On the named element and attribute declarations

can be referenced using the ref attribute














Слайд 72

Confidential Base types XML schema contains 44 base types. General: string decimal integer boolean date time

Confidential

Base types

XML schema contains 44 base types. General:
string
decimal
integer
boolean
date
time

Слайд 73

Confidential Restrictions Restrictions used for control of possible values of elements and XML attributes.

Confidential

Restrictions

Restrictions used for control of possible values of elements and XML

attributes.
Слайд 74

Confidential Restrictions for values List restriction

Confidential

Restrictions for values


















 

List restriction

Слайд 75

Confidential Template restriction Restriction in one lower case letter Restriction in three upper case letters

Confidential

Template restriction















Restriction in one lower case letter

Restriction in three upper case letters

Слайд 76

Confidential Restriction for length Value contains 8 symbols Max and min size of symbols

Confidential

Restriction for length








name="password">







Value contains 8 symbols

Max and min size of symbols

Слайд 77

Confidential White spaces restriction Restriction whiteSpace can have 3 values: preserve

Confidential

White spaces restriction

Restriction whiteSpace can have 3 values:
preserve – leave all

white spaces as they are
replace – replace all such symbols with one
collapse – delete all white spaces before and after








Слайд 78

Confidential Indicators XML Schema has 7 element – indicators, which describes

Confidential

Indicators

XML Schema has 7 element – indicators, which describes behavior

of elements and attributes in XML
Indicators following:
all
choice
sequence
Indicators input:
maxOccurs
minOccurs
Indicators group:
group
attributeGroup
Слайд 79

Confidential Following indicators Every following Only one from elements

Confidential

Following indicators

















Every following

Only one from elements

Слайд 80

Confidential Following indicators Strength following

Confidential

Following indicators









Strength following

Слайд 81

Confidential Input indicators For size of input of element Default - one. minOccurs=1 maxOccurs=1 maxOccurs="10"/>

Confidential

Input indicators

For size of input of element
Default - one.
minOccurs=1
maxOccurs=1





maxOccurs="10"/>



Слайд 82

Confidential Indicators input Indicator maxOccurs can have min value – 10,minOccurs

Confidential

Indicators input

Indicator maxOccurs can have min value – 10,minOccurs value 0
For

every count - maxOccurs="unbounded"





minOccurs="0" maxOccurs="10"/>



can be missed, or follow after max 10 time

Слайд 83

Confidential Indicator group Binding of set of elements and attributes

Confidential

Indicator group

Binding of set of elements and attributes



name="firstname" type="xs:string"/>











Слайд 84

Confidential Element unique Attribute or element value should be unique {any

Confidential

Element unique

Attribute or element value should be unique
{any

attributes with non-schema Namespace}...>
Content: (annotation?, selector, field+)

Слайд 85

Confidential Unique – Example country="Italy"/> country="France"/> country="Germany"/> country="France"/> country="Italy"/> country="Italy"/> maxOccurs="unbounded"/> Not according to the rule

Confidential

Unique – Example



country="Italy"/>

country="France"/>
country="Germany"/>
country="France"/>
country="Italy"/>
country="Italy"/>




maxOccurs="unbounded"/>







Not according to the rule

Слайд 86

Confidential Schema documentation Can us simple XML comments Annotations can appear

Confidential

Schema documentation

Can us simple XML comments

Annotations

can appear everywhere in schema
- parent for appinfo> and
- info for external apps
- comments for developers



Schema for processing submitted applications
Submitted for Human Resources




No further processing is required.
This element is for determining relocation status to determine help determine costs.




Слайд 87

Confidential Describe ref to XSD in XML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.epam.com note.xsd"> Tove

Confidential

Describe ref to XSD in XML


xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.epam.com note.xsd">

Tove
Jani
Reminder
Don't forget me this weekend!

Namespace

Location of schema

xmlns="http://www.epam.com" - default namespace
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.epam.com note.xsd" - show which schema is correspond to current XML and where is present schema for validation of current XML

Слайд 88

Confidential Describing of ref to XSD in XML xsi:noNamespaceSchemaLocation is used,

Confidential

Describing of ref to XSD in XML

xsi:noNamespaceSchemaLocation is used, when namespace

is not used
Можно использовать URL файловой системы
xsi:schemaLocation is used, when prefix of spaces is described and used


Presenting XML
Richard Light

xsi:noNamespaceSchemaLocation=“file:///d:/xml/schemas/epam.xsd"

xmlns:data="http://www.epam.com"
xsi:schemaLocation="http://www.epam.com
http://www.epam.com/epam.xsd">
...

Слайд 89

Confidential What was learnt for today?

Confidential

What was learnt for today?

Слайд 90

Confidential What was learnt for today? Web application / Web site

Confidential

What was learnt for today?

Web application / Web site /

Web Server
Web service
XML and how to create XML
XSD and how to create XSD