52
<Insert Picture Here> Web Oriented Architecture (reloaded) Emiliano Pecis Technology Business Unit

Woa. Reloaded

Embed Size (px)

DESCRIPTION

Neo, wake up! SOA has you! :)A complete accademic overview about the Web Oriented Architecture. A comparison between WOA and SOA is well described. What is ReST and why it is so important for the WOA. A proxy ReST-to-SOAP, based on Oracle Service Bus, is explained. Which products WOA lovers are searching for? This presentation has some "sponsored slides" from Oracle.

Citation preview

Page 1: Woa. Reloaded

<Insert Picture Here>

Web Oriented Architecture (reloaded)

Emiliano PecisTechnology Business Unit

Page 2: Woa. Reloaded

Wake Up, Neo. SOA has you…

Page 3: Woa. Reloaded

Red or Blue pill?

WOA SOA

Page 4: Woa. Reloaded

Agenda

Page 5: Woa. Reloaded

WOA & SOA

Page 6: Woa. Reloaded

<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

Page 7: Woa. Reloaded

WOA – Web Oriented Architecture

Page 8: Woa. Reloaded

WOA & SOA

Page 9: Woa. Reloaded

WOA versus SOA: not a competition

Page 10: Woa. Reloaded

The elements of WOA

Page 11: Woa. Reloaded

Make it simple with mashups

Page 12: Woa. Reloaded

WOA – All About Resources

Page 13: Woa. Reloaded

WOA and low case semantic web

Page 14: Woa. Reloaded

ReST vs SOAP

Page 15: Woa. Reloaded

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.

Page 16: Woa. Reloaded

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

Page 17: Woa. Reloaded

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.1Host: 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

Page 18: Woa. Reloaded

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

Page 19: Woa. Reloaded

Processes and Resources

Page 20: Woa. Reloaded

REST API

Page 21: Woa. Reloaded

Sponsored Slide: WLP is REST enabled

Page 22: Woa. Reloaded

Developing a scalable WOA

Page 23: Woa. Reloaded

WOA and (server side) scalability

Page 24: Woa. Reloaded

10110001011001011101100101100101110001110

101100010110010111011001011001011100011101111110001110

Application Servers

Web Servers

Ever Expanding Universe of Users

The need of a Datagrid

• Data grid brokers Data Supply with Data Demand

• Scale out Data Grid in middle tier using commodity hardware

Data Sources

Data Demand

Java Objects

Page 25: Woa. Reloaded

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

Page 26: Woa. Reloaded

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!

Page 27: Woa. Reloaded

• 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?

Page 28: Woa. Reloaded

• 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?

Page 29: Woa. Reloaded

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

Page 30: Woa. Reloaded

WOA actors

Client sideClient side Server sideServer side

Page 31: Woa. Reloaded

WOA actors #1: AJAX

• Asynchronous JavaScript and XML• Combination: XMLHttpRequest, xml,

dom, html, json• Enables the partial page refresh

feature

Page 32: Woa. Reloaded

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

Page 33: Woa. Reloaded

WOA actors #3: Json

• JavaScript Object Notation• 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

Page 34: Woa. Reloaded

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

Page 35: Woa. Reloaded

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

Page 36: Woa. Reloaded

Scaling a SOA with the Datagrid

Page 37: Woa. Reloaded

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!

Page 38: Woa. Reloaded

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

ServiceProvider

[data item]

[data item]

Service

MySelfServPortal

CoherenceGrid

NearCache

CacheThis is a very large piece of customer data that has to be obtained in one go from the system.

Page 39: Woa. Reloaded

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

Page 40: Woa. Reloaded

Restifying and caching a SOA

Page 41: Woa. Reloaded

RSD: parse the URL

http://siebel.com/rsd/catalog/product/id/5461

?n1=v1&n2=v2…

get / put / post / delete

Page 42: Woa. Reloaded

RSD: check if cachedCheck 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

Page 43: Woa. Reloaded

RSD: check if cachedCheck 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

Page 44: Woa. Reloaded

RSD: check if cachedCheck 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

Page 45: Woa. Reloaded

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

?

Page 46: Woa. Reloaded

RSD: the configuration file

GET /rsd/catalog/categories/id/3473

Page 47: Woa. Reloaded

RSD: check if cachedCheck 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

Page 48: Woa. Reloaded

RSD: check if cachedCheck 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

Page 49: Woa. Reloaded

P

BBackup

Node

PrimaryNodeGet / Put (Cachekey)

Service Data

Coherence Data Grid

OSB ResultCache

Ora

cle

Serv

ice B

us

1. check cache

2. if results not in cache, invoke service & cache results

Resource

SOAP/XML

REST/JSON

Ora

cle

Web

log

ic

Porta

l O

ther

Porta

ls

•Siebel•WCM•Wiki•Blog•Forum•…

Any Web Services

Clie

nt /b

row

ser

Page 50: Woa. Reloaded

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

Page 51: Woa. Reloaded

Q&A

Page 52: Woa. Reloaded