Hi All,
Following a recent discussion on RPG OA I'd like to open a discussion about what is currently available to help RPG developers access their business applications from a web client (page requests, webservices, etc).
I would particularly like to concentrate on what open source code we are developing. I have two reasons for this:
1) We should have a difinitive list of what is available or in development
2) There are opportunities for collaboration (other open source offerings we can build on or work with)
It was something Henrik mentioned about using ExtJS, and I'd like to see what he is working on and what else is out there. I'd also like to see what can be linked together to provide a "complete package" to the community.
I am currently putting together a CGI package that will allow my XMLi templates to be served as server pages. I am very interested to see what Henrik has done with ExtJS to see if I can leverage any of that. I also know Aaron has been working in this area, and Mikael has also been working with JSON encoding/decoding so it would be good to see what really is out there. I have been building pages using JQuery Mobile (see SQL example below) and I can pretty-much integrate any other software into XMLi as an extension - for example I can send emails using MMAIL using tags within a template. It would also be possible to put an extension around HTTPAPI for example and emulate curl functionality in languages such as PHP.
So I would like to see what we can put together, and maybe encourage each other to move into areas we had not thought about - as there is already a lot of work being done there. I don't want to re-invent another wheel.
(any chance of an OPENSOURCE-L list David?)
--- Bit of blurb about my current XMLi work for those interested to see what it may offer them (or you can zone out at this point) ---
The templates can currently be called directly from a RPG program via xmli_runTemplate() or can be run on an ad-hoc basis by running the RUNXMLI command. It was designed primarily for XML generating output but I've been having great success serving XHTML from the integrated web server, using my new CGI enablement program. (Just requires a ScriptAlias added in the HTTP server config and all is done!!!)
Here are some example templates and results:
Working with dates and Times:
Template:
http://code.midrange.com/e19d0d7c59.html
HTML:
http://code.midrange.com/5a4b76bb25.html
Running SQL within a template (uses JQuery Mobile so the page can be displayed on a smart phone with a browser):
Template:
http://code.midrange.com/e8ea72a540.html
HTML:
http://code.midrange.com/b6ca2b81a7.html
Using MMAIL (building HTML and adding it as the body, then sending to recipients retrieved using SQL):
Template:
http://code.midrange.com/9024d02c9e.html
All of these pages run RPG under the covers - but you need to write any of it. XMLi interprets the template and runs the RPG through its engine. To modify, just change the template and a save it. It can now be re-run. You extend the capabilities by writing extensions (RPG Service Programs) that you plug into XMLi by defining them in a config file.
I have written the following extension plug-ins, with the following tags available (each has its own namespace):
Job: name, number, user, current-user, status, date, udate
Date: now, job, add (days, months, years), sub (days, months, years), diff (days, months, years), format (all character and numeric date formats, date patterns)
Time: now, add (hours, minutes, seconds), sub (hours, minutes, seconds), diff (hours, minutes, seconds), format (all character and numeric time formats)
String: upper, lower, trim, concat, substring (from left or right), xlate, triml, trimr, editc
Xml: into (allows you to pull the value of an xml element out of a template variable or a file named in a template variable - all options are supported)
Math: add, sub, mult, div, exp, floor, ceil, abs, sqrt, square, cube,
I have completed but not yet made available the following extension plug-ins:
MMAIL: send (has inner XML elements to define all parameters - can pull data from the running template to build the data.) The example below builds some HTML, uses SQL to build a recipient list, then sends the mail to the recipients.
CGI: get (retrieves named parm from query string), post (retrieves named parm form stdin), getenv (gets environment variable), setenv (sets environment variable), header (sets HTTP header)
It is possible to call your business programs / service programs by wrapping them in an extension and providing tags.
The beauty of the extension architecture is - if you write a better extension then change your config to point to it and use it!
--- End of blurb about my current XMLi work ---
Cheers
Larry Ducie
As an Amazon Associate we earn from qualifying purchases.