SlideShare a Scribd company logo
A Comparison of Service-oriented, Resource-oriented, and Object-oriented Architecture Styles   Jørgen Thelin Chief Scientist Cape Clear Software Inc.
Abstract The three common software architecture styles commonly used in distributed systems and XML Web Services are compared and contrasted.  In particular, the key differences between traditional SOAP and REST styles are explored.  Guidelines are presented on which style is most applicable for certain application scenarios, and when a combination of styles is necessary.
Agenda Architecture Patterns and Styles Distributed System Types Request / Response Message passing Architecture styles Object-oriented architectures Resource-oriented architectures Service-oriented architectures REST Choosing Architecture Style and Implementation Technology
Cape Clear Start-up founded in 1999 by several executives from Iona Technologies Venture capital funding from Greylock and Accel Partners Offices in: Dublin, Ireland London, UK San Mateo, CA, USA Waltham, MA, USA The company is totally focused on XML Infrastructure, including Web Services Products: WSDL Editor Web Services Development tool set XML Integration Server supporting Web Services
Setting the Scene  – Architecture Patterns and Styles
What is a Pattern? Martin Fowler defines a “Pattern” as: An “idea” that has been useful in one practical context and will probably be useful in others” [Martin Fowler, “Analysis Patterns”, 1997] The concept of patterns can be applied at many levels in software projects: Design / Code Patterns Analysis / Model Patterns Architecture Patterns / Architectural Styles
Pattern Levels – Design / Code Patterns Lowest level of patterns in software Based around a reusable chunk of code to solve a particular problem Typically implemented through source code templates and/or code generation Provides a “template” for implementing a system function, but requiring elaboration to complete
Pattern Levels – Analysis / Model Patterns Reusable object models (for example UML) Typically implemented through UML model templates or perhaps meta-models Provides a “template” for a group of related system functions, but often within a specific domain (for example Finance)
Pattern Levels – Architecture Patterns / Architecture Styles Reusable system structures, interconnections and interactions Typically implemented through architecture standards and policies Provides a “template” for subsystem structure and communications between subsystems
What is Software Architecture? The software architecture of a program or computing system is the  structure  or structures of the system, which comprise software  components , the externally visible  properties  of those components, and the  relationships  among them. [Bass, Clements & Kazman, “Software Architecture in Practice”, 1998]
What is a Software Architecture Style? #1 An architectural style defines:  a  family  of systems in terms of a pattern of  structural  organization  a vocabulary of  components  and  connectors , with  constraints  on how they can be combined [ Shaw & Garlan, “ Software Architecture: Perspectives on an Emerging Discipline” , 1996]
What is a Software Architecture Style? #2 An architecture style: Describes a  class  of architectures or significant architecture pieces Is  found repeatedly  in practice Is a coherent package of  design decisions Has  known properties  that permit  reuse [Clements, Kazman & Klein, “Evaluating Software Architecture”, 2002] In other words, architecture styles are like “design patterns” for the  structure  and  interconnection  within and between software systems.
Distributed Systems  Architecture Styles
Distributed Systems Types Two main types of distributed software systems: Request / Response type systems Also known as “call & return” type systems Message passing type systems Also known as “document passing” type systems
Distributed System Type #1  –  Request / Response Systems Request / Response type systems are: Call oriented systems Usually  synchronous in nature Approach: Operations have input parameters and output / return values Focus is on: The particular operation to be invoked The set of input values The set of output values The correlation of replies with requests No real focus on: How the individual values are marshalled as a unit How the output values are produced from the input values  (assuming the correct output is produced!)
Distributed Systems Type #2  - Message Passing Systems Message passing type systems are: Data oriented systems Usually  asynchronous in nature Approach: Messages are constructed and send to a destination Focus is on: Constructing the message payload in the correct format How to dispatch the message (transport medium) Where to dispatch the messages to (endpoint) No real focus on: What will happen to messages after they are dispatched Whether there will be a corresponding reply message
Architecture Styles for Distributed Systems For “call-based” distributed systems, there are three main architecture styles commonly used: Object-oriented Resource-oriented Service-oriented  Service-oriented architecture styles are frequently used with “message-passing” systems too  [but further discussion is outside the scope of this presentation]
Object-Oriented Architectures - 1 Involve communicating with  A particular  object instance Specific operations for object lifecycle management E.g. EJB create, EJB remove methods Communications are implicitly  stateful   Talking to a particular previously-created object instance
Object-Oriented Architectures - 2 Use middleware specific protocols for communication For example: IIOP, DCOM or RMI Usually not Internet-friendly protocols Usually require  pass-by-reference  facilities Marshalling  object references  generally precludes using different types of software on client-side and server-side
Object-Oriented Architectures - 3 All state information is held on the server-side Each access to the object involves a network call and round-trip communication Design patterns have evolved to provide ways to minimise network calls through bulk data retrieval For example  “Value Objects” in EJB programming  http://www2.theserverside.com/patterns/thread.jsp?thread_id=79
Resource-Oriented Architectures - 1 Involve retrieving particular resource instances Some examples are: Retrieving a HTML page using HTTP GET request Retrieving a database table row using a SQL SELECT command Usually have operations for resource lifecycle management E.g. HTTP PUT, HTTP DELETE verbs Requests are usually  stateless   No link between one request and the next Client manages any concept of “conversation state”
Resource-Oriented Architectures - 2 Resource instances are identified by some sort of “address” data included with the request Some examples are: A HTTP URL a WHERE clause in a SQL SELECT statement Encoding “parameters” into addresses can become difficult for complex query resources
Resource-Oriented Architectures - 3 Retrieving a resource creates a (detached)  snapshot  of its current state on the client-side “ Master copy” of the resource data  remains  on the server Usually can “ cache ” the resource data for later reuse within specified expiration times without having to re-retrieve the data
Resource-Oriented Architectures - 4 Updates to resources: Typically involve replacing the previous copy of the data with a new copy (for example HTTP PUT) May also be some command verbs for doing “partial updates” (for example HTTP POST or SQL UPDATE) Subsequent changes to the “master copy” of the resource on the server-side are  not  automatically duplicated in the detached copies of the resource on the client-side
Resource-Oriented Architectures  - Some Variations Variations in resource-oriented architecture style involve “distributed resource copies”  Multiple copies of the resource data exist Changes and amendments are broadcast to keep  all  copies in synchronization Often done using Publish/Subscribe messaging techniques May have single-master, or multiple-masters
Service-Oriented Architectures - 1 Involve communicating with  A specific application service  All messages/requests are sent to the service “endpoint” No  operations for service lifecycle management Communications are implicitly  stateless   All requests are sent to the same service endpoint SOA are generally more  scalable  due to stateless nature
Service-Oriented Architectures - 2 Service  endpoint decides  how to process request Inspects the message data content  – either an “envelope” or the actual “payload” itself Each service has an  interface description Completely defines the message and payload formats (for example, a WSDL file) Creates a  loosely-coupled   contract  between client and server due to late binding
REpresentational State Transfer  (REST) The REST approach is one of the major  resource-oriented  approach to building distributed systems using “pure” web technology (HTTP, HTML) REST (REpresentational State Transfer) is a term coined by Roy Fielding in his PhD dissertation describing a resource-oriented architecture style for networked systems http://www.ebuilt.com/fielding/pubs/dissertation/top.htm
REST Roger Costello has written a useful Tutorial and Introduction to REST: http://www.xfront.com/REST.html Summary of a REST-style  interaction : Find or work out the resource address or  URL Retrieve the web resource using the URL A  representation  of the resource is returned (such as a HTML page or an XML document) The returned data is processed to place the client in a particular  state  (perhaps by rendering the HTML page) Hyperlinks  in the resource data can be used to retrieve related resources, which  transfers  the client to a new state (such as by rendering a different HTML page) The client application changes state with each resource representation retrieval  --> “Representation State Transfer”
REST Example – Stage 1 Server Client GET http://www.TheArchitect.co.uk/weblog/index.xml HTTP/1.1  HTTP Request HTTP response data Eg. RSS data for my weblog
REST - Example return data - 1 <?xml version=&quot;1.0&quot; encoding=&quot;iso-8859-1&quot;?> < rss  version =&quot; 2.0 &quot;> < channel > < title > TheArchitect.co.uk - Jorgen Thelin&apos;s weblog </ title > < link >  http://www.thearchitect.co.uk/weblog/   </ link > < item > < link >  http://www.thearchitect.co.uk/weblog/archives/2003/03/000106.html   </ link > < pubDate > Sat, 22 Mar 2003 00:01:00 GMT </ pubDate > < guid >  http://www.thearchitect.co.uk/weblog/archives/2003/03/000106.html   </ guid > < title > Internet Radio is Cool </ title > < description > I am sitting here in my hotel room in Salt Lake City finishing off some outstanding work,  and I can listen via the Internet to my local radio station at home - London&apos;s Capital FM  Internet radio is so cool! </ description > < comments > http://www.thearchitect.co.uk/cgi-bin/mt/mt-comments.cgi?entry_id = 106 </ comments > </ item > </ channel > </ rss >
REST Example – Stage 2 Server Client GET http://www.thearchitect.co.uk/weblog/archives/2003/03/000106.html  HTTP Request HTTP response data Eg. HTML page for one page in my weblog
SOAP vs. REST SOAP is often seen as a direct rival to a REST-based architecture, as SOAP v1.1 used a solely Service-oriented approach, and the debate from both sides has been savage!  http://lists.w3.org/Archives/Public/www-tag/2002Apr/0235.html In fact, support for a more REST-based architecture style have been included in the SOAP 1.2 Specification with the new SOAP Web Method facilities:  http://www.w3.org/TR/soap12-part2/#WebMethodFeature Using “RESTful SOAP” can be useful for exposing cacheable (typically read-only or idempotent) SOAP operations Sam Ruby has written an article comparing SOAP and REST and showing how they can co-exist peacefully together:  http://www.intertwingly.net/stories/2002/07/20/restSoap.html
Web Services vs. REST - 1 There is no real conflict between the general idea of Web Services and the REST approach From W3C “Web Services Description Requirements” document: Definition:  A  Web Service  is a software application identified by a URI  [IETF RFC 2396] , whose interfaces and binding are capable of being defined, described and discovered by XML artifacts and supports direct interactions with other software applications using XML based messages via Internet-based protocols.
Web Services vs. REST - 2 Web Service standards already support many RESTful features, and are adding more: HTTP GET bindings in WSDL v1.1 SOAP Web Methods in SOAP v1.2 The total set of Web Service specifications provide a  super set of the REST approach – supporting Service-oriented as well as Resource-oriented mechanisms WSDL v1.2 should add facilities to allow the full description of the payload formats for REST / Resource-oriented approaches based in URLs Roger Costello has written an article on “Building Web Services the REST way” :  http://www.xfront.com/REST-Web-Services.html
Choosing an Architecture Style
Comparison of 3 Distributed Architecture Styles Specific to this service – description is protocol specific (e.g. WSDL) Generic to the request mechanism (e.g. HTTP verbs) Specific to this object / class – description is middleware specific (e.g. IDL) Application interface Creation of request payloads Request addressing (usually URLs) Marshalling parameter values Main Focus Yes – part of service description (e.g. XML Schema in WSDL) No – nothing directly linked to address / URL Yes – usually middleware specific (e.g. IDL) Payload / data format description No Yes No Are replies cacheable? One endpoint address per service Unique address per resource Routed to unique object instance Addressing / Request routing Service instances Resource instances Object instances Granularity Service-oriented Resource-oriented Object-oriented Attribute
Choosing – Object Oriented Architectures Involve  tight coupling  between client and server, due to: Object reference semantics  Object serialization Early binding to interfaces Usually best for “ closed ” systems controlled by a  single organization
Choosing – Resource Oriented Architectures Involve  loose-coupling  between client and server, due to: Late binding to resource data Successful use revolves around the  cache-ability  of resource data So most typically used for operations which are: For  read-only  or  read-mostly  data Involve  idempotent  (repeatable) operations,  Return results with a “validity window” or “expiration period” Tend to scale well due to their  stateless  nature. Usually best for “ linking and referring ”  across organization boundaries
Choosing – Service Oriented Architectures Involve  loose-coupling  between client and server, due to: Late binding to service interface Full interface and payload descriptions in interface contract Generally the most flexible  – can support request/response and message passing systems Tend to scale well due to their  stateless  nature. Usually best for “ shared ” systems  crossing organization boundaries
Combining Architecture Styles Usually best to stick to a single architecture style, but combinations are technically possible For example, a Web Service application could use a combination of architecture styles: Resource-oriented approach for simple data reads Service-oriented approach for complex data retrieval operations or data updates
Summary and Conclusion
Summary Two main distributed system types are: Request / Response Message passing Three main Request/Response architecture styles are: Object-oriented Resource-oriented Service-oriented The choice of architecture style is an important decision for any software system Choice of architecture style can have implications on  scalability ,  re-usability  and  ease of interconnection  with other systems Web Services can be written using both Resource-oriented or Service-oriented approaches SOAP v1.2 and WSDL v1.2 are helping to unify this
Resources Cape Clear Software WSDL Editor Web Services Development tool set XML Integration Server supporting Web Services http://www.capeclear.com CapeScience Papers, articles, tutorials, and webcasts for Web Services developers http://www.capescience.com Jorgen Thelin’s Weblog Weblog covering enterprise systems development, and especially Web Services http://www.TheArchitect.co.uk/weblog/

More Related Content

PPTX
L11 Application Architecture
PPTX
Pattern oriented architecture for web based architecture
PDF
N-Tier, Layered Design, SOA
PPTX
PPTX
L10 Web Programming
DOCX
Differences Between Architectures
PPS
Multi Tier Architecture
PPTX
An Inference Sharing Architecture for a More Efficient Context Reasoning
L11 Application Architecture
Pattern oriented architecture for web based architecture
N-Tier, Layered Design, SOA
L10 Web Programming
Differences Between Architectures
Multi Tier Architecture
An Inference Sharing Architecture for a More Efficient Context Reasoning

What's hot (20)

PPTX
L03 Design Patterns
DOCX
J2EE and layered architecture
PPTX
Web apps architecture
PPT
Architecture of eSobi club based on J2EE
PPTX
N-tier and oop - moving across technologies
PPTX
Mcv design patterns
PPS
PPTX
Spring
PDF
Peoplesoft PIA architecture
PDF
Towards Requirements Management Issues in Excel
PPS
WCF (Windows Communication Foundation_Unit_01)
PDF
SOA architecture patterns, Matjaž Jurič (FRI/Univerza v Ljubljani)
PPTX
1. Spring intro IoC
 
PPTX
J2 ee architecture
PPT
Webapplication ppt prepared by krishna ballabh gupta
ODP
Java Web Programming [1/9] : Introduction to Web Application
PPTX
two tier and three tier
PPTX
CSS Architecture: Writing Maintainable CSS
PPTX
Web programming and development - Introduction
L03 Design Patterns
J2EE and layered architecture
Web apps architecture
Architecture of eSobi club based on J2EE
N-tier and oop - moving across technologies
Mcv design patterns
Spring
Peoplesoft PIA architecture
Towards Requirements Management Issues in Excel
WCF (Windows Communication Foundation_Unit_01)
SOA architecture patterns, Matjaž Jurič (FRI/Univerza v Ljubljani)
1. Spring intro IoC
 
J2 ee architecture
Webapplication ppt prepared by krishna ballabh gupta
Java Web Programming [1/9] : Introduction to Web Application
two tier and three tier
CSS Architecture: Writing Maintainable CSS
Web programming and development - Introduction
Ad

Similar to Three Software Architecture Styles (20)

PPTX
L02 Architecture
PPT
Oopsla 2007 - The Web: Distributed Objects Realized!
PPTX
Software Architecture taxonomies - Integration patterns
PPTX
Unit 2
PPT
Lecture-7.ppt
PPTX
Introduction to webservices
PDF
Software Architecture - Principles Patterns and Practices - OSI Days Workshop...
PPT
SOA1-Background.ppt SOFTWARE ORIENTED SERVICES AND ARCHITECTURE
PPT
architectural design
PPTX
Distributed system architecture
PPTX
Diksha sda presentation
ODP
Software Patterns
PPT
Rest introduction
PPTX
L9- SOA CB Architecture - Complete (1).pptx
PPT
Web Service Oriented Architecture
DOC
PDF
Software Architecture - Principles, Patterns and Practices - OSI Days - 2017
DOCX
Service oriented software engineering
PPTX
Enterprise Application Architectures by Dr. Indika Kumara
PDF
Introduction to SOFTWARE ARCHITECTURE
L02 Architecture
Oopsla 2007 - The Web: Distributed Objects Realized!
Software Architecture taxonomies - Integration patterns
Unit 2
Lecture-7.ppt
Introduction to webservices
Software Architecture - Principles Patterns and Practices - OSI Days Workshop...
SOA1-Background.ppt SOFTWARE ORIENTED SERVICES AND ARCHITECTURE
architectural design
Distributed system architecture
Diksha sda presentation
Software Patterns
Rest introduction
L9- SOA CB Architecture - Complete (1).pptx
Web Service Oriented Architecture
Software Architecture - Principles, Patterns and Practices - OSI Days - 2017
Service oriented software engineering
Enterprise Application Architectures by Dr. Indika Kumara
Introduction to SOFTWARE ARCHITECTURE
Ad

More from Jorgen Thelin (20)

PPTX
The Internet of Cars - Towards the Future of the Connected Car
PDF
Orleans: Cloud Computing for Everyone - SOCC 2011
PPTX
Identity Services Drilldown - TechEd NA 2009
PPTX
Protecting Online Identities - MIX09
PPT
Live Identity Services Drilldown - PDC 2008
PPT
The New Enterprise Alphabet - .Net, XML And XBRL
PPT
WS-* Specifications Update 2007
PPT
WS-* Protocol Workshop Process Overview
PPT
Web Services and Devices Profile for Web Services (DPWS)
PPT
Web Services Discovery for Devices
PPT
Overview of Windows Vista Devices and Windows Communication Foundation (WCF)
PPT
Making Sense Of Web Services
PPT
Interoperability and Windows Communication Foundation (WCF) Overview
PPT
Real World Business Interoperability
PPT
Achieving Interoperability Through Web Services
PDF
Zero-Defects Plug and Play -- General Quality Frameworks and Processes for Ac...
PDF
Identity, Security, and XML Web Services -- The Importance of Interoperable S...
PDF
Web Services Security Tutorial
PPT
Identity, Security and XML Web Services
PPT
Web Services Container
The Internet of Cars - Towards the Future of the Connected Car
Orleans: Cloud Computing for Everyone - SOCC 2011
Identity Services Drilldown - TechEd NA 2009
Protecting Online Identities - MIX09
Live Identity Services Drilldown - PDC 2008
The New Enterprise Alphabet - .Net, XML And XBRL
WS-* Specifications Update 2007
WS-* Protocol Workshop Process Overview
Web Services and Devices Profile for Web Services (DPWS)
Web Services Discovery for Devices
Overview of Windows Vista Devices and Windows Communication Foundation (WCF)
Making Sense Of Web Services
Interoperability and Windows Communication Foundation (WCF) Overview
Real World Business Interoperability
Achieving Interoperability Through Web Services
Zero-Defects Plug and Play -- General Quality Frameworks and Processes for Ac...
Identity, Security, and XML Web Services -- The Importance of Interoperable S...
Web Services Security Tutorial
Identity, Security and XML Web Services
Web Services Container

Recently uploaded (20)

PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Encapsulation theory and applications.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
A comparative analysis of optical character recognition models for extracting...
PPTX
Machine Learning_overview_presentation.pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Approach and Philosophy of On baking technology
PPTX
Spectroscopy.pptx food analysis technology
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Diabetes mellitus diagnosis method based random forest with bat algorithm
Review of recent advances in non-invasive hemoglobin estimation
MYSQL Presentation for SQL database connectivity
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Encapsulation theory and applications.pdf
MIND Revenue Release Quarter 2 2025 Press Release
Programs and apps: productivity, graphics, security and other tools
A comparative analysis of optical character recognition models for extracting...
Machine Learning_overview_presentation.pptx
Encapsulation_ Review paper, used for researhc scholars
Approach and Philosophy of On baking technology
Spectroscopy.pptx food analysis technology
Assigned Numbers - 2025 - Bluetooth® Document
Digital-Transformation-Roadmap-for-Companies.pptx
Reach Out and Touch Someone: Haptics and Empathic Computing
Per capita expenditure prediction using model stacking based on satellite ima...
Chapter 3 Spatial Domain Image Processing.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
The AUB Centre for AI in Media Proposal.docx
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton

Three Software Architecture Styles

  • 1. A Comparison of Service-oriented, Resource-oriented, and Object-oriented Architecture Styles Jørgen Thelin Chief Scientist Cape Clear Software Inc.
  • 2. Abstract The three common software architecture styles commonly used in distributed systems and XML Web Services are compared and contrasted. In particular, the key differences between traditional SOAP and REST styles are explored. Guidelines are presented on which style is most applicable for certain application scenarios, and when a combination of styles is necessary.
  • 3. Agenda Architecture Patterns and Styles Distributed System Types Request / Response Message passing Architecture styles Object-oriented architectures Resource-oriented architectures Service-oriented architectures REST Choosing Architecture Style and Implementation Technology
  • 4. Cape Clear Start-up founded in 1999 by several executives from Iona Technologies Venture capital funding from Greylock and Accel Partners Offices in: Dublin, Ireland London, UK San Mateo, CA, USA Waltham, MA, USA The company is totally focused on XML Infrastructure, including Web Services Products: WSDL Editor Web Services Development tool set XML Integration Server supporting Web Services
  • 5. Setting the Scene – Architecture Patterns and Styles
  • 6. What is a Pattern? Martin Fowler defines a “Pattern” as: An “idea” that has been useful in one practical context and will probably be useful in others” [Martin Fowler, “Analysis Patterns”, 1997] The concept of patterns can be applied at many levels in software projects: Design / Code Patterns Analysis / Model Patterns Architecture Patterns / Architectural Styles
  • 7. Pattern Levels – Design / Code Patterns Lowest level of patterns in software Based around a reusable chunk of code to solve a particular problem Typically implemented through source code templates and/or code generation Provides a “template” for implementing a system function, but requiring elaboration to complete
  • 8. Pattern Levels – Analysis / Model Patterns Reusable object models (for example UML) Typically implemented through UML model templates or perhaps meta-models Provides a “template” for a group of related system functions, but often within a specific domain (for example Finance)
  • 9. Pattern Levels – Architecture Patterns / Architecture Styles Reusable system structures, interconnections and interactions Typically implemented through architecture standards and policies Provides a “template” for subsystem structure and communications between subsystems
  • 10. What is Software Architecture? The software architecture of a program or computing system is the structure or structures of the system, which comprise software components , the externally visible properties of those components, and the relationships among them. [Bass, Clements & Kazman, “Software Architecture in Practice”, 1998]
  • 11. What is a Software Architecture Style? #1 An architectural style defines: a family of systems in terms of a pattern of structural organization a vocabulary of components and connectors , with constraints on how they can be combined [ Shaw & Garlan, “ Software Architecture: Perspectives on an Emerging Discipline” , 1996]
  • 12. What is a Software Architecture Style? #2 An architecture style: Describes a class of architectures or significant architecture pieces Is found repeatedly in practice Is a coherent package of design decisions Has known properties that permit reuse [Clements, Kazman & Klein, “Evaluating Software Architecture”, 2002] In other words, architecture styles are like “design patterns” for the structure and interconnection within and between software systems.
  • 13. Distributed Systems Architecture Styles
  • 14. Distributed Systems Types Two main types of distributed software systems: Request / Response type systems Also known as “call & return” type systems Message passing type systems Also known as “document passing” type systems
  • 15. Distributed System Type #1 – Request / Response Systems Request / Response type systems are: Call oriented systems Usually synchronous in nature Approach: Operations have input parameters and output / return values Focus is on: The particular operation to be invoked The set of input values The set of output values The correlation of replies with requests No real focus on: How the individual values are marshalled as a unit How the output values are produced from the input values (assuming the correct output is produced!)
  • 16. Distributed Systems Type #2 - Message Passing Systems Message passing type systems are: Data oriented systems Usually asynchronous in nature Approach: Messages are constructed and send to a destination Focus is on: Constructing the message payload in the correct format How to dispatch the message (transport medium) Where to dispatch the messages to (endpoint) No real focus on: What will happen to messages after they are dispatched Whether there will be a corresponding reply message
  • 17. Architecture Styles for Distributed Systems For “call-based” distributed systems, there are three main architecture styles commonly used: Object-oriented Resource-oriented Service-oriented Service-oriented architecture styles are frequently used with “message-passing” systems too [but further discussion is outside the scope of this presentation]
  • 18. Object-Oriented Architectures - 1 Involve communicating with A particular object instance Specific operations for object lifecycle management E.g. EJB create, EJB remove methods Communications are implicitly stateful Talking to a particular previously-created object instance
  • 19. Object-Oriented Architectures - 2 Use middleware specific protocols for communication For example: IIOP, DCOM or RMI Usually not Internet-friendly protocols Usually require pass-by-reference facilities Marshalling object references generally precludes using different types of software on client-side and server-side
  • 20. Object-Oriented Architectures - 3 All state information is held on the server-side Each access to the object involves a network call and round-trip communication Design patterns have evolved to provide ways to minimise network calls through bulk data retrieval For example “Value Objects” in EJB programming http://www2.theserverside.com/patterns/thread.jsp?thread_id=79
  • 21. Resource-Oriented Architectures - 1 Involve retrieving particular resource instances Some examples are: Retrieving a HTML page using HTTP GET request Retrieving a database table row using a SQL SELECT command Usually have operations for resource lifecycle management E.g. HTTP PUT, HTTP DELETE verbs Requests are usually stateless No link between one request and the next Client manages any concept of “conversation state”
  • 22. Resource-Oriented Architectures - 2 Resource instances are identified by some sort of “address” data included with the request Some examples are: A HTTP URL a WHERE clause in a SQL SELECT statement Encoding “parameters” into addresses can become difficult for complex query resources
  • 23. Resource-Oriented Architectures - 3 Retrieving a resource creates a (detached) snapshot of its current state on the client-side “ Master copy” of the resource data remains on the server Usually can “ cache ” the resource data for later reuse within specified expiration times without having to re-retrieve the data
  • 24. Resource-Oriented Architectures - 4 Updates to resources: Typically involve replacing the previous copy of the data with a new copy (for example HTTP PUT) May also be some command verbs for doing “partial updates” (for example HTTP POST or SQL UPDATE) Subsequent changes to the “master copy” of the resource on the server-side are not automatically duplicated in the detached copies of the resource on the client-side
  • 25. Resource-Oriented Architectures - Some Variations Variations in resource-oriented architecture style involve “distributed resource copies” Multiple copies of the resource data exist Changes and amendments are broadcast to keep all copies in synchronization Often done using Publish/Subscribe messaging techniques May have single-master, or multiple-masters
  • 26. Service-Oriented Architectures - 1 Involve communicating with A specific application service All messages/requests are sent to the service “endpoint” No operations for service lifecycle management Communications are implicitly stateless All requests are sent to the same service endpoint SOA are generally more scalable due to stateless nature
  • 27. Service-Oriented Architectures - 2 Service endpoint decides how to process request Inspects the message data content – either an “envelope” or the actual “payload” itself Each service has an interface description Completely defines the message and payload formats (for example, a WSDL file) Creates a loosely-coupled contract between client and server due to late binding
  • 28. REpresentational State Transfer (REST) The REST approach is one of the major resource-oriented approach to building distributed systems using “pure” web technology (HTTP, HTML) REST (REpresentational State Transfer) is a term coined by Roy Fielding in his PhD dissertation describing a resource-oriented architecture style for networked systems http://www.ebuilt.com/fielding/pubs/dissertation/top.htm
  • 29. REST Roger Costello has written a useful Tutorial and Introduction to REST: http://www.xfront.com/REST.html Summary of a REST-style interaction : Find or work out the resource address or URL Retrieve the web resource using the URL A representation of the resource is returned (such as a HTML page or an XML document) The returned data is processed to place the client in a particular state (perhaps by rendering the HTML page) Hyperlinks in the resource data can be used to retrieve related resources, which transfers the client to a new state (such as by rendering a different HTML page) The client application changes state with each resource representation retrieval --> “Representation State Transfer”
  • 30. REST Example – Stage 1 Server Client GET http://www.TheArchitect.co.uk/weblog/index.xml HTTP/1.1 HTTP Request HTTP response data Eg. RSS data for my weblog
  • 31. REST - Example return data - 1 <?xml version=&quot;1.0&quot; encoding=&quot;iso-8859-1&quot;?> < rss version =&quot; 2.0 &quot;> < channel > < title > TheArchitect.co.uk - Jorgen Thelin&apos;s weblog </ title > < link > http://www.thearchitect.co.uk/weblog/ </ link > < item > < link > http://www.thearchitect.co.uk/weblog/archives/2003/03/000106.html </ link > < pubDate > Sat, 22 Mar 2003 00:01:00 GMT </ pubDate > < guid > http://www.thearchitect.co.uk/weblog/archives/2003/03/000106.html </ guid > < title > Internet Radio is Cool </ title > < description > I am sitting here in my hotel room in Salt Lake City finishing off some outstanding work, and I can listen via the Internet to my local radio station at home - London&apos;s Capital FM Internet radio is so cool! </ description > < comments > http://www.thearchitect.co.uk/cgi-bin/mt/mt-comments.cgi?entry_id = 106 </ comments > </ item > </ channel > </ rss >
  • 32. REST Example – Stage 2 Server Client GET http://www.thearchitect.co.uk/weblog/archives/2003/03/000106.html HTTP Request HTTP response data Eg. HTML page for one page in my weblog
  • 33. SOAP vs. REST SOAP is often seen as a direct rival to a REST-based architecture, as SOAP v1.1 used a solely Service-oriented approach, and the debate from both sides has been savage! http://lists.w3.org/Archives/Public/www-tag/2002Apr/0235.html In fact, support for a more REST-based architecture style have been included in the SOAP 1.2 Specification with the new SOAP Web Method facilities: http://www.w3.org/TR/soap12-part2/#WebMethodFeature Using “RESTful SOAP” can be useful for exposing cacheable (typically read-only or idempotent) SOAP operations Sam Ruby has written an article comparing SOAP and REST and showing how they can co-exist peacefully together: http://www.intertwingly.net/stories/2002/07/20/restSoap.html
  • 34. Web Services vs. REST - 1 There is no real conflict between the general idea of Web Services and the REST approach From W3C “Web Services Description Requirements” document: Definition: A Web Service is a software application identified by a URI [IETF RFC 2396] , whose interfaces and binding are capable of being defined, described and discovered by XML artifacts and supports direct interactions with other software applications using XML based messages via Internet-based protocols.
  • 35. Web Services vs. REST - 2 Web Service standards already support many RESTful features, and are adding more: HTTP GET bindings in WSDL v1.1 SOAP Web Methods in SOAP v1.2 The total set of Web Service specifications provide a super set of the REST approach – supporting Service-oriented as well as Resource-oriented mechanisms WSDL v1.2 should add facilities to allow the full description of the payload formats for REST / Resource-oriented approaches based in URLs Roger Costello has written an article on “Building Web Services the REST way” : http://www.xfront.com/REST-Web-Services.html
  • 37. Comparison of 3 Distributed Architecture Styles Specific to this service – description is protocol specific (e.g. WSDL) Generic to the request mechanism (e.g. HTTP verbs) Specific to this object / class – description is middleware specific (e.g. IDL) Application interface Creation of request payloads Request addressing (usually URLs) Marshalling parameter values Main Focus Yes – part of service description (e.g. XML Schema in WSDL) No – nothing directly linked to address / URL Yes – usually middleware specific (e.g. IDL) Payload / data format description No Yes No Are replies cacheable? One endpoint address per service Unique address per resource Routed to unique object instance Addressing / Request routing Service instances Resource instances Object instances Granularity Service-oriented Resource-oriented Object-oriented Attribute
  • 38. Choosing – Object Oriented Architectures Involve tight coupling between client and server, due to: Object reference semantics Object serialization Early binding to interfaces Usually best for “ closed ” systems controlled by a single organization
  • 39. Choosing – Resource Oriented Architectures Involve loose-coupling between client and server, due to: Late binding to resource data Successful use revolves around the cache-ability of resource data So most typically used for operations which are: For read-only or read-mostly data Involve idempotent (repeatable) operations, Return results with a “validity window” or “expiration period” Tend to scale well due to their stateless nature. Usually best for “ linking and referring ” across organization boundaries
  • 40. Choosing – Service Oriented Architectures Involve loose-coupling between client and server, due to: Late binding to service interface Full interface and payload descriptions in interface contract Generally the most flexible – can support request/response and message passing systems Tend to scale well due to their stateless nature. Usually best for “ shared ” systems crossing organization boundaries
  • 41. Combining Architecture Styles Usually best to stick to a single architecture style, but combinations are technically possible For example, a Web Service application could use a combination of architecture styles: Resource-oriented approach for simple data reads Service-oriented approach for complex data retrieval operations or data updates
  • 43. Summary Two main distributed system types are: Request / Response Message passing Three main Request/Response architecture styles are: Object-oriented Resource-oriented Service-oriented The choice of architecture style is an important decision for any software system Choice of architecture style can have implications on scalability , re-usability and ease of interconnection with other systems Web Services can be written using both Resource-oriented or Service-oriented approaches SOAP v1.2 and WSDL v1.2 are helping to unify this
  • 44. Resources Cape Clear Software WSDL Editor Web Services Development tool set XML Integration Server supporting Web Services http://www.capeclear.com CapeScience Papers, articles, tutorials, and webcasts for Web Services developers http://www.capescience.com Jorgen Thelin’s Weblog Weblog covering enterprise systems development, and especially Web Services http://www.TheArchitect.co.uk/weblog/