So, for a recent project I wanted to create a simple webservice, a “heartbeat” program that would be written in RPG and would reply to anbody calling it from anywhere on the network with a simple response that indicated that it worked.
A webservice is routine that can be called over a TCP/IP network.
• A callable routine. (Program? Subprocedure?)
• Callable over a TCP/IP Network. (LAN? Intranet? Internet?)
• Using the HTTP (or HTTPS) network protocol
Special Offer for all NICKLITTEN Punters
20% Off with Coupon: NICKLITTEN
In Partnership with SNUG CBD - American readers get 20% off
CBD helps with relaxation, focus and great for pain relief. I highly recommend the SNUG CBD Tincture to help keep you in the zone when programming!
….can also be called from the same computer.
The idea is that this webservice will allow other computers on the network to communicate with our IBM i system and get a reply back sayiing “Hello, everything is hunky dory”. Tihs is called providing the webservice.
The computer that runs this servcice and gets the reply – is consuming the webservice.
I could do this using an opensource plugin like HTTPAPI (aka LIBHTTP) but this time I’m going to create it as a webservice that is called directly from the IWS (Integrated WebServer – aka IBM Apache Server)
OK – onto the nitty gritty
Configure Apache Server to make sure its ready to provide a weservice to the outside world. From the IBM i command line:
STRTCPSVR SERVER(*HTTP) HTTPSVR(*ADMIN)
then point your browser at the this server to see if its running:
Create a web services Server:
• Click “Internet Configurations” (if IBM i 6.1 or higher)
• Click “IBM Web Administration for i”
# <NJL01> Modification Start
# WebServices added for ACSIS
ScriptAlias /info /qsys.lib/nlitten.lib/webinfo.pgm
ScriptAlias /valbin /qsys.lib/nlitten.lib/webvalbin.pgm
ScriptAlias /getbin /qsys.lib/nlitten.lib/webgetbin.pgm
Allow From All
# </NJL01> Modification End