Implementing RIA and OpenEdge

bootlessbwakInternet και Εφαρμογές Web

12 Νοε 2013 (πριν από 3 χρόνια και 9 μήνες)

475 εμφανίσεις

Implementing

RIA and OpenEdge



Dustin Grau

Senior Consultant


BravePoint, Inc.

Session 137

© 2009 Progress Software Corporation. All rights reserved.


Introduction



Rich Internet Application (RIA)


Web applications with characteristics of a desktop application


Primarily implemented and delivered via frameworks


Runtime Frameworks: Adobe Air, Microsoft Silverlight


Lightweight JavaScript Frameworks: jQuery, Prototype, Dojo


Heavyweight JavaScript Frameworks: SmartClient


Focus of this Session: Implementation via JavaScript


LGPL version of SmartClient from Isomorphic Software


Used for our own internal project to web
-
enable an ABL application


Had more required features for our project than other frameworks

2

© 2009 Progress Software Corporation. All rights reserved.


Introduction (Continued)



Benefits of a JavaScript RIA Solution


Can deploy on a single server or offer Software as a Service


Developers can avoid browser quirks by using a framework


Removes the need for special browser plug
-
ins


Ability to web
-
enable existing ABL business logic


By creating a handler for framework requests


By calling existing procedures/classes

3

© 2009 Progress Software Corporation. All rights reserved.


Application Demo


4

© 2009 Progress Software Corporation. All rights reserved.


System Architecture (Traditional Model)


5

DB

Client Browser

(HTML Content)

http://...

Traditional WebSpeed Application Data Path

Web Server

(IIS/Apache)

WebSpeed

Application

Logic

HTML

© 2009 Progress Software Corporation. All rights reserved.


System Architecture (RIA Model)


6

Client Browser

(JS Framework)

http://...

Rich Internet Application Data Path

Web Server

(IIS/Apache)

WebSpeed

Application

Logic

JSON
-
RPC

DB

RPC Manager

RPC Handler

© 2009 Progress Software Corporation. All rights reserved.


Prerequisites



Knowledge of Temp
-
Tables and/or ProDataSets


Familiarity with creating WebSpeed application


JavaScript and Object Oriented Programming Experience


Understanding of Asynchronous Requests (AJAX)


Progress OE10.2B for JSON Support


Familiarity with JSON


See Michael Resnick’s session #126, Serializing ProDataSets to JSON

7

© 2009 Progress Software Corporation. All rights reserved.


Linking Components


Need a Common Language: JSON


“Jason”: JavaScript Object Notation (http://www.json.org)


Simple, lightweight data format using JavaScript structures


Faster to parse than XML in JavaScript (lower overhead)


Supported by most JavaScript frameworks natively


By itself only provides a basic structure for data


JSON
-
RPC Protocol (Version 2.0)


Stateless, lightweight RPC protocol utilizing JSON


Based on XML
-
RPC specifications (similar in structure)


Provides envelope information for data payload


Makes JSON data packets more verbose (status/errors)


Can be added to JavaScript frameworks via plug
-
ins/extensions

8

© 2009 Progress Software Corporation. All rights reserved.


Linking Components (Client
-
Side)


Each Framework has an AJAX “RPC Manager”


Handles the request/response cycle for the client


Matches transaction parameters to returned results


Can batch sequential requests together


Simultaneous requests from multiple objects


Hides complexity of request/response cycle


Has workarounds for any non
-
standard web browsers


SmartClient has Data
-
Bound Components


A DataSource handles CRUD operations via the RPC Manager


UI components linked to a DataSource update automatically

9

© 2009 Progress Software Corporation. All rights reserved.


Linking Components (Client
-
Side)

10

JavaScript RIA Framework

RPC

Manager

DataSource

HTTP

Request

HTTP

Response

UI Widget

Record

Displayed

CRUD

Record

Data

© 2009 Progress Software Corporation. All rights reserved.


Linking Components (Server
-
Side)

11

WebSpeed Agent

HTTP

Response

JSON
-
RPC

BL (ABL)

RPC Handler (SUPER_PROC)

HTML

Parser

Status/Error

TT/DS

TT/DS

JSON
-
RPC

HTTP

Request

Writer

JSON

© 2009 Progress Software Corporation. All rights reserved.


Linking Components (In Action)


Request/Response Cycle


SmartClient Debug Console


Request Packet


Response Packet


Examine Code from Demo


Client


JSON
-
RPC DataSource


Data
-
Bound Component


Server


Temp
-
Tables/ProDataSets


WebSpeed RPC Handler


Accessing a Method in ABL

12

© 2009 Progress Software Corporation. All rights reserved.


Implementation Concerns


Issues Encountered


State Management


Security and Authentication

13

© 2009 Progress Software Corporation. All rights reserved.


Issues Encountered


SmartClient only natively supports JSON


Created a custom DataSource for JSON
-
RPC


Just an extension of SmartClient’s JSON DataSource class


Applied the envelope information per the protocol’s specification


SmartClient expects only 1 table per DataSource


Does not natively support concept of a Dataset (group of tables)


Can use XPath to select a specific node (table) within the Dataset


Progress did not support JSON prior to OE10.2B


Wrote our own parser/writer in Java, connect using JNI/C++


Other methods (e.g. string/longchar manipulation) was too slow


Created our own “RPC Engine” to handle arbitrary JSON data


View session #126, Serializing ProDataSets to JSON for ideas

14

© 2009 Progress Software Corporation. All rights reserved.


State Management


A JavaScript application acts like traditional GUI


Single browser window for life of application


Must maintain state of multiple “screens”


User Session & Attributes


Can be used client
-
side when JS application is running


Only non
-
critical values should be stored client
-
side


Value Persistence (e.g., User Context)


Requires storage server
-
side

15

© 2009 Progress Software Corporation. All rights reserved.


16

Security and Authentication


Code and data is available to the user!


Dev tools are available (e.g., GreaseMonkey in FireFox)


Could be accessed/manipulated by the end
-
user


Don’t send data that the user should not see


Secure data and business logic server
-
side when possible

© 2009 Progress Software Corporation. All rights reserved.


Final Recommendations


Consider implementing an RIA for reach and richness


Choose a JavaScript framework to avoid plugins


http://en.wikipedia.org/wiki/Comparison_of_JavaScript_frameworks


Use JSON as a common communication language


Use JSON
-
RPC for more flexibility with your data packets


Evaluate and extend your framework if necessary


Build a server
-
side RPC Handler for JSON requests


Will be custom to your own project’s needs


Leverage existing business logic in OpenEdge


Call via your RPC Handler implementation


Consider state management and security

17

Implementing

RIA and OpenEdge



Dustin Grau

Senior Consultant


BravePoint, Inc.

Session 137