Service Oriented Architecture

Download Report

Transcript Service Oriented Architecture

Service Oriented Architecture

Lecture 1: Introduction 95-843: Service Oriented Architecture Master of Information System Management

1

Plan for the week

• • • • • • Course Introduction Some principles and definitions Some Theory Technology Foundations Homework 1 Getting logged on to Oracle ’ s SOA Suite 95-843: Service Oriented Architecture Master of Information System Management

2

Course Web Site

• http://www.andrew.cmu.edu/~mm6 95-843: Service Oriented Architecture Master of Information System Management

3

Course Software

• • We will be using Oracle SOA Suite 11g R1 for projects and demonstrations.

It will be assumed the the student is able to program in Java and use an IDE.

95-843: Service Oriented Architecture Master of Information System Management

4

Structure of the Course

• Lectures/class participation • Homework (pencil and paper and programming) • Midterm exam • Readings from IBM • Presentations • Final examination ’ s High level reference architecture will be assigned. • Reading from the required course text and the web will be assigned.

95-843: Service Oriented Architecture Master of Information System Management

5

Readings

• • • For this week, read the Introduction to Petri Nets and the paper “ A Petri Net-based Model for Web Service Composition ” . Read Chapter One of “Oracle SOA Suite 11g R1”.

Read the Introduction and Chapter 1 of “Understanding SOA with Web Services”.

95-843: Service Oriented Architecture Master of Information System Management

6

What is architecture?

Victorian Gothic or Neo-Gothic architecture

95-843: Service Oriented Architecture Master of Information System Management

7

Victorian Free Classical style 95-843: Service Oriented Architecture Master of Information System Management Adelaide Town Hall

8

Architecture From Reynolds Text

• Architecture implies a consistent and coherent design approach. Essential principles include: • Consistency: The same challenges should be addressed in a uniform way.

• Reliability: purpose and meet the demands for which they are designed.

The structures created must be fit to • Extensibility: A design must provide a framework that can be expanded in ways both foreseen and unforeseen.

• Scalability: The implementation must be capable of being scaled to accommodate increasing load by adding hardware to the solution.

95-843: Service Oriented Architecture Master of Information System Management

9

Why is SOA Different?

(1 ) Terminology : Both IT people and business people know what a service is.

(2) Interoperability : The interfaces and the wire protocols are based on standards.

(3) Extension and Evolution not rip and replace.

(4) Reuse of both functionality and machine resources.

95-843: Service Oriented Architecture Master of Information System Management Chapter one of Reynolds

10

SOA Defined

• “ SOA is the architectural style that supports set based loosely coupled interoperable of business-aligned services to enable business flexibility in an , technology agnostic manner. SOA consists of a composite services that support a flexible and dynamically re configurable end-to-end business process realization using interface service descriptions .

” From a paper by Borges, Holley and Arsanjani .

95-843: Service Oriented Architecture Master of Information System Management

11

Web Services Preferred(1)

• Web Services are XML-based technologies for messaging, service descriptions, discovery, and external features providing: - Pervasive open standards for distributed computing interface descriptions and document exchange via messages From Newcomer 95-843: Service Oriented Architecture Master of Information System Management

12

Web Services Preferred(2)

- Independence from the underlying execution environment and application platforms.

- Extensibility for enterprise qualities of service such as security, reliability, and transactions.

- Support for composite applications such as business process flows, multi-channel access, and rapid 95-843: Service Oriented Architecture integration Management

13

XML Preferred (1)

• The Extensible Markup Language is a common, independent data format across the enterprise and beyond that provides: - Standard data types and structures, independent of any programming language, development environment or software system.

From Newcomer 95-843: Service Oriented Architecture Master of Information System Management

14

XML Preferred (2)

- Pervasive technology for defining business documents and exchanging business information, including standard vocabularies for many industries.

- Ubiquitous software for handling operations on XML, including parsers, queries, and transformations. 95-843: Service Oriented Architecture Master of Information System Management From Newcomer

15

Build an SOA in 8 Steps

(1) Business needs come first (not services) What problem are we trying to solve?

(2) What aspects can be implemented as services? Old services? New services? Legacy wrappers?

(3) Track services with registries and repositories.

95-843: Service Oriented Architecture Master of Information System Management Modified from a talk by Daryl Plummer of Gartner.

Build an SOA in 8 Steps

(4) Govern the services. We need to encourage desired behavior at many levels, across enterprises, and at different stages. We need to monitor behavior, enforce policies & assess user satisfaction.

95-843: Service Oriented Architecture Master of Information System Management

17

Build an SOA in 8 Steps

(5) Secure the services. Using established standards, we need privacy, identification, authentication, and authorization. This may need to be federated security (over more than one organization.) 95-843: Service Oriented Architecture Master of Information System Management

18

Build an SOA in 8 Steps

(6) Manage the services. Are messages arriving on time? Is everything operating properly?

(7) Virtualization through mediation. Are we free to move and change the services? Do we need an ESB that acts as a central hub for message routing and transformations?

(8) Design for interoperability through the adoption of standards.

95-843: Service Oriented Architecture Master of Information System Management

19

Objectives of This Course

(1) Study Foundations of SOA Mathematical models (Petri nets) Important standards Orchestration and Choreography The Enterprise Service Bus Reference Architectures Enterprise Integration Patterns (2) Get hands on experience with Oracle’s SOA Suite of tools.

95-843: Service Oriented Architecture Master of Information System Management

20

A Mathematical Foundation

• Petri Nets • Petri Nets as applied to Web Services • Why not flow charts?

• Why not UML sequence diagrams?

• We want to work at a higher level and exploit parallel execution.

• Plus, Petri nets are cool!

95-843: Service Oriented Architecture Master of Information System Management

21

Petri Nets

Consider the following program: a = 1; b = 2; c = 3; a = a + 1; What is the normal process order?

Other orderings are possible. c = b + c; b = a + c; 95-843: Service Oriented Architecture Master of Information System Management

22

Petri Nets

A Petri net is a directed graph G = (V,E), where V = P U T and P  T =  . Any edge e in E is incident on one member of P and one member of T. The set P is called the set of places (conditions) and the set T is the set of transitions (events).

95-843: Service Oriented Architecture Master of Information System Management

23

Petri Nets

Places are typically drawn as circles and transitions as bars.

p1 t1 p2 p3 t2 95-843: Service Oriented Architecture Master of Information System Management p4 t3

24

Petri Net G = (V,E)

P = {p1,p2,p3,p4} T = {t1,t2,t3} E = {(p1,t1),(t1,p2),(p2,t3),(p3,t1),(p3,t2),(t2,p4),(p4,t3)} p1 t1 p2 t3 p3 t2 95-843: Service Oriented Architecture Master of Information System Management p4

25

A Marked Petri Net

A marking of a Petri net assigns each place a nonnegative integer n. We say each place p is marked with n tokens. Tokens are represented as black dots. ** p1 t1 p2 t3 * t2 p3 95-843: Service Oriented Architecture Master of Information System Management * p4

26

Firing Transitions

In a Petri net, if an edge is directed from place p to transition t, we say p is an input place for transition t. An output place is defined similarly. If every input place for a transition t has at least one token, we say that t is enabled. A firing of an enabled transition removes one token from each input place and adds one token to each output place. A transition can fire only if it ’ s enabled. Firing a transition is an 95-843: Service Oriented Architecture atomic operation.

27

Fire Transition t1 (ready?)

** p1 t1 * t2 p3 95-843: Service Oriented Architecture Master of Information System Management p2 * p4 t3

28

Transition t1 Fired

* p1 t1 t2 p3 95-843: Service Oriented Architecture Master of Information System Management * p2 * p4 t3

29

Fire Transition t3 (Ready?)

* p1 t1 t2 p3 95-843: Service Oriented Architecture Master of Information System Management * p2 * p4 t3

30

Transition t3 Fired

* p1 t1 p2 t2 p3 95-843: Service Oriented Architecture Master of Information System Management p4 t3

31

Petri Nets

Consider again the following program: a = 1; b = 2; c = 3; a = a + 1; c = b + c; b = a + c; 95-843: Service Oriented Architecture Master of Information System Management

32

* p1

Modeled as a Petri Net

a=1 a=a+1 p4 b=2 b=a+c p7 * p2 p5 c=b+c c=3 p3 * p6 p8 95-843: Service Oriented Architecture Master of Information System Management

33

p9

* p1

Fire Transitions (ready?)

a=1 a=a+1 p4 b=2 b=a+c p7 * p2 p5 c=b+c c=3 p3 * p6 p8 p9 95-843: Service Oriented Architecture Master of Information System Management

34

p1 p2 p3

Transitions Fired

a=1 a=a+1 b=2 p4 * * p7 b=a+c c=b+c p5 c=3 * p8 p6 p9 95-843: Service Oriented Architecture Master of Information System Management

35

p1

Fire Transitions (Ready)

a=1 a=a+1 b=2 p4 * * p7 b=a+c c=b+c p2 p5 c=3 * p8 p6 p3 95-843: Service Oriented Architecture Master of Information System Management

36

p9

Transitions Fired

a=1 a=a+1 p1 p2 b=2 c=3 p4 p5 p3 p6 95-843: Service Oriented Architecture Master of Information System Management * p7 c=b+c * p8 b=a+c

37

p9

Fire Last Transition (Ready?)

a=1 a=a+1 p1 b=2 p4 * p7 b=a+c c=b+c p2 p5 c=3 * p8 p9 p6 p3 95-843: Service Oriented Architecture Master of Information System Management

38

p1 p2

Last Transition Fired

a=1 a=a+1 p4 b=2 b=a+c p7 c=b+c p5 c=3 p8 p3 p6 95-843: Service Oriented Architecture Master of Information System Management

39

* p9

In This Class

All of our Petri Nets will begin with a single input place and end with a single output place.

We will always start the Petri Net off with a single token in the input place.

95-843: Service Oriented Architecture Master of Information System Management

40

Modeling a process

When a flight lands, passengers are asked to remain seated until the plane stops and the seat belt sign is off. Then, people gather their belongings and leave the plane. At that point, each seat area is checked by two flight attendants.

How would you model this business process with a Petri net?

95-843: Service Oriented Architecture Master of Information System Management

41

Two Quizzes (Take out pencil and paper)

(1) The Petri Net we drew begins with three markings.

Redraw the Petri net so that it begins with a single marking.

(2) Build a Petri net to wash a lion based on the following steps.

1. Get lion.

2. Get soap. (real soap not SOAP) 3. Get tub.

4. Put water in tub.

5. Put lion in tub.

6. Wash lion with soap.

7. Rinse lion.

8. Remove lion from tub.

9. Dry lion.

Master of Information System Management

42

Liveness

A Petri net is

deadlocked

if no transition can fire.

A marking M for a Petri net is additional firing sequence.

live

if, beginning from M, no matter what sequence of firings has occurred, it is possible to fire any given transition by processing through some If a marking M is live for a Petri net P, then no matter what sequence of transitions is fired, P will never deadlock. Indeed, we can fire any transition by proceeding through some additional firing sequence.

95-843: Service Oriented Architecture Master of Information System Management

43

Deadlock Example

Case: Person 1 requests disk drive D. D is ready.

Person 1 requests printer P. P is ready.

Person 1 uses and releases P and D. P and D are available.

Case: Person 1 requests disk drive D. D is ready.

Person 2 requests printer P. P is ready.

Person 1 is waiting for person 2 to release P.

Person 2 is waiting for person 1 to release D.

No transitions can fire and we have deadlock.

95-843: Service Oriented Architecture Master of Information System Management

44

D available * Request D Finished with D and P D ready Release D and P Process P ready Request D D ready Finished with D and

P

Process Release D and P P ready Request P P available * Person 1 95-843: Service Oriented Architecture Master of Information System Management Person 2 Request P

45

Deadlock

Four Requirements for deadlock: (1) Resources need mutual exclusion. They are not thread safe.

(2) Resources may be reserved while a process is waiting for more.

(3) Preemption is not allowed. You can't force a process to give up a resource.

(4) Circular wait is possible. X wants what Y has and Y wants what Z has but Z wants what X has.

Solutions (short course ): Prevention (disallow one of the four) Avoidance (study what is required by all before beginning) Detection and recovery (reboot if nothing is getting done) 95-843: Service Oriented Architecture Master of Information System Management

Petri Nets Service Algebra

Petri Nets may be represented with an algebra: S ::  X  S 1 S 1   S 1 ◊  S 2  S 2  S 2  µS  S 1 (S   c S S 2  2 ) --> S 3  The service that does nothing A basic service S 1 S 1 followed by S 2 xor S 2 arbitrary sequence iteration on S As soon as S 1 or S 2 Sequence operator parallel with communication do S 3 [S 1 (p 1 ,q 1 ):(S N (p n ,q n )]| dynamically select one of many to execute Ref(S 1 ,a,S 2 ) Do S 1 with any ‘ a ’ operations replaced by S 2 Each operation returns a service that may or may not be involved with other operations.

95-843: Service Oriented Architecture Master of Information System Management

47

The Empty Service

 * P 95-843: Service Oriented Architecture Master of Information System Management

48

S 1

Service S

1

i 1 * : :  : : 95-843: Service Oriented Architecture Master of Information System Management o 1

49

S 2

Service S

2

* i 2 : :   : : 95-843: Service Oriented Architecture Master of Information System Management o 2

50

S 3

Service S

3

i 3 * : : : : 95-843: Service Oriented Architecture Master of Information System Management o 3

51

S 1

Sequence S

1

S

2

* i = i 1 : : : : o 1 S 2 i 2 : : 95-843: Service Oriented Architecture Master of Information System Management o=o 2

52

Alternative S

1

  i

S

2

S 2 i 2 S 1 … …  i 1 …  …  o 1 o 2 95-843: Service Oriented Architecture Master of Information System Management o

53

Arbitrary Sequence S

1

 ◊

S

2

p 1 p 2 p 3 S 2 S 1 i 1 i 2    o 1 o 2 p 4 95-843: Service Oriented Architecture Master of Information System Management p 5

54

 S 1

Services

µ

S1

… …  i 1 … … ..

o 1 o 95-843: Service Oriented Architecture Master of Information System Management

55

S 1

Services S1 ||c S2

 S 2 i 1 i 2 p 1    p 2 o 1 95-843: Service Oriented Architecture Master of Information System Management o o 2

56

Services (S1|S2) ~>S3 S 1 i 1  S 2   o 1 p 1 This operation is a discriminator.

S1 and S2 may be two services providing the results of the same complex query. We take the first to complete.

S 3 i 3 o 3 95-843: Service Oriented Architecture Master of Information System Management o p 2 i 2 o 2  Will wait until S 1 S 2 completes or Will wait for the later one to complete

57

S 1 p 1 i 1 i send_req_serv  S n

Services [S 1 (p 1 ,q 1 ):S n (p n ,q n )]

i n p n o 1 … q 1 rec_req_1 rec_req_n send_resp_1 send_resp_n q n u select_serv … p q 95-843: Service Oriented Architecture Master of Information System Management o … o n Assume middle branch gains info on service qualities. The two services provide two entry points.

58

An Example of Refinement

S 1  i 1 assess_claim indemnity_customer o 1 convoke_customer 95-843: Service Oriented Architecture Master of Information System Management

59

An Example of Refinement

i  S 2  i 2 assess_simple_claim assess_complex_claims assess_simple_claim assess_complex_claim indemnify_customer convoke_customer o 2 o Ref(S1,assess_claim,S2) 95-843: Service Oriented Architecture Master of Information System Management

60

Example Service (SM || c1 ( OCS|| c2 IP))

OCS : Online Computing Store SM : Sony Monitors IP : Intel Processors The Online Computing Store needs Sony monitors and Intel processors.

95-843: Service Oriented Architecture Master of Information System Management

61

Example Service SM || c1 ( OCS|| c2 IP)

SM 

OCS ||

OCS

c2 IP

rec_ord_pc rec_ord_mon send_del_mon send_ord_mon send_ord_pr rec_del_pr rec_del_mon assemble_PC o 95-843: Service Oriented Architecture Master of Information System Management IP rec_ord_pr send_del_pr

62

A Quiz

Describe this web service in words.

Ref(S 1 , assess_claim, [A 1 :A n ]) 95-843: Service Oriented Architecture Master of Information System Management

63

Properties of The Service Algebra Each operation returns a web service.

S 1  (S 2  S 3 ) = (S 1  S 2 )  S 3   S = S S   = S S 1  S 2 = S 2  S 1 S 1  (S 2  S  S = S S 3 ) = (S 1  S 2 )  S 3 (S 1 S 1   S 2 )  S 2 = (S 1 S 3  = (S 1  S 3 )  (S 2  S 2 )  (S 2  S 1 ) S 3 ) (1) (2) (3) (4) (5) (6) (7) (8) 95-843: Service Oriented Architecture Master of Information System Management

64

Desired Properties of the Service Algebra

  =  S 1  c S 2 = S 2  c S 1 S 1   (S 2   S 3 ) = (S 1   S 2 )   S 3 S    = S (S 1  S 2 ) ~>S 3 = (S 2  S 1 ) ~> S 3 (S 1   ) ~> S 2 = S 1   S 2 (S 1  S 2 ) ~>  = S 1   S 2 (9) (10) (11) (12) (13) (14) (15) 95-843: Service Oriented Architecture Master of Information System Management

65

Desired Properties of the Service Algebra

n

 {i 1 ,…,i n } ={1,…,n}  Select the best of n services w/o concern for initial state names.

i

{i1,…,in}

S i =  S i

i=1

(16) If S j Ref(S = 1  then 

n i=1

S i ,a,S 2 ) = S 1 = 

n

S i

i=1,i

j

if a  L 1 (T 1 ) Don ’ t select the empty service.

If a is not an operation then no refinement.

(17) (18) S 1  S 2 = S 2  S 1 (from (8) and (4)) (19) S  S = S  S (from (8) and (6)) S   = S (from (8), (2), (3), and (6)) (20) (21) 95-843: Service Oriented Architecture Master of Information System Management

66

Example Proof

Prove: S 1  S 2 = S 2  S 1 S 1  S 2 = (S 1  S 2 )  (S 2  S 1 ) (S 1  S 2 )  (S 2  S 1 ) = (S 2  S 1 )  (S 1  S 2 ) = S 2  S 1 95-843: Service Oriented Architecture Master of Information System Management

67