COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf ·...
Transcript of COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf ·...
![Page 1: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/1.jpg)
COMP28112
The Integration Game
Lecture 16
![Page 2: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/2.jpg)
Architecture Matters!
Which house would you live in?
Technology independent
![Page 3: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/3.jpg)
Service is the idea that links requestor and provider
Semantic descriptions are needed to ensure that the requestor gets the “right” service.
![Page 4: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/4.jpg)
Service Oriented Architecture (SOA)
Principles for building systems meeting the
requirements:
Reliable, fault-tolerant, responsive, scalable and
secure
Interoperate across computing platforms and administrative domains
![Page 5: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/5.jpg)
Service
A service is a collection of code and data that stands alone
The ONLY way in and out of a service is via messages
Services are durable and survive crashes
![Page 6: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/6.jpg)
What follows are known as the four tenets of SOA
![Page 7: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/7.jpg)
Service Boundaries are Explicit
No ambiguity as to where a piece of code and data
resides
It is explicit if a piece of code is inside or outside a
service
E.g. Internet banking - the code and data live inside the banking service
![Page 8: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/8.jpg)
Services are Autonomous
Services are developed and managed independently
A service can be re-written without impacting other
services
With some constraints
![Page 9: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/9.jpg)
Services Share Schema and Contracts
Schema defines the messages a service can send
and receive
Contract defines permissible message sequences
Services do not share implementations
Independent of computing platform or languages
![Page 10: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/10.jpg)
Service Compatibility is Based on Policy
Defines the rules for using a service
E.g. security policy specifies who can use the
service
Introduces the idea of roles into distributed computing
Question of whether services are organised into an overall Virtual Organisation or are accessed
over an open network or market.
![Page 11: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/11.jpg)
More Complex Services
Purchase of goods or resource
Get a quote, make a reservation, make changes, make payment, cancel ticket
Book 100 hours and 500 Gbytes of storage on a
computing cloud
• All these messages are related to a particular
order
Need an unique identifier to correlate the
messages
![Page 12: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/12.jpg)
Service Schema
Defines the message schema for
Quote request
Quote
Purchase order
Invoice
...
![Page 13: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/13.jpg)
Service Contract
Defines the causal relationship between the messages - e.g.
Quote request before quote
Specifies if quote is optional or mandatory
Co-relation identifier to link the messages in a conversation
Send QuoteReqSend QuoteReq
Rec QuoteRec Quote
Send POSend PO
Rec PO AckRec PO Ack
![Page 14: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/14.jpg)
Putting It All Together
![Page 15: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/15.jpg)
Transactions Inside a Service
•Begin_Transaction
•Get message from the in queue
•Process message
•Put message on the out queue
•Commit
Crash
Crash
Crash
Crash
![Page 16: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/16.jpg)
Transactions Across Queuing system and Database
Two-phase commit between the queuing system and the database
Short duration and within the same trust domain
![Page 17: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/17.jpg)
Services Share Schema
Incoming message
Service transforms the
message from the “shared schema” to its internal schema
Outgoing message
Service transforms from its internal schema to the “shared
schema”
![Page 18: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/18.jpg)
Shared Schema Between Every Pair of Services
N x (N-1) number of transformations
12 services => 132 transformations
![Page 19: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/19.jpg)
The Need for Standards
2N number of transformations
12 services => 24transformations
![Page 20: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/20.jpg)
Which one is simpler?
Not a scalable S
olution
![Page 21: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/21.jpg)
Schema Mapping Problems
There are difficulties in mapping a service’s internal schema to another schema
Unfortunately, it can be very difficult and at times
impossible to achieve
![Page 22: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/22.jpg)
Name Conflicts
Same concept but different names
Same name but different concepts
One price includes VAT and the other does
not
<slot_id> 3 </slot_id><price> 45.10 </price>
<slot> 3 </slot><price> 53 </price>
![Page 23: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/23.jpg)
Structural Mismatches
Structure of the information is different
<address>
303 Deansgate Manchester M3 4LQ United
Kingdom
</address>
<address>
<street> 303 Deansgate
</street>
<city> Manchester </city>
<postcode> M3 4LQ
</postcode>
<country> United Kingdom
</country>
</address>
![Page 24: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/24.jpg)
Different Representation
Student Marks
(0 - 100)
Student Marks
HD (85 - 100)
D (70 - 84)
C (60 - 69)
P (45 - 59)
F (0 - 44)
Student Marks
HD (90 - 100)
D (75 - 89)
C (65 - 74)
P (50 - 64)
F (0 - 49)
![Page 25: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/25.jpg)
Ontologies and semantics
• If we can say what the information “means” we can
have some hope of reconciling different syntax for the “same” thing.
• This is known as a semantic description of the data.
• Ontologies are tools used to capture the “meaning” of data or services.
• An ontology is the representation of a set of concepts
within a domain and it allows reasoning about those
concepts, e.g. to assert equivalence.
![Page 26: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/26.jpg)
Agreement on a standard is HARD!
But often not for technological reasons
Each service, for economical reasons, will want to
reduce the costs of writing code to transform their
data to and from the standard
Sometimes it is extremely hard or impossible to transform the data
![Page 27: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/27.jpg)
Standards
Standards will evolve slowly
Driven by large organisations such as TESCO, ... or
Mandated by government or
By a community
Slow, painful and expensive process
![Page 28: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/28.jpg)
Message-Oriented Middleware (MOM)
Plumbing for shipping messages between the services
SOA is all about using messages to connect services
Asynchronous and non-blocking message passing
Sender application sends and does not wait for a response -similar to sending emails
Recipient may or may not be actively processing incoming
messages when the message is sent
![Page 29: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/29.jpg)
Point-to-Point messaging
Sender specifies a recipient
Message is delivered to ONE recipient
![Page 30: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/30.jpg)
MOM supports Three Types of Delivery Modes
At most once
At least once
Exactly once
![Page 31: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/31.jpg)
At Most Once (Best Effort)
MOM sends and forgets
Most appropriate when it is not essential that the
message is delivered
E.g. live cricket and football scores, stock prices,
...
MOM does not need to write to stable storage
Message may be lost due to failures
![Page 32: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/32.jpg)
At Least Once
Sender sends a message
Recipient will “eventually” receive at least one copy of the
message
Survives network and service failures
Used when a message must be received and application
receiving the message can cope with duplicates
![Page 33: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/33.jpg)
At Least Once
If the recipient does not acknowledge within a time-
out, sender resends the message
Repeat until sender receives an acknowledgment
Safe to resend
Safe for recipient to deliver a duplicate to the application
Require the sender and receiver to write to stable
storage to survive crashes
![Page 34: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/34.jpg)
Application Processing a Message
At least once delivery - duplicates can be received
Determine if this message is a duplicate
If not then process the message; otherwise ignore the
message
Don’t need to worry about duplicates if it is a “read”
request
e.g. get bank balance
Duplicates will not cause inconsistencies
![Page 35: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/35.jpg)
Exactly Once
Recipient is guaranteed that it will “eventually” receive
exactly one copy of the message
Application processing the message “knows” that it
has never processed this message before and a duplicate will never be delivered
Makes it easier to write the application
![Page 36: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/36.jpg)
Exactly once
Uses a variant of 2PC to ensure exactly once
delivery
Requires the sender and
receiver to write to stable storage
Message must be received
and recipient can’t cope
with duplicatesS
ender
Sender
Receiv
er
Receiv
er
![Page 37: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/37.jpg)
In-Order Delivery
Messages are delivered to the receiving application in
the same order as they were sent by the sending application
![Page 38: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/38.jpg)
Throughput
From greatest to least
At most once
At least once
Exactly once
![Page 39: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/39.jpg)
Publish Subscribe
Sender publishes (sends) a message on a topic rather
than a destination
Subscriber subscribe to topics
Similar to the idea of mailing lists
![Page 40: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/40.jpg)
Topics
Topics are organised in a hierarchy
Subscriber will receive all messages published on
the subscribed topic and its sub-topics
![Page 41: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/41.jpg)
Delivery Modes
Identical to point to point
At most once
At least once
Exactly once
In-order delivery
![Page 42: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/42.jpg)
Messaging Technologies
IBM WebSphere MQ (formerly MQSeries)
MSMQ
SQLServer
Native support for queues
ActiveMQ (open source)
TIBCO Rendevouz
...
![Page 43: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/43.jpg)
The Need for Interoperabilty
Services must be able to exchange messages
Remember, services do not share implementation
Services should be free to choose the MOM of
their choice
![Page 44: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/44.jpg)
Unfortunately
MOMs from different vendors don’t interoperate
All applications must use THE SAME MOM
implementation
Violates service autonomy
![Page 45: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/45.jpg)
Emerging Standards
Web Services Reliable Messaging (WS-Reliable Messaging)
Advanced Message Queuing Protocol (AMQP) - a message queuing protocol by JP Morgan Chase &
Co, Red Hat, ...
![Page 46: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/46.jpg)
SOA/Messaging
It WORKS and has worked for many centuries
Initially, paper based systems
Architecture for EAI and B2B integration
Towards the paperless world
Follows the KISS principle
Keep It Simple Stupid
![Page 47: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/47.jpg)
SOAP
![Page 48: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/48.jpg)
Before SOAP came XML-RPC…
• XML-RPC is a web services protocol that implements remote procedure calls over HTTP.
• Pre-dates SOAP, was based on a early version of the SOAP specification.
• XML-RPC a uses simple XML application to express function calls (requests) and returned values (responses) between clientsand servers.
• For more on XML-RPC see http://www.xmlrpc.com
![Page 49: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/49.jpg)
SOAP
• Simple Object Access Protocol?
• or
• Service Orientated Access Protocol?
• “Originally the acronym stood for Simple Object
Access Protocol, but that name is now considered to be outdated, so it no longer stands for anything”
• OGSA Glossary
![Page 50: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/50.jpg)
SOAP
•
• “SOAP provides a simple lightweight mechanism
for exchanging structured and typed information between peers in a decentralized, distributed
environment using XML”
•
Microsoft
![Page 51: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/51.jpg)
SOAP Structure
Envelope
Header
Body
Message Pay Load
![Page 52: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/52.jpg)
SOAP structure
• Envelope – contains the entire SOAP message
• Header – (optional) contains an header information – we
• will see this used later.
• Body – contains the application pay load.
• Message Payload – the part of the message that is intended for the application.
![Page 53: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/53.jpg)
Sample SOAP
• <SOAP-ENV:Envelope
• xmlns:SOAP-ENV=“http://schema.xmlsoap.org/soap/envelope/”
• xmlns:SOAP-ENC=“http://schema.xmlsoap.org/soap/encoding/”
• SOAP-ENV:encodingStyle=“http://schema.xmlsoap.org/soap/encoding”>
• <SOAP-ENV:Body>
• <getHostname/>
• </SOAP-ENV:Body>
• </SOAP-ENV:Envelope>
• Invokes the “getHostname” operation on the Web service.
![Page 54: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/54.jpg)
Response• <SOAP-ENV:Envelope
• xmlns:SOAP-ENV=“http://schemas.xmlsoap.org/soap/envelope”
• xmlns:xsd=“http://www.w3.org/2001/XMLSchema”
• xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”
• SOAP-ENV:encodingStyle=“http://schemas.xmlsoap.org/soap/encoding/”>
• <SOAP-ENV:Body>
• <getHostnameResponse>
• <getHostnameReturn xsi:type=“xsd:string”>
• foobar.man.ac.uk
• </getHostnameReturn>
• </getHostnameResponse>
• </SOAP-ENV:Body>
• </SOAP-ENV:Envelope>
![Page 55: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/55.jpg)
SOAP Faults
• The Envelope element may contain a Fault element.
• <soap:Fault>
• <faultcode>12</faultcode>
• <faultstring>no such host</faultstring>
• </soap:Fault>
![Page 56: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/56.jpg)
Faults
• The Fault element can have the following
• faultcode
• Allows the service to pass an error code to the client
• faultstring
• Allows the service to provide an error message
• faultactor
• Where did the error originate
• detail
• Specific detail about the error
![Page 57: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/57.jpg)
RPC Style
• RPC – Remote Procedure Call, similar to making a function call.
• e.g. int add( int value1, int value2 )
• <body>
• <add>
• <value1 xsd:type=“int”>10</value1>
• <value2 xsd:type=“int”>5</value2>
• </add>
• </body>
![Page 58: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/58.jpg)
Document Style
• Rather than the service providing remote functions -we can think about exchanging messages with a service.
• <MathsOperation>
• <Operation name=“ADD”>
• <Arg>5</Arg>
• <Arg>10</Arg>
• </Operation>
• </MathsOperation>
![Page 59: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/59.jpg)
SOAP References• SOAP specification - http://www.w3.org/TR/soap/
• The SOAP envelope namespace: http://schemas.xmlsoap.org/soap/envelope/
• The SOAP encoding namespace: http://schemas.xmlsoap.org/soap/encoding/
• RPC v Document Style
• http://www-106.ibm.com/developerworks/webservices/library/ws-whichwsdl/
• “A Critique of the Remote Procedure Call Paradigm” by Tanenbaum & Van Renesse EUTECO’88.
• OGSA Glossary - https://forge.gridforum.org/projects/ogsa-wg
![Page 60: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/60.jpg)
Summary I
Service-oriented architectures
Simple set of design principles for building applications that is technology independent
The use of messages to connect services
A service is a collection of code and data and the only way in and out of a service is through
“messages”
![Page 61: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/61.jpg)
Summary II
Four tenets of SOA
Boundaries are explicit
Services are autonomous
Services share schema and contracts and not
implementation
Service compatibility is based on policy
![Page 62: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/62.jpg)
Summary III
Message-Oriented Middleware
Provides the infrastructure for SOA
Semantic descriptions, can promote service
discovery, matching and interoperability.
![Page 63: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/63.jpg)
Summary IV
Messaging
At most once, at least once and exactly once
delivery
Point-to-point and publish/subscribe
Transactions across queuing system and database
The need for standard schemas and MOM
interoperability
![Page 64: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/64.jpg)
Engineering Internet Scale Distributed Systems
![Page 65: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/65.jpg)
Requirements
• High availability
• Responsive
• Scalable
• Reliable and fault-tolerant
• Maintains data consistency in the presence of failures and concurrency
![Page 66: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/66.jpg)
How should these systems be designed?
![Page 67: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/67.jpg)
Architectural Styles
• Define guiding principles for engineering systems
• Technology independent
• SOA is an architectural style based on messaging,
idempotent operations, immutable messages, ...
• Are there others for building Internet-scale distributed
systems?
• Can we learn from systems that work?
![Page 68: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/68.jpg)
The Web
• Has many of the key characteristics that we want
• High availability, scalable, responsive, ...
• What can we learn from the success of the Web in building distributed systems?
• What is the architectural style behind the Web?
• Focus of the rest of this lecture is the study of the architectural style behind the Web
![Page 69: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/69.jpg)
Remember, architecture Matters!
Building built using few architectural constraints
Building built using many architectural constraints
![Page 70: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/70.jpg)
The architectural style behind the Web is REST - REpresentation State Transfer
![Page 71: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/71.jpg)
REST
• Term coined by Roy Fielding in his PhD thesis to
describe an architectural style for networked (distributed) systems
• Course web site provide links to his thesis and other REST material
• REST is described in Chapter 5 of the thesis
![Page 72: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/72.jpg)
Why is it called REST?
• Key abstraction in REST is “resources”
• A resource can be anything that can be named
• Comp28112 course is a resource, everyone in the lecture is a
resource ...
• A resource can have a number of representations
• The HTML page at
https://www.cs.manchester.ac.uk/ugt/2010/COMP28112/ is a HTML representation of this course
• A resource can have links to other resources
![Page 73: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/73.jpg)
REST
• Provides the image of a network of linked representation of
resources
• Each “representation” provides information about the
“state” of the resource
• Client navigate through the resources via links
• Each link “transfers” the client to the representation
(state) of another resource
• So we have “REpresentational State Transfer” - REST
![Page 74: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/74.jpg)
Implementation of REST
• The idea is to make use of the existing technology, URL,XML,HTTP,SMTP etc. to build Web services.
• For example HTTP supports these “verbs”:
• HEAD (get the Meta data about the resource)
• POST (create a resource)
• GET (get the state of the resource)
• PUT (modify the state of the resource)
• DELETE (destroy the resource)
![Page 75: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/75.jpg)
REST
• REST is independent of any middleware
• J2EE, .NET, CORBA, Web Services....
• HTTP follows the REST principles
• That is, HTTP follows many of the principles prescribed by REST
![Page 76: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/76.jpg)
HTTP and REST
• URLs identify resources
• E.g. http://manchester.ac.uk identifies the resource
“University of Manchester” while
https://www.cs.manchester.ac.uk/ugt/2010/COMP28112/ identifies this course
• Opaque and exposes no details of the
implementation
• Only representations are exposed
![Page 77: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/77.jpg)
Representations of Resources
• A resource can have multiple representations
• e.g. HTML, XML, JPEG, ...
• Client specifies in the http “accept” header the representation it wants to receive
• HTML, XML, JPEG, ...
![Page 78: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/78.jpg)
Uniform Interface
• Resources have the same interface
• Simplifies the overall architecture
• in HTTP, every resource has the same methods
• GET - retrieves a representation
• POST - creates a new resource
• PUT - updates an existing resource
• DELETE - deletes a resource
![Page 79: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/79.jpg)
Stateless Interactions
• Each request contains all the information necessary for
the server to understand the request independent of any request that has preceded it
• No context is stored on the server
• Should avoid the use of cookies
![Page 80: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/80.jpg)
Benefits of Statelessness
• Reliability
• Easy to manage server failures
• Scalability
• Easy to add a new server to process messages
![Page 81: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/81.jpg)
Resources
• State of resources are stored in
databases shared by the servers
• Databases are good at storing data
• Reliable, fast, fault-tolerant,
manage concurrency, ....
![Page 82: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/82.jpg)
Cacheable
• Message should label whether a message is cacheable
• Reuse of data
• Improves efficiency, scalability and perceived performance by reducing the average latency
• Increases the probability of reading out-of-date (stale) data
![Page 83: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/83.jpg)
Cacheable - Server Side
• Server should specify if a message is “cacheable”
when responding to a client request
• Specifies how long one can keep a “cache” copy
• HTTP Cache Control header
• Public - response may be cached
• Private - may not be cached and reused
• ...
![Page 84: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/84.jpg)
Cacheable - Client Side
• Clients are given the right to use cached data
• Benefits - response time, scalability, eliminate certain
interactions, ...
• Trade-off - data is out-of-date
![Page 85: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/85.jpg)
Interoperability
• Key is standardisation
• Http provides the interoperability needed to communicate
across computing platforms and programming languages
• Server and client applications can be written in many
languages (Java, C#, Perl, C, Ruby, ....)
• HTTP Servers
• Apache, Microsoft IIS, ...
![Page 86: COMP28112 The Integration Gamesyllabus.cs.manchester.ac.uk/ugt/COMP28112/2011/slides16.pdf · 2011-03-29 · secure Interoperate across computing platforms and ... Contract defines](https://reader035.fdocuments.in/reader035/viewer/2022080718/5f78d99695b09f6a1d473969/html5/thumbnails/86.jpg)
Summary
• REST is an architectural style
• Defines a set of constraints for building internet scale
distributed applications
• Key abstraction is “resource”
• Key constraints
• Anything that can be named can be a resource, URLs identify resources and uniform interface
• Simple and elegant