Web Oriented Architecture (reloaded) Emiliano Pecis Technology Business Unit
Wake Up, Neo. SOA has you…
Red  or  Blue  pill? WOA SOA
Agenda
WOA & SOA
<Insert Picture Here> “ In other words, the Web model provides a single, open, and unified  information architecture that is consistent, easily consumed, extremely scalable, securable, very reusable, resilient, and highly federated.” Dion Hinchcliffe   Founder, Hinchcliffe & Co.  Dion Hinchcliffe’s Blog
WOA – Web Oriented Architecture
WOA & SOA
WOA versus SOA: not a competition
The elements of WOA
Make it simple with mashups
WOA – All About Resources
WOA and  low case  semantic web
ReST vs SOAP
Introducing REST Nouns:  All resources, or nouns, are network-addressable with a global URL. Resources have “href” references to other related resources. The only way to address a resource is with a URL. Verbs:  A common set of verbs are used to access all resources. The HTTP methods GET, PUT, POST, and DELETE map to retrieve, update, create, and delete (CRUD) functions.  Representations:  A resource might be represented as XML, JSON, HTML, text, image, and so on. Instantiating representation from or to the resource is handled on the server. A client can pick its preferred representation via a URI parameter or the “Accept:” header.
REST Patterns 1/2 Give every “thing” an ID (URI): http://example.com/orders/2007/11  Link things together (Hypermedia links): <order self='http://example.com/customers/1234' >    <amount>23</amount>    <product ref='http://example.com/products/4554' />    <customer ref='http://example.com/customers/1234' />  </order>  Use standard methods (HTTP verbs)  GET is safe and idempotent PUT and DELETE are not safe but are idempotent POST is neither safe nor idempotent
REST Patterns 2/2 Resources with multiple representations GET /customers/1234 HTTP/1.1 Host: example.com  Accept: application/vnd.mycompany.customer+xml  GET /customers/1234 HTTP/1.1 Host: example.com  Accept: text/x-vcard  Communicate statelessly  Cookies shouldn’t be used to encode information that can be transferred by other, more standardized means
REST Anti Patterns Tunneling everything through GET or POST http://example.com/some-api?method=deleteCustomer&id=1234 Resources are not identified by URIs; rather, URIs are used to encode operations and their parameters The HTTP method does not necessarily match the semantics Such links are usually not intended to be bookmarked There is a risk that “crawlers” (e.g. from search engines such as Google) cause unintended side effects   Ignoring caching  Cache-control: no-cache (always) Ignoring status code Misusing of 200 or 500 status code
Processes and Resources
REST API
Sponsored Slide: WLP is REST enabled
Developing a scalable WOA
WOA and (server side) scalability
The need of a Datagrid Data grid  brokers Data Supply with  Data Demand Scale out  Data Grid in middle tier using commodity hardware Application Servers Web Servers Ever Expanding Universe of Users Data Sources Data Demand Java Objects 10110001011001011101100101100101110001110 101100010110010111011001011001011100011101111110001110
What is a datagrid? Caching Applications request data from the Data Grid rather than backend data sources Analytics Applications ask the Data Grid questions from simple queries to advanced scenario modeling Transactions Data Grid acts as a transactional System of Record, hosting data and business logic Events Automated processing based on event
How does it work? Data spread and backed up across Members Transparent to developer Members have access to all Data All Data locations are known – no lookup & no registry!
Synchronous Update Avoids potential Data Loss & Corruption Predictable Performance Backup Partitions are partitioned away from Primaries for resilience No engineering requirement to setup Primaries or Backups Automatically and Dynamically Managed Write-behind How does it work?
Membership changes (new members added or members leaving) Other members, using  consensus , recover and repartition automatically No in-flight operations lost, no availability gap! Some latencies (due to higher priority of asynchronous recovery) Information Reliability & Continuous Availability are the priorities How does it work?
Sponsored Slide: Oracle Coherence Implements Map interface Implements JCache interface Real-time filterable (bean) events  Filters completely extensible Processors applied in parallel (grid) A large range of filters out-of-the-box Implements listeners
WOA actors Client side Server side
WOA actors #1: AJAX  Asynchronous JavaScript and XML Combination: XMLHttpRequest, xml, dom, html, json Enables the partial page refresh feature
WOA actors #2: JS frameworks More high level than pure javascript Examples: dojo, scriptaculous, prototype, jquery, mooTools, yui A lot of stuff done, just invoke it! Ready for ajax and json
WOA actors #3: Json J ava S cript  O bject  N otation More light than XML (data with less structures) Directly interpretrated by javascript No effort for creating / (de) serializing a tree dom Tens folders more fast More simple to traverse and get attributes
WOA developers love… Agile MVC framework like Grails Complete lightweight container like Spring Lightweight application server ORM like Toplink or Hibernate Data cache layer like Coherence or ehcache
Sponsored Slide: Weblogic Suite  Startup the container with just a web profile (no ejb, no rmi, no jca, no jms) Weblogic Server supports Spring with a dedicated console Weblogic Server uses Toplink as ORM Weblogic Suite includes Oracle Coherence for the datagrid  Coherence*Web is used to manage sessions in a datagrid fashion and to cache WLP objects
Scaling a SOA with the Datagrid
What does the scalable architecture need to ensure Avoid processing where possible  Avoid I/O where possible Avoid serialization and de-serialization Avoid sending large documents over network Avoid distributed file schemes as your app scales up Avoid driving increasing traffic to backend systems  Architect for performance from the beginning aka  not  throwing hardware at the problem!
Data Grid for SOA Services Benefits Up to10 fold reduction in latency times used Cached data Cache available to other nodes in the cluster. Data grid provides backup of cache to peer nodes Cache can be persisted to the database using a number of mechanisms. Service  Bus Portal Orchestration Engine Service Provider [data item] [data item] Service MySelfServPortal Coherence Grid Near Cache Cache This is a very large piece of customer data that has to be obtained in one go from the system.
Restifying and caching a SOA Problem Siebel CRM works properly, but doesn’t scale as expected Challenges Customer requires rapid access to accurate information All data must be available for a Social CRM Mashup Customer wants to cache better the most frequently invoked services Solution (*) Implement  a solution that is able to  restify  and  cache  all needed WS-SOAP exposed by Siebel  (*)  Custom solution, it’s not a product:  just for demo purpose
Restifying and caching a SOA
RSD: parse the URL http://siebel.com/rsd/catalog/product/id/5461 ?n1=v1&n2=v2… get / put / post / delete
RSD: check if cached Check the cache only if GET method has been used Assign a XML payload to a variable Send the payload to Coherence through the OSB Transport if Coherence is not UP a WS call will be done If the item is not in the cache a WS call will be done) Skipcache  variable will be tested to decide if it is the case to return the cached value or invoke the WS
RSD: check if cached Check the cache only if GET method has been used Assign a XML payload to a variable Send the payload to Coherence through the OSB Transport if Coherence is not UP a WS call will be done If the item is not in the cache a WS call will be done) Skipcache  variable will be tested to decide if it is the case to return the cached value or invoke the WS
RSD: check if cached Check the cache only if GET method has been used Assign a XML payload to a variable Send the payload to Coherence through the OSB Transport if Coherence is not UP a WS call will be done If the item is not in the cache a WS call will be done) Skipcache  variable will be tested to decide if it is the case to return the cached value or invoke the WS
RSD: the configuration file GET  /rsd/catalog/categories/id/3473 The following URI parts select the needed WS parts:   This is the SOAP operation to invoke This is the SOAP payload to load This is the SOAP response to  return But, what about the URL parameters?
RSD: the configuration file GET  /rsd/catalog/categories/id/3473
RSD: check if cached Check the cache only if GET method has been used Assign a XML payload to a variable Send the payload to Coherence through the OSB Transport if Coherence is not UP a WS call will be done If the item is not in the cache a WS call will be done) Skipcache  variable will be tested to decide if it is the case to return the cached value or invoke the WS
RSD: check if cached Check the cache only if GET method has been used Assign a XML payload to a variable Send the payload to Coherence through the OSB Transport if Coherence is not UP a WS call will be done If the item is not in the cache a WS call will be done) Skipcache  variable will be tested to decide if it is the case to return the cached value or invoke the WS
P B Backup  Node Primary Node Get / Put (Cachekey) Service Data Coherence Data Grid OSB  Result Cache Oracle Service Bus 1. check cache 2. if results not in cache, invoke service & cache results Resource SOAP/XML REST/JSON Oracle Weblogic Portal Other Portals Siebel WCM Wiki Blog Forum … Any Web Services Client /browser
Restful Datagrid Reasonings In REST each resource has a unique URL This URL is the primary key for the Datagrid (Coherence) The cached value is stored in JSON format to be as “client ready” as possible REST and JSON give developers more flexibility, ensuring a strong  light-matter coupling between content and its rapresentation Javascript frameworks, like Jquery, allows developers to get JSON data from the datagrid and manipulate them as they prefer
Q&A
 

Woa. Reloaded

  • 1.
    Web Oriented Architecture(reloaded) Emiliano Pecis Technology Business Unit
  • 2.
    Wake Up, Neo.SOA has you…
  • 3.
    Red or Blue pill? WOA SOA
  • 4.
  • 5.
  • 6.
    <Insert Picture Here>“ In other words, the Web model provides a single, open, and unified information architecture that is consistent, easily consumed, extremely scalable, securable, very reusable, resilient, and highly federated.” Dion Hinchcliffe Founder, Hinchcliffe & Co. Dion Hinchcliffe’s Blog
  • 7.
    WOA – WebOriented Architecture
  • 8.
  • 9.
    WOA versus SOA:not a competition
  • 10.
  • 11.
    Make it simplewith mashups
  • 12.
    WOA – AllAbout Resources
  • 13.
    WOA and low case semantic web
  • 14.
  • 15.
    Introducing REST Nouns: All resources, or nouns, are network-addressable with a global URL. Resources have “href” references to other related resources. The only way to address a resource is with a URL. Verbs: A common set of verbs are used to access all resources. The HTTP methods GET, PUT, POST, and DELETE map to retrieve, update, create, and delete (CRUD) functions. Representations:  A resource might be represented as XML, JSON, HTML, text, image, and so on. Instantiating representation from or to the resource is handled on the server. A client can pick its preferred representation via a URI parameter or the “Accept:” header.
  • 16.
    REST Patterns 1/2Give every “thing” an ID (URI): http://example.com/orders/2007/11 Link things together (Hypermedia links): <order self='http://example.com/customers/1234' > <amount>23</amount> <product ref='http://example.com/products/4554' /> <customer ref='http://example.com/customers/1234' /> </order> Use standard methods (HTTP verbs) GET is safe and idempotent PUT and DELETE are not safe but are idempotent POST is neither safe nor idempotent
  • 17.
    REST Patterns 2/2Resources with multiple representations GET /customers/1234 HTTP/1.1 Host: example.com Accept: application/vnd.mycompany.customer+xml GET /customers/1234 HTTP/1.1 Host: example.com Accept: text/x-vcard Communicate statelessly Cookies shouldn’t be used to encode information that can be transferred by other, more standardized means
  • 18.
    REST Anti PatternsTunneling everything through GET or POST http://example.com/some-api?method=deleteCustomer&id=1234 Resources are not identified by URIs; rather, URIs are used to encode operations and their parameters The HTTP method does not necessarily match the semantics Such links are usually not intended to be bookmarked There is a risk that “crawlers” (e.g. from search engines such as Google) cause unintended side effects Ignoring caching Cache-control: no-cache (always) Ignoring status code Misusing of 200 or 500 status code
  • 19.
  • 20.
  • 21.
    Sponsored Slide: WLPis REST enabled
  • 22.
  • 23.
    WOA and (serverside) scalability
  • 24.
    The need ofa Datagrid Data grid brokers Data Supply with Data Demand Scale out Data Grid in middle tier using commodity hardware Application Servers Web Servers Ever Expanding Universe of Users Data Sources Data Demand Java Objects 10110001011001011101100101100101110001110 101100010110010111011001011001011100011101111110001110
  • 25.
    What is adatagrid? Caching Applications request data from the Data Grid rather than backend data sources Analytics Applications ask the Data Grid questions from simple queries to advanced scenario modeling Transactions Data Grid acts as a transactional System of Record, hosting data and business logic Events Automated processing based on event
  • 26.
    How does itwork? Data spread and backed up across Members Transparent to developer Members have access to all Data All Data locations are known – no lookup & no registry!
  • 27.
    Synchronous Update Avoidspotential Data Loss & Corruption Predictable Performance Backup Partitions are partitioned away from Primaries for resilience No engineering requirement to setup Primaries or Backups Automatically and Dynamically Managed Write-behind How does it work?
  • 28.
    Membership changes (newmembers added or members leaving) Other members, using consensus , recover and repartition automatically No in-flight operations lost, no availability gap! Some latencies (due to higher priority of asynchronous recovery) Information Reliability & Continuous Availability are the priorities How does it work?
  • 29.
    Sponsored Slide: OracleCoherence Implements Map interface Implements JCache interface Real-time filterable (bean) events Filters completely extensible Processors applied in parallel (grid) A large range of filters out-of-the-box Implements listeners
  • 30.
    WOA actors Clientside Server side
  • 31.
    WOA actors #1:AJAX Asynchronous JavaScript and XML Combination: XMLHttpRequest, xml, dom, html, json Enables the partial page refresh feature
  • 32.
    WOA actors #2:JS frameworks More high level than pure javascript Examples: dojo, scriptaculous, prototype, jquery, mooTools, yui A lot of stuff done, just invoke it! Ready for ajax and json
  • 33.
    WOA actors #3:Json J ava S cript O bject N otation More light than XML (data with less structures) Directly interpretrated by javascript No effort for creating / (de) serializing a tree dom Tens folders more fast More simple to traverse and get attributes
  • 34.
    WOA developers love…Agile MVC framework like Grails Complete lightweight container like Spring Lightweight application server ORM like Toplink or Hibernate Data cache layer like Coherence or ehcache
  • 35.
    Sponsored Slide: WeblogicSuite Startup the container with just a web profile (no ejb, no rmi, no jca, no jms) Weblogic Server supports Spring with a dedicated console Weblogic Server uses Toplink as ORM Weblogic Suite includes Oracle Coherence for the datagrid Coherence*Web is used to manage sessions in a datagrid fashion and to cache WLP objects
  • 36.
    Scaling a SOAwith the Datagrid
  • 37.
    What does thescalable architecture need to ensure Avoid processing where possible Avoid I/O where possible Avoid serialization and de-serialization Avoid sending large documents over network Avoid distributed file schemes as your app scales up Avoid driving increasing traffic to backend systems Architect for performance from the beginning aka not throwing hardware at the problem!
  • 38.
    Data Grid forSOA Services Benefits Up to10 fold reduction in latency times used Cached data Cache available to other nodes in the cluster. Data grid provides backup of cache to peer nodes Cache can be persisted to the database using a number of mechanisms. Service Bus Portal Orchestration Engine Service Provider [data item] [data item] Service MySelfServPortal Coherence Grid Near Cache Cache This is a very large piece of customer data that has to be obtained in one go from the system.
  • 39.
    Restifying and cachinga SOA Problem Siebel CRM works properly, but doesn’t scale as expected Challenges Customer requires rapid access to accurate information All data must be available for a Social CRM Mashup Customer wants to cache better the most frequently invoked services Solution (*) Implement a solution that is able to restify and cache all needed WS-SOAP exposed by Siebel (*) Custom solution, it’s not a product: just for demo purpose
  • 40.
  • 41.
    RSD: parse theURL http://siebel.com/rsd/catalog/product/id/5461 ?n1=v1&n2=v2… get / put / post / delete
  • 42.
    RSD: check ifcached Check the cache only if GET method has been used Assign a XML payload to a variable Send the payload to Coherence through the OSB Transport if Coherence is not UP a WS call will be done If the item is not in the cache a WS call will be done) Skipcache variable will be tested to decide if it is the case to return the cached value or invoke the WS
  • 43.
    RSD: check ifcached Check the cache only if GET method has been used Assign a XML payload to a variable Send the payload to Coherence through the OSB Transport if Coherence is not UP a WS call will be done If the item is not in the cache a WS call will be done) Skipcache variable will be tested to decide if it is the case to return the cached value or invoke the WS
  • 44.
    RSD: check ifcached Check the cache only if GET method has been used Assign a XML payload to a variable Send the payload to Coherence through the OSB Transport if Coherence is not UP a WS call will be done If the item is not in the cache a WS call will be done) Skipcache variable will be tested to decide if it is the case to return the cached value or invoke the WS
  • 45.
    RSD: the configurationfile GET /rsd/catalog/categories/id/3473 The following URI parts select the needed WS parts: This is the SOAP operation to invoke This is the SOAP payload to load This is the SOAP response to return But, what about the URL parameters?
  • 46.
    RSD: the configurationfile GET /rsd/catalog/categories/id/3473
  • 47.
    RSD: check ifcached Check the cache only if GET method has been used Assign a XML payload to a variable Send the payload to Coherence through the OSB Transport if Coherence is not UP a WS call will be done If the item is not in the cache a WS call will be done) Skipcache variable will be tested to decide if it is the case to return the cached value or invoke the WS
  • 48.
    RSD: check ifcached Check the cache only if GET method has been used Assign a XML payload to a variable Send the payload to Coherence through the OSB Transport if Coherence is not UP a WS call will be done If the item is not in the cache a WS call will be done) Skipcache variable will be tested to decide if it is the case to return the cached value or invoke the WS
  • 49.
    P B Backup Node Primary Node Get / Put (Cachekey) Service Data Coherence Data Grid OSB Result Cache Oracle Service Bus 1. check cache 2. if results not in cache, invoke service & cache results Resource SOAP/XML REST/JSON Oracle Weblogic Portal Other Portals Siebel WCM Wiki Blog Forum … Any Web Services Client /browser
  • 50.
    Restful Datagrid ReasoningsIn REST each resource has a unique URL This URL is the primary key for the Datagrid (Coherence) The cached value is stored in JSON format to be as “client ready” as possible REST and JSON give developers more flexibility, ensuring a strong  light-matter coupling between content and its rapresentation Javascript frameworks, like Jquery, allows developers to get JSON data from the datagrid and manipulate them as they prefer
  • 51.
  • 52.