+ All Categories
Home > Documents > Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob...

Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob...

Date post: 13-Apr-2018
Category:
Upload: ngotu
View: 218 times
Download: 1 times
Share this document with a friend
49
Consuming and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd http://www.mgateway.com Twitter: @rtweed
Transcript
Page 1: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

Consuming and Creating VistAWeb Services using EWD

Rob TweedM/Gateway Developments Ltd

http://www.mgateway.comTwitter: @rtweed

Page 2: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

Consuming

Web Services with EWD

Page 3: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

EWD

• Agile web application development framework for Cache & GT.M

Page 4: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

Web Application Frameworks

• Look after:

– Session management

– Security management

– State management

• Creating the illusion of a stateful environment on top of the stateless web architecture

Page 5: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

Interface

Script

Mainstream webMainstream web--enablement of enablement of VistAVistA

Browser

Web

ServerInternet/

Intranet

1. Request page

4. Send page

Vista

DatabaseGateway

Web Middle Tier

Java.Netetc

Page 6: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

VistA Web Enablement

• The mainstream forget or don’t realise:

– Mumps (Cache or GT.M) isn’t just a database

– Has its own integrated scripting language

– Mumps is capable of doing everything required for:

• Parsing HTTP requests

• Creating HTTP responses (HTML, XML, JSON ..)

• Session, state and security management

– Tailor-made for the web

Page 7: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

EWD runtime Architecture

Browser

Browser

Browser

WebServer

(Apache)

m_apache

GT.M

http/https

xinetd – basedpersistent

connections

MG

WS

I

EWDRuntime

Yourscripts

Yourdata

EWDPage

routines

Page 8: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

EWD runtime Architecture: WebLink

Browser

Browser

Browser

WebServer

(Apache/IIS)

WebLink Caché

http/https

WebLin

kin

terfa

ce

Caché

CS

P in

terfa

ce

Caché

Persistentconnections W

ebLin

kin

terfa

ce

EWDRuntime

Yourscripts

Yourdata

EWDWeblinkroutines

Page 9: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

EWD runtime Architecture: CSP

Browser

Browser

Browser

WebServer

(Apache/IIS)

CSP Caché

http/https

CS

P in

terfa

ce

Caché

Persistentconnections

CS

P in

terfa

ce

Yourscripts

Yourdata

EWDCSP

pages

Page 10: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

EWD runtime Architecture: Node.js

Browser

Browser

Browser

Caché

http/https

WebLin

kin

terfa

ce

Caché

CS

P in

terfa

ce

Child_processconnections

EWDRuntime

Yourscripts

Yourdata

EWDroutines

Node.jsprocess

ewdGatewayModule

stdin/stdout

GT.M orCaché

Page 11: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

Consuming Web Services

• How can EWD consume external web services?

– Require HTTP/HTTPS request to get XML response

– Parse and process the response

Page 12: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

EWD

• Its core is a native implementation of the XML DOM APIs

– Uses Globals as a graph database

• EWD incldes:

– XML DOM Parser

– XPath implementation

– HTTP Client

Page 13: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

EWD & Web Services

• EWD can be used to build desktop & mobile web applications that consume Web Services

– MDWS

Page 14: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

EWD Consuming Web Services

GT.M

MG

WS

I

EWDRuntime

WebService

EWDPage

routines

HTTP/HTTPSRequest

EWD HTTP Client

OnBeforeRenderMethod

Caché / GT.M

Page 15: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

EWD Consuming Web Services

GT.M

MG

WS

I

EWDRuntime

WebService

EWDPage

routines

SOAPResponse

EWD HTTP Client

OnBeforeRenderMethod

EWD XML Parser

XML DOM

Caché / GT.M

Page 16: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

EWD Consuming Web Services

GT.M

MG

WS

I

EWDRuntime

WebService

EWDPage

routines

XML DOM

OnBeforeRenderMethod

EWD XPath Queries EW

D S

essio

n

Caché / GT.M

Page 17: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

EWD Consuming MDWS Services

MG

WS

I

EWDRuntime

VistA

EWDPage

routines

HTTP/HTTPSRequest

EWD HTTP Client

OnBeforeRenderMethod

MDWS Interface

Caché / GT.M

Page 18: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

Demo/Proof of Concept

• Desktop Web UI using ExtJS

• 4 MDWS services

– connect

– login

– getClinics

– getPatientsByClinic

• Basic scheduler/calendar interface

• Running in the VHA Innovations Sandbox

Page 19: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

Downside of MDWS

• Current implementation uses RPC Brokers via .Net layer

• Ultimately this architecture will not scale

Page 20: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

With current VistA usage

User

GT.M orCache

CPRS

Statefullconnections

Broker connections

Terminal

PersistentProcesses

Page 21: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

MDWS adds to the problem

User

GT.M orCache

CPRS

Statefullconnections

Broker connections

Terminal

PersistentProcesses

MDWS.Net interface

Broker connection

One per MDWS user

Page 22: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

Web Services should be stateless

• EWD and its supporting architecture can make this possible

Page 23: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

Handling stateless requests

Web Server

Apache/IIS

m_apache/WebLink/etc

1. Request arrives froma user

User

User

Cache/GT.M Server

User 1

User 2

Page 24: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

Web Server

User

User

User 1

User 2

2. MGWSI establishesSocket and Session

Handling stateless requests

Apache/IIS

m_apache/WebLink/etc

Cache/GT.M Server

Page 25: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

Web Server

User

User

User 1

User 2

Processing...

3. User request isprocessed on GT.M server

Handling stateless requests

Apache/IIS

m_apache/WebLink/etc

Cache/GT.M Server

Page 26: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

Web Server

User

User

User 1

User 2

Processing...

4. Meanwhile a seconduser makes a request..

Handling stateless requests

Apache/IIS

m_apache/WebLink/etc

Cache/GT.M Server

Page 27: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

Web Server

User

User

User 1

User 2

Processing...

5. 2nd sessionEstablished by

MGWSI

Processing...

Handling stateless requests

Apache/IIS

m_apache/WebLink/etc

Cache/GT.M Server

Page 28: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

Web Server

User

User

User 1

User 2

6. User 2’s requestis completed.

Processing...

Write HTML

Handling stateless requests

Apache/IIS

m_apache/WebLink/etc

Cache/GT.M Server

Page 29: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

Web Server

User 3

User

User 1

User 2

Processing...

Waiting….

7. User 2’s processingstops. Connectionis maintained...

Handling stateless requests

Apache/IIS

m_apache/WebLink/etc

Cache/GT.M Server

Page 30: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

Web Server

User 3

User

User 1

User 2

Processing...

9. Session 2 isre-used for incomingRequest from User 3

Processing...

Handling stateless requests

Apache/IIS

m_apache/WebLink/etc

Cache/GT.M Server

Page 31: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

Web Server

User 3

User

User 1

User 2

Waiting...

9. Session 1 has finishedHandling user 1's request

and is now free

Processing...

Handling stateless requests

Apache/IIS

m_apache/WebLink/etc

Cache/GT.M Server

Page 32: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

Web Server

User 3

User

User 1

User 2

Processing...

9. 2nd request fromUser 2 is handledby process 1

Processing...

Handling stateless requests

Apache/IIS

m_apache/WebLink/etc

Cache/GT.M Server

Page 33: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

• Each back-end GT.M/Caché process supports multiple browsers/users

– Perhaps 10:1 to 20:1 ratio of concurrent users to physical processes

– Highly scalable architecture

– Extremely high performance

• Unused back-end processes aren't shut down

• Process startup overhead only for the 1st request

• gateway connects an incoming request to an existing waiting back-end process

Handling stateless requests

Page 34: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

EWD-based Web Applications

– High performance & massive scalability

• Its stateless architecture significantly reduces the resources needed to support large numbers of users

– Far fewer processes

– Less memory

– Less CPU

– Far better utiliisation of resources

Page 35: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

Gateway scaling

Browsers Apache/IIShttp overTCP/IP

GT.M/CachéServer

Telnet overTCP/IP

Multiple servers

Gateway

Components

Key: GT.M/CachéServer

GT.M/CachéServer

Page 36: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

Gateway scaling

Apache/IIS

Gateway

Components

Key:

Apache/IIS

GT.M/CachéServer

GT.M/CachéServer

GT.M/CachéServer

Page 37: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

Creating

Web Services with EWD

Page 38: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

EWD-based MDWS?

• EWD’s back-end can process HTTP requests or XML/SOAP request payloads

• EWD normally serves up pages or fragments:

– HTML

– Javascript

– JSON

• Can serve up XML instead

– EWD’s XML DOM APIs can be used to create the XML dynamically

Page 39: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

EWD-based openMDWS

• openMDWS Proof of Concept• 4 services

– connect– login– getClinics– getPatientsByClinic

• Back-end uses the same VistA Mumps code used by the RPC Brokers used by MDWS versions– Now completely stateless using EWD

• Running on a GT.M-based WorldVistA server

Page 40: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

openMDWS

VistALegacy Code

Core Re-usable Functions

Full variable scoping

XNo leakage out of

VistA variables

No reliance on leakingVistA variables

Page 41: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

openMDWS

VistALegacy Code

Core Re-usable Functions

Full variable scoping

set ok=$$login^myRou(.inputs,.results)

inputs("accessCode")inputs("verifyCode")

Page 42: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

openMDWS

VistALegacy Code

Core Re-usable Functions

Full variable scoping

set ok=$$login^myRou(.inputs,.results)

results("DUZ")results("DT")Results("greeting")

Page 43: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

openMDWS

openMDWSCore Function

HTTP/XML Web Service wrapper functions

Map HTTP request name/value pairs to input array

set ok=$$login^myService(sessid,localCall)

Map output array to XML-mapped local array

Page 44: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

openMDWS

openMDWSCore Function

HTTP/XML Web Service wrapper functions

Map HTTP request name/value pairs to input array

set ok=$$login^myService(sessid,localCall)

Map output array to XML-mapped local array

openMDWS generates XML from array and dispatchesAs HTTP response

Page 45: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

XML-Array Mapping

s outerTag="UserTO"d outerTag^%zewdMDWS(.array,outerTag,sessid)s array(outerTag,"name")=$g(results("username"))_$c(1)_"text"s array(outerTag,"SSN")=$g(results("SSN"))_$c(1)_"text"s array(outerTag,"DUZ")=$g(results("DUZ"))_$c(1)_"text"s array(outerTag,"siteId")=siteId_$c(1)_"text"s array(outerTag,"greeting")=$g(results("greeting"))_$c(1)_"text"d createOutput^%zewdMDWS(localCall,.array,sessid)

<UserTo><name>Rob Tweed</name><SSN>1234567</SSN><DUZ>23</DUZ><siteId>99</siteID><greeting>Welcome!</greeting>

</UserTo>

Page 46: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

EWD Consuming remote openMDWSService

MG

WS

I

EWDRuntime

VistA

EWDPage

routines

HTTP/HTTPSRequest

EWD HTTP Client

OnBeforeRenderMethod

openMDWS Interface

Caché / GT.M

XMLresponse

Page 47: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

EWD Consuming local openMDWSService

MG

WS

I

EWDRuntime

VistA

EWDPage

routines Direct function call

EWD HTTP Client

OnBeforeRenderMethod

MDWS Interface

Caché / GT.M

XML-mappedarray returned

No HTTP Processing overheadNo XML Parsing overhead

Page 48: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

openMDWS

• No additional technologies required– Uses native stateless architecture

– Coding is identical on Cache & GT.M

• Open Source

• openMDWS services can be written by anyone

• XML/HTTP, JSON, RDF, etc

• One-off exercise of wrapping legacy code– Future-proofed all-purpose re-use

Page 49: Consuming and Creating VistA Web Services using EWD and Creating VistA Web Services using EWD Rob Tweed M/Gateway Developments Ltd  Twitter: ... Statefull …

EWD and MDWS: Conclusions

• Fast and easy to create web/mobile applications that use MDWS web services

• Provides a significantly better technical architecture for implementing MDWS web services

– Very high performance

– Highly scalable

– Significantly reduced resource requirements


Recommended