January 2

0 comments

How to Upload a SAVF with IBM I ACS a.k.a. Upgrade HTTPAPI (LIBHTTP) to V7.2

By NickLitten

January 2, 2020

#ibm i

What is IBM i HTTPAPI?

HTTPAPI is an IBM i library (LIBHTTP) containing a full set of API’s allowing any IBM i programmer to write webservices to read, write and tinker (those are technical terms) with cloud based applications.

YES – using the Opensource HTTPAPI application you can easily read and write to Cloud Webservices direct from your RPG CODE

Me.

For example, you could use the HTTPAPI library to easily add some code to an RPG program, letting you validate a USPS postal address in real time (by calling the GOOGLE address validation webservice).

HTTPAPI is written by Scott Klement and is Open Source.

HTTPAPI
Grab the current version from Scott’s website

I’m a huge fan of Scotts’s excellent API interface for talking to webservices. It makes the whole thing so simple, it feels transparent. It comes with a handful of sample RPGLE code snippets to let you easily grasp the concepts of making an existing RPG program easily talk to something out there on the internet, or out there on a server in your company network.

Just in case Scott’s website is every offline here is a mirror of the implementation of HTTPAPI – 2021 Version 1.45 at IBM i V6R1+

How to install HTTPAPI

Installation isn’t quite as easy as simply uploading the SAVF because this is opensource you upload the source files and then compile the code natively on your machine. Having said that, it’s not complicated and has the added security of you knowing exactly what code you are running on your machine:

  • Create the necessary objects on IBM i:
    • CRTLIB LIB(LIBHTTP)
    • CRTSRCPF FILE(LIBHTTP/QCLSRC) RCDLEN(92)
    • CRTSRCPF FILE(LIBHTTP/QDDSSRC) RCDLEN(92)
    • CRTSRCPF FILE(LIBHTTP/QCMDSRC) RCDLEN(92)
    • CRTSRCPF FILE(LIBHTTP/QRPGLESRC) RCDLEN(112)
    • CRTSRCPF FILE(LIBHTTP/QSH) RCDLEN(124)
    • CRTSRCPF FILE(LIBHTTP/QSRVSRC) RCDLEN(92)
    • CRTSRCPF FILE(LIBHTTP/QXMLGENS) RCDLEN(112)
    • CRTSRCPF FILE(LIBHTTP/EXPAT) RCDLEN(112)
  • Transfer all of the source code to IBM i
    • Open an MS-DOS Prompt.
    • Type: cd \directory\where\you\unzipped\httpapi
    • Type: ftp your-ibmi-name-here
    • Type: (enter your username & password when asked)
    • Type: quote site namefmt 1
    • Type: cd /qsys.lib/libhttp.lib
    • Type: prompt off
    • Type: ascii
    • Type: lcd QCLSRC.FILE
    • Type: cd QCLSRC.FILE
    • Type: mput *
    • Type: lcd ../QDDSSRC.FILE
    • Type: cd ..
    • Type: cd QDDSSRC.FILE
    • Type: mput *
    • Type: lcd ../QCMDSRC.FILE
    • Type: cd ..
    • Type: cd QCMDSRC.FILE
    • Type: mput *
    • Type: lcd ../QRPGLESRC.FILE
    • Type: cd ..
    • Type: cd QRPGLESRC.FILE
    • Type: mput *
    • Type: lcd ../QSH.FILE
    • Type: cd ..
    • Type: cd QSH.FILE
    • Type: mput *
    • Type: lcd ../QSRVSRC.FILE
    • Type: cd ..
    • Type: cd QSRVSRC.FILE
    • Type: mput *
    • Type: lcd ../QXMLGENS.FILE
    • Type: cd ..
    • Type: cd QXMLGENS.FILE
    • Type: mput *
    • Type: lcd ../EXPAT.FILE
    • Type: cd ..
    • Type: cd EXPAT.FILE
    • Type: mput *
    • Type: quit

Building the Source

  • Tip:If you want to use a different library name aside from LIBHTTP, open the INSTALL member of the QCLSRC file and change the &SRCLIB and &INSTLIB variables.
  • On IBM i, type:
    • CHGCURLIB CURLIB(LIBHTTP)
    • CRTCLPGM INSTALL SRCFILE(LIBHTTP/QCLSRC)
    • CALL INSTALL
    • The HTTPAPI installer will guide you through the rest of the process.
{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

Join the IBM i Community for FREE Presentations, Lessons, Hints and Tips

>