Service Oriented Architecture OOD Course What is SOA

  • Slides: 41
Download presentation
Service Oriented Architecture OOD Course

Service Oriented Architecture OOD Course

What is SOA? “SOA is the practice of sequestering the core business functions into

What is SOA? “SOA is the practice of sequestering the core business functions into independent services that don’t change frequently. These services are glorified functions that are called by one or more presentation programs. The presentation programs are volatile bits of software that present data to, and accept data from, various users. ” Robert Martin, “What is SOA, really? ” 2

Example Some ECommerce Application Product Catalog Service 3 User Authentication Service Money Exchange Rate

Example Some ECommerce Application Product Catalog Service 3 User Authentication Service Money Exchange Rate Service Warehouse Management Service Clearance Service

More Generic Structure 4 Application 1 Application 2 … Application N Service 1 Service

More Generic Structure 4 Application 1 Application 2 … Application N Service 1 Service 2 … Service M

HOW COULD IT WORK? 5

HOW COULD IT WORK? 5

Direct Communication Browser Web Server App Server DB Server Application 6 Service

Direct Communication Browser Web Server App Server DB Server Application 6 Service

Non-blocked, Synchronous Browser Web Server Application App Server Orchestration Process DB Server Message Queue

Non-blocked, Synchronous Browser Web Server Application App Server Orchestration Process DB Server Message Queue 7 App Server Service

Non-blocked, Asynchronous Browser Web Server Application App Server Orchestration Process DB Server Message Queue

Non-blocked, Asynchronous Browser Web Server Application App Server Orchestration Process DB Server Message Queue 8 App Server Service

Enterprise Service Bus Browser Web Server App Server ESB Adapter DB Server 9 ESB

Enterprise Service Bus Browser Web Server App Server ESB Adapter DB Server 9 ESB

Service Registry Application 1 Service Registry 10

Service Registry Application 1 Service Registry 10

Requirements • Loose coupling of services with OS/technology • Interoperability – Messages • •

Requirements • Loose coupling of services with OS/technology • Interoperability – Messages • • • Federation of resources (database) Abstraction Reusabillity Autonomy Stateless Discoverability

Web Service • Piece of software available over Internet • Uses standardized (i. e.

Web Service • Piece of software available over Internet • Uses standardized (i. e. , XML) messaging system • More general definition: collection of protocols and standards used for exchanging data between applications or systems

Web Services Architecture • Technologies capable of – Exchanging messages – Describing Web services

Web Services Architecture • Technologies capable of – Exchanging messages – Describing Web services – Publishing and discovering Web service descriptions

An Example: EMBL • EMBL nucleotide sequence database – http: //www. ebi. ac. uk/cgi-bin/dbfetch

An Example: EMBL • EMBL nucleotide sequence database – http: //www. ebi. ac. uk/cgi-bin/dbfetch – X 12399 • provide data • Web services can also perform analysis • Example: sequence similarity using Clustal. W: – http: //www. ebi. ac. uk/clustalw/

Observations • Web services useful for both retrieval and analysis – Leverage existing programs/data

Observations • Web services useful for both retrieval and analysis – Leverage existing programs/data – “Service-oriented science” • What if I want to analyze 100 s of objects?

Service-Oriented Science • Idea: need standards and interfaces to encapsule information tools as services

Service-Oriented Science • Idea: need standards and interfaces to encapsule information tools as services • No knowledge of inner workings required • Service oriented architecture: systems as networks of loosely-coupled, communicating services • Service oriented science: scientific research enabled by networks of interoperating services

Advantages for Scientists • Data on the web, not in the lab • Automate

Advantages for Scientists • Data on the web, not in the lab • Automate time-consuming activities • Infrastructure issues – Share compute resources • Automation – Enables programs to process large volumes of data quickly

Creating and Sharing Services • Describe operations service supports • Define protocol to invoke

Creating and Sharing Services • Describe operations service supports • Define protocol to invoke services over Internet • Operate server to process incoming requests

Some Web Service Standards • SOAP (Simple Object Access Protocol) – Standard for sending

Some Web Service Standards • SOAP (Simple Object Access Protocol) – Standard for sending messages between applications • WSDL (Web Service Description Language) – Standard for describing web services and their capabilities • REST (Representational State Transfer) – Architecture style of networked systems

SOAP 20

SOAP 20

SOAP • Simple Object Access Protocol • Is a lightweight protocol intended for exchanging

SOAP • Simple Object Access Protocol • Is a lightweight protocol intended for exchanging structured information in a decentralized, distributed environment • Uses XML technologies to define an extensible messaging framework providing a message construct that can be exchanged over a variety of underlying protocols • Platform and language independent • Simple and extensible • Stateless, one-way • Designed to be independent of any particular programming model and other implementation specific semantics 21

SOAP Building Blocks • Envelope (required) – identifies XML document as SOAP message •

SOAP Building Blocks • Envelope (required) – identifies XML document as SOAP message • Header (optional) – contains header information • Body (required) –call and response information • Fault (optional) – errors that occurred while processing message

SOAP Message Structure 23

SOAP Message Structure 23

SOAP Data Message: Header <? xml version='1. 0' ? > <env: Envelope xmlns: env="http:

SOAP Data Message: Header <? xml version='1. 0' ? > <env: Envelope xmlns: env="http: //www. w 3. org/2003/05/soap-envelope"> <env: Header> <m: reservation xmlns: m="http: //travelcompany. example. org/reservation” env: role=“http: //www. w 3. org/2003/05/soap-envelope/role/next” env: must. Understand="true"> <m: reference>uuid: 093 a 2 da 1 -q 345 -739 r-ba 5 d-pqff 98 fe 8 j 7 d</m: reference> <m: date. And. Time>2001 -11 -29 T 13: 20: 00. 000 -05: 00</m: date. And. Time> </m: reservation> <n: passenger xmlns: n="http: //mycompany. example. com/employees" env: role="http: //www. w 3. org/2003/05/soap-envelope/role/next" env: must. Understand="true"> <n: name>Åke Jógvan Øyvind</n: name> </n: passenger> </env: Header> 24

SOAP Data Message: Body <env: Body> <p: itinerary xmlns: p="http: //travelcompany. example. org/reservation/travel"> <p:

SOAP Data Message: Body <env: Body> <p: itinerary xmlns: p="http: //travelcompany. example. org/reservation/travel"> <p: departure> <p: departing>New York</p: departing> <p: arriving>Los Angeles</p: arriving> <p: departure. Date>2001 -12 -14</p: departure. Date> <p: departure. Time>late afternoon</p: departure. Time> <p: seat. Preference>aisle</p: seat. Preference> </p: departure> <p: return> <p: departing>Los Angeles</p: departing> <p: arriving>New York</p: arriving> <p: departure. Date>2001 -12 -20</p: departure. Date> <p: departure. Time>mid-morning</p: departure. Time> <p: seat. Preference/> </p: return> </p: itinerary> <q: lodging xmlns: q="http: //travelcompany. example. org/reservation/hotels"> <q: preference>none</q: preference> </q: lodging> </env: Body> </env: Envelope> 25

SOAP RPC <? xml version='1. 0' ? > <env: Envelope xmlns: env="http: //www. w

SOAP RPC <? xml version='1. 0' ? > <env: Envelope xmlns: env="http: //www. w 3. org/2003/05/soap-envelope" > <env: Header> <t: transaction xmlns: t="http: //thirdparty. example. org/transaction" env: encoding. Style="http: //example. com/encoding" env: must. Understand="true" >5</t: transaction> </env: Header> <env: Body> <m: charge. Reservation env: encoding. Style="http: //www. w 3. org/2003/05/soap-encoding" xmlns: m="http: //travelcompany. example. org/"> <m: reservation xmlns: m="http: //travelcompany. example. org/reservation"> <m: code>FT 35 ZBQ</m: code> </m: reservation> <o: credit. Card xmlns: o="http: //mycompany. example. com/financial"> <n: name xmlns: n="http: //mycompany. example. com/employees"> Åke Jógvan Øyvind </n: name> <o: number>123456789099999</o: number> <o: expiration>2005 -02</o: expiration> </o: credit. Card> </m: charge. Reservation> </env: Body> </env: Envelope> 26

SOAP RPC Response <? xml version='1. 0' ? > <env: Envelope xmlns: env="http: //www.

SOAP RPC Response <? xml version='1. 0' ? > <env: Envelope xmlns: env="http: //www. w 3. org/2003/05/soap-envelope" > <env: Header> <t: transaction xmlns: t="http: //thirdparty. example. org/transaction" env: encoding. Style="http: //example. com/encoding" env: must. Understand="true">5</t: transaction> </env: Header> <env: Body> <m: charge. Reservation. Response env: encoding. Style="http: //www. w 3. org/2003/05/soap-encoding" xmlns: m="http: //travelcompany. example. org/"> <m: code>FT 35 ZBQ</m: code> <m: view. At> http: //travelcompany. example. org/reservations? code=FT 35 ZBQ </m: view. At> </m: charge. Reservation. Response> </env: Body> </env: Envelope> 27

SOAP Work at a Glance 28

SOAP Work at a Glance 28

WSDL 29

WSDL 29

What is WSDL? • Web Services Description Language • Is an XML format for

What is WSDL? • Web Services Description Language • Is an XML format for describing network services as a set of endpoints operating on messages containing either documentoriented or procedure-oriented information 30

WSDL Details • A WSDL document defines services • Services are collection of network

WSDL Details • A WSDL document defines services • Services are collection of network endpoints (ports) • Abstract definition of endpoints and messages is separated from their concrete network deployment or data format bindings • Allows the reuse of abstract definitions: – messages -abstract descriptions of data being exchanged – port types -abstract collections of operations – concrete protocol and data format specifications for a particular port type constitutes a reusable binding

WSDL Elements • Types– a container for data type definitions using some type system

WSDL Elements • Types– a container for data type definitions using some type system (such as XSD). • Message– an abstract, typed definition of the data being communicated. • Operation– an abstract description of an action supported by the service. • Port Type–an abstract set of operations supported by one or more endpoints. • Binding– a concrete protocol and data format specification for a particular port type. • Port– a single endpoint defined as a combination of a binding and a network address. • Service– a collection of related endpoints. 32

An example • From BLAST service at DDBJ http: //www. embraceregistry. net/service/blast -ddbj •

An example • From BLAST service at DDBJ http: //www. embraceregistry. net/service/blast -ddbj • Search. Simple – function takes as input: – Program – which BLAST program to use – Database – which BLAST database to query – Query – sequence to query • Search. Simple output: – Result – string containing matches

An example <message name="search. Simple 1 In"> <part name="program" type="xsd: string" /> <part name="database"

An example <message name="search. Simple 1 In"> <part name="program" type="xsd: string" /> <part name="database" type="xsd: string" /> <part name="query" type="xsd: string" /> </message> <message name="search. Simple 1 Out"> <part name="Result" type="xsd: string" /> </message>

Example (continued) <port. Type name="Blast"> <operation name="search. Simple" parameter. Order="program database query"> <documentation>Execute Blast</documentation>

Example (continued) <port. Type name="Blast"> <operation name="search. Simple" parameter. Order="program database query"> <documentation>Execute Blast</documentation> <input name="search. Simple 1 In" message="tns: search. Simple 1 In" /> <output name="search. Simple 1 Out" message="tns: search. Simple 1 Out" /> </operation> …. [other operations] </port. Type>

REST 36

REST 36

What is REST? • Representational State Transfer • Uses HTTP 1. 1 verbs (get,

What is REST? • Representational State Transfer • Uses HTTP 1. 1 verbs (get, post, put, delete) for CRUD operations • Uses URIs to identify resources • Multiple media types 37

REST Architectural Style Constraints Client-server Stateless Cacheable Layered System Code on demand (optional, e.

REST Architectural Style Constraints Client-server Stateless Cacheable Layered System Code on demand (optional, e. g. Java. Script snippets) • Uniform interface • • • 38

Guiding Principles of Interfaces • Identification of Resources using URIs • Conceptual separation between

Guiding Principles of Interfaces • Identification of Resources using URIs • Conceptual separation between resources and their representations • Manipulation of resources through representations • Self-descriptive messages • Hypermedia as an engine of application state 39

SOA is also • Cloud computing • Mashups – Mixing and matching competitor’s API

SOA is also • Cloud computing • Mashups – Mixing and matching competitor’s API to create new services

References • SOAP Specification: http: //www. w 3. org/TR/soap/ • WSDL Specification: http: //www.

References • SOAP Specification: http: //www. w 3. org/TR/soap/ • WSDL Specification: http: //www. w 3. org/TR/wsdl#_Toc 492291096 • “Principled Design of the Modern Web Architecture”, by R. T. Fielding, R. N. Taylor: http: //www. ics. uci. edu/~taylor/documents/2 002 -REST-TOIT. pdf 41