Upload
dinhduong
View
213
Download
0
Embed Size (px)
Citation preview
Mail: [email protected] : @JuergenSchusterWeb: juergen-schuster-it.de
APEX-Homepage: apex.worldAPEX Podcast: apex.press/talkshow
Dynamic Actions Examples: dynamic-actions.com
apex.world
•Oracle (13 Years)
Who am I
•Freelancer (6 Years)•APEX > 10 Years•Other: Java, Ext-JS, QlikView, HANA SAP UI 5
•The guy with the stickers
•apex.press/talkshow
apex.world
Founder of apex.world
Who am I
apex.world
•Why Webservices?
Agenda
•What are Webservices?
•ORDS (Oracle REST Data Services)
•Project Example
•REST in APEX
apex.world
•Why Webservices?
Agenda
•What are Webservices?
•ORDS (Oracle REST Data Services)
•Project Example
•REST in APEX
apex.world
APEX - REQUEST
Apache with mod_plsql
A P A C H E
https://apex.world/pls/f?p=…
Database Apex Engine
ORACLE
APEX
/pls/
/i/ = .jpg; .png; .css; .js
modplsql
f?p=…
(OCI)
HTML / JSON
HTMLJSON
HTML / JSON
SQLData
Browser
apex.world
Why Webservices?
•Access to Data NOT in the Oracle DB (Social Media)
•Leave the Data where they are
•Simple: Client, Server, Stateless, Readable, pure HTTP we already know
•Reliable: Roy Fielding “How the Web works and why it works well"
• Fast: Caching, Compressing, Scalable, Incremental Rendering, Pre-Fetching
•Leverage the amazing productivity of APEX
apex.world
APEX - REST - REQUEST
Apache with mod_plsql
A P A C H E
https://apex.world/pls/f?p=…
/i/ = .jpg; .png; .css; .js
modplsql
f?p=…
(OCI)
Dat
a / J
SON
https://…/em
p
HTML / JSON
HTML / JSON
/pls/HTMLJSON
Browser Database Apex Engine
ORACLE
APEX
SQLData
REST
apex.world
•Why Webservices?
Agenda
•What are Webservices?
•ORDS (Oracle REST Data Services)
•Project Example
•REST in APEX
apex.world
What are Webservices?
•SOAP (“Simple” Object Access Protocol)•Complex XML, Parser, WSDL, Envelopes, Verbose•XML only, Nested Object Structures? Extra Protocol•Legacy, not so simple, not relevant anymore
apex.world
What are Webservices?
•REST (Representational State Transfer)•Really Simple, uses the well known HTTP commands
http://apex.world/ords/orders
REST CRUID SQLGET Read SELECT
POST Create INSERT
PUT Update/Create UPDATE/CREATE
DELETE Delete DELETE
•No extra Protocol like SOAP, JSON inMemory 12.2
apex.world
•Why Webservices?
Agenda
•What are Webservices?
•ORDS (Oracle REST Data Services)
•Project Example
•REST in APEX
apex.world
APEX - SAP HANA
Apache with mod_plsql
A P A C H E
https://apex.world/pls/f?p=…
/i/ = .jpg; .png; .css; .js
modplsql
f?p=…
(OCI)
Dat
a / J
SON
https://…/em
pSAP-HANA
via REST
HTML / JSON
HTML / JSON
/pls/HTMLJSON
Browser Database Apex Engine
ORACLE
APEX
SQLData
apex.world
Native Webdevelopment with SAP UI5?
•Around 20 times longer
•Around 20 times more complicated
•Around 20 thousand times more Sourcecode
•Around 20 times higher maintenance costs
apex.world
APEX - SAP HANA - Thoughts
•Usual APEX development w/o restrictions
•Use PL/JSON - Today APEX_JSON 4 times faster
•Use Pipelined Table Functions
apex.world
APEX - SAP HANA - Thoughts
APEX: select * from table(my_package.my_func(p_param))
function my_func(p_param)
return my_rec_table
pipelined
is
begin
-- Do http call to REST Service
-- Parse the result
-- Pipe Row
end;
apex.world
APEX - SAP HANA - Reality
•8ms / record - PL/JSON
•5ms / record - Own specialized JSON Parser
•3ms / record - Own CSV parser
•1ms / record - CSV parsing Steven Feuerstein
=> 1 second 1000 records 10 seconds for 10 000!
Decision: Live with it, we have 1000 records max.
apex.world
APEX - SAP HANA - Room for Improvement
•Use APEX_JSON (4 times faster than PL/JSON)
•Use 12.1.0.2 SQL-JSON Egine (100-times faster)
•Pushes the Limit to 100 000 records, no final solution
apex.world
APEX - SAP HANA - Final Solution
•Only fetch the records shown on the screen
•Overwrite Pagination and Sorting in Standard-Report
•No Interactive Report anymore
•Wait for APEX 6.0? Working with REST-Sources natively?
•The next big Step (Mike Hichwa, APEX Podcast March 2015)
apex.world
APEX - SAP HANA - with Dynamic Actions
apex.world
•Why Webservices?
Agenda
•What are Webservices?
•ORDS (Oracle REST Data Services)
•Project Example
•REST in APEX
apex.world
ORDS
•Read REST only? You don’t need ORDS !
•But you should!
apex.world
ORDS advantages over mod_plsql
Connection Pooling
PDF-PrintingVirus-Scanner
Post > 32K
Excel-UploadOAuth2
Cashing
REST Hooks
Multiple DBs
SODA
apex.world
Tomcat
Glas
sfish
Weblogic
Jetty
APEX - ORDS - REST - Consume External
https://apex.world/ords/f?p=…
/i/ = .jpg; .png; .css; .js
f?p=…
(JDBC thin)
Dat
a / J
SON
https://…/em
p
REST
HTML / JSONHTML / JSON
apex.world
ORDS
ORDS
(Java)
Browser Database Apex Engine
ORACLE
APEX
SQLData
apex.world
Database Apex Engine
ORACLE
APEX
APEX - Apache - ORDS - REST - Consume External
https://apex.world/ords/f?p=…
/i/ = .jpg; .png; .css; .js
f?p=…
(JDBC thin)
Dat
a / J
SON
https://…/em
p
REST
HTML / JSON
HTML / JSON
apex.world
Tomcat
Glas
sfish
Weblogic
ORDS
ORDS
(Java)
Apache with mod_jk
A P A C H E
HTML / JSONmod
jk
/ords/HTMLJSON
Fire
Wall
f?p=…
(AJP)
Browser
SQLData
apex.world
APEX - ORDS - REST Publish
https://.../ords/orders(4711) SQL
(JDBC thin)
ORALCE CursorJSON
apex.world
Tomcat
Glas
sfish
Weblogic
ORDS
ORDS
Map & Bind
REST Call ORACLE Database
ORACLE
Transform to JSON
apex.world
•Why Webservices?
Agenda
•What are Webservices?
•ORDS (Oracle REST Data Services)
•Project Example
•REST in APEX
apex.world
APEX - REST - Consume Internal
Apache with mod_plsql
A P A C H E
https://apex.world/pls/f?p=…
/i/ = .jpg; .png; .css; .js
modplsql
f?p=…
(OCI)
Dat
a / J
SON
https://…/em
p
REST
HTML
HTML
/pls/HTMLJSON
Browser Database Apex Engine
ORACLE
APEX
Collection
apex.world
APEX - REST - Consume
apex.world
APEX - REST - Consume
apex.world
APEX - REST - Consume
apex.world
APEX - REST - Consume
apex.world
APEX - REST - Consume
apex.world
APEX - REST - Consume
apex.world
APEX - REST - Consume Internal - Whats Missing
•REST Result as JSON stored in Collection Blob as document only
•Need to apply APEX_JSON -> another Collection
apex.world
“APEX” - REST - Publish
•You need to have ORDS
•You can do the definitions in APEX or ORDS
•But it is always performed by ORDS
•Actually it has nothing to do with APEX
apex.world
REST - Publish - APEX Definition
apex.world
REST - Publish - ORDS Definition
apex.world
Conclusions
•Read REST? No ORDS needed but you should!
•Publish REST form Oracle DB -> Need ORDS
•Deal with a JSON Result in the DB -> SQL 12.1.0.2
•Deal with JSON Result in PL/SQL -> APEX_JSON
Mail: [email protected] : @JuergenSchusterWeb: juergen-schuster-it.de
APEX-Homepage: apex.worldAPEX Podcast: apex.press/talkshow
Dynamic Actions Examples: dynamic-actions.com