32
JSON SOA-based Client/Server Application Development Kris Zyp

Json-based Service Oriented Architecture for the web

  • Upload
    kriszyp

  • View
    9.018

  • Download
    2

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Json-based Service Oriented Architecture for the web

JSON SOA-based Client/Server Application

Development

Kris Zyp

Page 2: Json-based Service Oriented Architecture for the web

© SitePen, Inc. 2008. All Rights Reserved

Page 3: Json-based Service Oriented Architecture for the web

© SitePen, Inc. 2008. All Rights Reserved

Overview

SOA on the webService Method Description for defining servicesDojo based approach to SOA

Page 4: Json-based Service Oriented Architecture for the web

© SitePen, Inc. 2008. All Rights Reserved

SOA-Based Client/Server Model

Distribution of ProcessingUser response latencyProgramming modelVector of attackState management on server vs clientOffline capabilitiesInteroperability

Page 5: Json-based Service Oriented Architecture for the web

© SitePen, Inc. 2008. All Rights Reserved

Service Oriented Architecture on the Web

Web Service ProviderWeb Service Provider

CS Web CS Web ClientClient

Methods

Web Web ClientClient

Methods

Desktop Desktop ClientClient

Methods

Page 6: Json-based Service Oriented Architecture for the web

© SitePen, Inc. 2008. All Rights Reserved

Service Mapping Description

JSON-based service definition structureDefines

TransportParametersExpected ResponseDescription

Clients can use an SMD to build methods to auto-connect to endpoints

Page 7: Json-based Service Oriented Architecture for the web

© SitePen, Inc. 2008. All Rights Reserved

Service Types

RESTJSONPPlain GETFull read/write (PUT, POST, DELETE)

RPCJSON-RPC

Different URL forms/path/id?name=value

Page 8: Json-based Service Oriented Architecture for the web

© SitePen, Inc. 2008. All Rights Reserved

Dojo Includes SMDs for major web servicesSMDs for third party services

WikipediaYahooWikipedia

Web services can advertise their services

Page 9: Json-based Service Oriented Architecture for the web

© SitePen, Inc. 2008. All Rights Reserved

Dojo Support for SOA

Page 10: Json-based Service Oriented Architecture for the web

© SitePen, Inc. 2008. All Rights Reserved

Services

Page 11: Json-based Service Oriented Architecture for the web

© SitePen, Inc. 2008. All Rights Reserved

var services = new dojox.rpc.Service("/mySMD");

or

var services = new dojox.rpc.Service({

transport:”REST”,

services:{

newsService:{...}

}

});

services.newsService({query:"dojo"}.

addCallback(function(returnValue) {

alert("A news item: " + returnValue[0]);

});

var services = new dojox.rpc.Service("/mySMD");

or

var services = new dojox.rpc.Service({

transport:”REST”,

services:{

newsService:{...}

}

});

services.newsService({query:"dojo"}.

addCallback(function(returnValue) {

alert("A news item: " + returnValue[0]);

});

Example of Service Auto-Generation

Page 12: Json-based Service Oriented Architecture for the web

© SitePen, Inc. 2008. All Rights Reserved

Dojo Data

Page 13: Json-based Service Oriented Architecture for the web

© SitePen, Inc. 2008. All Rights Reserved

http://archive.dojotoolkit.org/nightly/dojotoolkit/dojox/grid/tests/test_yahoo_search.htmlhttp://www.sitepen.com/blog/2008/06/25/web-service-data-store/

ServiceStore

Adapts web services to dojo.data APIPlug services directly into widgetsSupports lazy loading

Page 14: Json-based Service Oriented Architecture for the web

© SitePen, Inc. 2008. All Rights Reserved

Read/Write (Real) REST Services

Full REST Services can plugin for full read/write ORM-style functionality:

GET - query and get by idPUT - update an objectPOST - create an objectDELETE - delete an object

Page 15: Json-based Service Oriented Architecture for the web

© SitePen, Inc. 2008. All Rights Reserved

schema:

{"description":"A person",

"type":"object",

"properties":

{"name": {"type":"string"},

"age" : {"type":"integer",

"maximum":125}}

}

instance:

{“name”:”Kris”,

"age":31}

schema:

{"description":"A person",

"type":"object",

"properties":

{"name": {"type":"string"},

"age" : {"type":"integer",

"maximum":125}}

}

instance:

{“name”:”Kris”,

"age":31}

JSON Schema

Page 16: Json-based Service Oriented Architecture for the web

© SitePen, Inc. 2008. All Rights Reserved

JSON Referencing

• Hyperlinking appplied to JSON

• Cyclic

• Multiple references

• Cross-message references

• Cross-site references

Page 17: Json-based Service Oriented Architecture for the web

© SitePen, Inc. 2008. All Rights Reserved

JsonRestStore

Full Read/Write APICreate, Read/Query, UpdateDelete

Standards Based (HTTP compliant)

Page 18: Json-based Service Oriented Architecture for the web

© SitePen, Inc. 2008. All Rights Reserved

Accompanied by Demo

JsonRestStore

Lazy loadingJSON ReferencingJSON SchemaTransactionalOffline Support

Page 19: Json-based Service Oriented Architecture for the web

© SitePen, Inc. 2008. All Rights Reserved

Push/Comet

Open Protocols for CometBayeuxXMPPREST Channels

Page 20: Json-based Service Oriented Architecture for the web

© SitePen, Inc. 2008. All Rights Reserved

Bayeux

• Service Negotiation

• Publish/Subscribe Protocol

Page 21: Json-based Service Oriented Architecture for the web

© SitePen, Inc. 2008. All Rights Reserved

REST Channels

• REST Based Push Protocol

• Based on HTTP standard semantics

Page 22: Json-based Service Oriented Architecture for the web

© SitePen, Inc. 2008. All Rights Reserved

HTTP/1.1 200 OK

X-Event: PUT

Content-Location: /foo/bar

New content of /foo/bar

HTTP/1.1 200 OK

X-Event: PUT

Content-Location: /foo/bar

New content of /foo/bar

HTTP Channels (REST Channels over HTTP)

Page 23: Json-based Service Oriented Architecture for the web

© SitePen, Inc. 2008. All Rights Reserved

Accompanied by Demo

{

“event”: “put”

“source”: “/foo/bar”

“content”: “New content of /foo/bar”

}

{

“event”: “put”

“source”: “/foo/bar”

“content”: “New content of /foo/bar”

}

REST Channels in JSON

Page 24: Json-based Service Oriented Architecture for the web

© SitePen, Inc. 2008. All Rights Reserved

Offline + REST

• REST + Thin Server = Easy Offline

• Dojo’s support for Offline SOA Applications

Page 25: Json-based Service Oriented Architecture for the web

© SitePen, Inc. 2008. All Rights Reserved

Security in SOA

• Security clearly distinct from UI code

• Assume users are directly accessing services

• Improved isolation of security

Page 26: Json-based Service Oriented Architecture for the web

© SitePen, Inc. 2008. All Rights Reserved

The browser is the platform of mashups

• Neutral ground, browser acts as a deputy/mediator

• JSON is the foundation for more complex data/code integration

• Cross-site mashup techniques emerging

http://www.sitepen.com/blog/2008/09/25/security-in-ajax/

Page 27: Json-based Service Oriented Architecture for the web

© SitePen, Inc. 2008. All Rights Reserved

Dojo Secure

Full framework for secure mashups Secure cross-site loading registry Adsafe style code validation Safe set of library functions Safe access to the DOM

http://www.sitepen.com/blog/2008/08/01/secure-mashups-with-dojoxsecure/

Page 28: Json-based Service Oriented Architecture for the web

© SitePen, Inc. 2008. All Rights Reserved

http://www.sitepen.com/blog/2008/07/18/clientserver-model-on-the-web/

Characteristics of good client/server application

• Clean Web API

• Interchangeability

• Presentation on the client

• Business logic on the server

Page 29: Json-based Service Oriented Architecture for the web

© SitePen, Inc. 2008. All Rights Reserved

Dojo’s SOA

• Service auto configuration

• Integration into Dojo Data model

• Full REST interaction support

• Comet and Offline capabilities

• All based on standards or emerging conventions, easy to switch to something else

Page 30: Json-based Service Oriented Architecture for the web

© SitePen, Inc. 2008. All Rights Reserved

The Open Web is more than just licensing

Page 31: Json-based Service Oriented Architecture for the web

© SitePen, Inc. 2008. All Rights Reserved

My other presentation

Applied JSON: REST, Ajax Databases

Page 32: Json-based Service Oriented Architecture for the web

© SitePen, Inc. 2008. All Rights Reserved