​You are correct that XMLSERVICE can be used in two ways - database stored
procedure and REST HTTP calls.

When doing 1-tier scenarios (i.e. Node.js is on same IBM i as the DB2 you
are after) then the stored proc approach is best (a lot faster). If 2-tier
(Node.js is running on Linux or other) then the REST HTTP approach can be

The XMLSERVICE DB stored proc approach is using the Node.js DB2 adapter
which is written in C and calls the SQL CLI APIs directly. There is no
ODBC or JDBC or MySQL layer in-between.

Here's the scenarios I have for calling RPG and accessing DB2, respectively:

It's worth nothing that Apache isn't required in all circumstances, though
right now it is somewhat a necessity since the DB2foriAccess for Node.js is


What type of application code do you run under Node.JS?
What type of application code do you run under IBM i programs and

This is where opinions can greatly differ, and I will offer up mine...
- You get significantly faster development if your <open-source-language>
can go directly to the DB. Here's where some will say "I don't trust those
Node.js devs, so they have to obtain all of their data via calls to RPG".
Big productivity killer. Big slow-down in finding bugs. etc.

- It is wise to re-use existing RPG business logic because rewriting can
take long enough that the time savings of going with <open-source-language>
would be lost. The toolkitfori (aka the XMLSERVICE interface for Node.js)
is an excellent stop-gap. My customers have a mix of logic in
<open-source-language> and RPG.

- How much logic you put in <open-source-language> depends a lot on the
shop's future direction. For example, I have some customers that have
determined <open-source-language> is their new direction and will
eventually replace the majority of their existing code base. This leads
them to leverage existing RPG with XMLSERVICE *sometimes*, but a lot of
logic is being put into <open-source-language>.

- <open-source-languages> have excellent packaging capabilities (think
*SRVPGMs on steroids). For example, you could keep your Node.js Order
Processing business logic in a Node Package Module (npm) and store it in a
private repository. Then in your apps you could simply include that Order
Processing npm in the package.json file as an application dependency that
gets installed and updated in simple fashion (i.e. npm install
order_processing, npm update order_processing).

- It's very interesting to read about Walmart Labs and how they've approach
adoption of Node.js. They have the same legacy issues as the IBM i base
(their legacy is old-school Java Struts/Servlets from 10+ yrs ago).

Very good questions. These are the types of things every shop adopting
open source needs to ask and spend some time doing tests.

Aaron Bartell
litmis.com - Open Source and IBM i. No Limits.

On Thu, Aug 27, 2015 at 1:33 PM, Nathan Andelin <nandelin@xxxxxxxxx> wrote:

My understanding is that XMLSERVICE provides 2 interface options for
various language environments:

1. XMLSERVICE via. ODBC / JDBC stored procedure calls (DB2 Interface).

2. XMLSERVICE via IBM i Apache-CGI calls (REST Web Service Interface).

Since Node.js has an excellent reputation for supporting socket I/O, I'll
assume for the moment that the IBM i implementation makes calls to
XMLSERVICE via the REST Web Service Interface. But does anyone know for

The flow in my mind goes as follows:

Browser <==> Node.JS HTTP & Application Interfaces <==> IBM i Apache
Interface <==> XMLSERVICE CGI <==> IBM i SQL and PGM resources.

Does that sound about right?

If so, what would be good guidelines for structuring applications under
this flow?

What type of application code do you run under Node.JS?
What type of application code do you run under IBM i programs and
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2021 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.