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

IBM i

Jan 02

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. 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.

How to Upload a SAVF with IBM I ACS a.k.a. Upgrade HTTPAPI (LIBHTTP) to V7.2 1
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.

LIBHTTP System requirements?

IBM i (OS/400) version 6.1 or later.
TCP/IP configured.
ILE RPG compiler.
To use SSL, you must install the Digital Certificate Manager, the HTTP server and one of the IBM Cryptographic Access provider licensed programs. Certain PTFs are also required. See the README file in the distribution for details

Download the IBM i version of HTTPAPI

Download HTTP API distribution and save it to your PC — or to IBM i (directly into the SAVF.)

Create a SAVE FILE in IBM i ready to upload into

Log onto IBM i, and create a save file to store the distribution in.

To do this, type:
CRTSAVF QGPL/HTTPAPI

UPLOAD #1 – Use FTP

If you sent it to your PC, FTP the distribution from your PC to IBM i.

To do this:

Open an MS-DOS Prompt.
Type: cd \directory\where\you\put\httpapi.savf
Type: ftp your-ibmi-name-here
Type: (enter your username & password when asked)
Type: binaryType: put httpapi.savf QGPL/HTTPAPI
Type: quit

UPLOAD #2 – Use IFS and IBM i Access Client Solutions

If you are unable to use FTP for any reason, you can try this IFS technique using IBM i ACS. Many companies block the FTP ports for uploading objects to your IBM i System and I’ve used this little work around many times:

IBM i ACS > ACTIONS > INTEGRATED FILE SYSTEM
Select SAVF from \download and upload to \home\username (where this folder is your folder of choice)
Once uploaded you can use the CPY command to copy this uploaded SAVF into the QGPl/SAVF you created earlier. This will convert it from PC format to to IBM i format:

CPY OBJ(‘/home/littenn/httpapi.savf’)
TOOBJ(‘/qsys.lib/littenn.lib/httpapi.file’)
FROMCCSID(PCASCII) TOCCSID(37) REPLACE(YES)

Create the HTTPAPI objects from the uploaded SAVf

Back on IBM i, type:

DLTLIB LIBHTTP (ignore errors if library doesnt exist)
RSTLIB SAVLIB(LIBHTTP) DEV(*SAVF) SAVF(QGPL/HTTPAPI)

Build & run the install program:

CHGCURLIB CURLIB(LIBHTTP)
CRTCLPGM INSTALL SRCFILE(LIBHTTP/QCLSRC)
CALL INSTALL

The install program will guide you through the rest of the process.

Just in case Scott’s website is every offline here is a mirror of the Jan 2020 IBMi7.2 implementation of HTTPAPI

Follow

About the Author

IBM i Software Developer, Digital Dad, AS400 Anarchist, RPG Modernizer, Alpha Nerd and Passionate Eater of Cheese and Biscuits. Nick Litten Dot Com is a mixture of blog posts that can be sometimes serious, frequently playful and probably down-right pointless all in the space of a day. Enjoy your stay, feel free to comment and in the words of the most interesting man in the world: Stay thirsty my friend.

%d bloggers like this: