3iSeries GUI Debugger Chris Adair Information Systems Director - National EnvelopeTreasurer – Metro Midrange Systems Association
4DisclaimerNote: In this presentation, when we refer to the eServer i5 or iSeries primary operating system, we refer to OS/400, even though the operating system name has changed to i5/OS in V5R3. If it is not explicitly stated otherwise, the term OS/400 also refers to i5/OS.
5HTTP Server And CGIHow many of you have a HTTP Server running on a Systemi?How many of you have CGI running on that server?
6What is an HTTP Server?A computer that is responsible for accepting HTTP requests from clients, which are known as Web browsers, and serving them HTTP responses along with optional data contents, which usually are Web pages such as HTML documents and linked objects (images, etc.).
7Why the Apache HTTP Server? Most popular Web server in the industry70% of the web sites on the internet are using Apache ( 2005 Netcraft Web Server Survey)Easily maintainableMany Apache skills in the marketplaceScalableHandles the small usage sites to the well traveled sitesAffordabilityMost likely, you already have everything you need.
8What Do You Need? 5722–DG1 IBM HTTP Server for iSeries HTTP Server (original) - Only until OS/400 V5R2HTTP Server Powered by ApacheNet.DataWebserver Search Engine and CrawlerApache Software Foundation’s Jakarta TomcatHighly Available HTTP ServerTriggered Cache Manager5722-TC1 TCP/IP Utilities5722-JV1 Java Developer Kit 1.3
9The Admin Server A HTTP Server used to manage Web Servers To Start the Admin ServeriSeries NavigatorUnder Network > Servers > TCP/IP: Right Click HTTP AdministrationCommandSTRTCPSVR SERVER(*HTTP) HTTPSVR(*ADMIN)
12Accessing the Admin Server The Admin Server “listens” on port 2001 for normal HTTP trafficUsing a browser, enter this URLThe Admin Server is secured by i5/OS user profilesUser profiles must have *IOSYSCFG and *ALLOBJ special authority to perform configuration activitiesIBM does not recommend using QSECOFR
15Now that the Admin Server is started, we can use the wizard to create a new IBM HTTP Server Powered by Apache
16Create a New HTTP Server From the Admin Server, click IBM Web Administration for iSeriesWhen the HTTPAdmin page is displayed, be sure to select the “Manage” and“All Servers” tabsFrom the navigation pane on the left, click “Create HTTP Server”
21Step 2: Specify Root Directory The root directory is where the configuration files and log files are kept.This will be in the Integrated File System.Typically, this will just be defaulted, and there’s nothing to key.On the bottom of the page click “Next”.
23Step 3: Specify Document Root The document root directory is where all the servable files are kept.You will put all your HTML’s, images, etc...under this directory or subdirectoriesTypically, this will just be defaulted, and there’s nothing to key.On the bottom of the page click “Next”.
25Step 4: Specify IP Addresses / Port Typically, you will want all IP addressesKey the desired port numberThe HTTP default is 80Do not use a port number already in useOn the bottom of the page click “Next”.
27Step 5: Access LogYou can indicate whether or not you want an access log.An access log will keep track of who is making requests of your server.The error log will automatically be created, regardless of this selection.On the bottom of the page click “Next”.
29Step 6: Specify Time to Keep Logs New log files will be created on a daily basis to prevent any one file from becoming to large.Specify whether or not to keep log files, both error and access logs. And, how many days to wait before they’re purgedOn the bottom of the page click “Next”.
31Step 7: Summary ScreenThe wizard displays all the information from the prior steps for a final review.If any changes are needed, click the “Back” button.If no changes are needed, and your ready to create the server, click “Finish”.
33Back To The Admin Server Once completed, the Admin Server is displayed with the new server.We can continue to make configuration changes, or start the server and give it a test,We’ll start the server by clicking the green arrow.
41Create Your Own index.html Using your favorite HTML editor, make your own index.html.I used IBM Rational SoftwareGave my page a title and imageMoved it to the “HTDOCS” directory under APACHE01 in the IFS
45Add Some Directories I added some links for a few locations Those links need to direct us to a directory under the APACHE01, where I plan to put some month end reports, stored as PDF’sBut first, we’ll need to change the configuration of the server to allow directory listings.
54Create the IFS Directories Now that the server is set, we need to create the IFS directoriesUsing iSeries Navigator:Under File Systems > IFS > Root > WWW > Apache01, Right click on HTDOCS and select “New Folder”.
57Restart the Server All my directories have now been entered. I’ve secured the ones I need, based on a i5/OS profile.All the directories have been created on the IFS.Let’s restart the server and see what happens.
60There’s Not Any FilesUse your SPLF conversion utility to put some files in the directoriesIf you don’t have a SPLF conversion utilityTake a look at this site:Download 4 source members:CVT2CMD, CVT2CLP, CVT2HTML, and CVT2PDFCompile and Run
63Summary Started the Admin Server Created an IBM HTTP Server (Powered by Apache)Configured the serverAdded some IFS directoriesDownloaded some conversion softwareDisplaying static reports via the browser
66Step 1: CGI Create a new library to hold your new programs CGILIBCreate source fileCGILIB/QRPGLESRCCopy Service Program to your new libraryQHTTPSVR/QZHBCGI
68Step 2: Binding Directory Create a binding directoryCGILIB/CGIBNDDIRPut your QZHBCGI service program in the binding directory.ADDBNDDIRE
69Step 3: Change Your HTTP Server We’ll to change the configuration to allow for CGI programsAdd a directory under Global configurationAdd a “Script Alias Match” under URL Mapping in Global configurationCheck security of new directoryEnable CGI in new directoryStop the server and re-start
80Interactive CGIUsing you favorite HTML editor, create a page that asks for some input.I created an “Inventory Lookup” pageThe user keys a SKU number, presses “Submit”The “Submit” actually calls a CGI programI use the QtmhGetEnv API to retrieve the SKU number enteredProcess the request and display
90Summary We started the Admin Server Created and configured a HTTP serverAllowed for some static report servingCompiled and ran some CGICost = 0Most likely, you already have everything you need.
91Hints Learn some HTML Buy a good CGI book and read the online articles It doesn’t take much to get started. The basic syntax of creating some basic HTML Tables and Hyperlinks will go a long wayBuy a good CGI book and read the online articlesBrad StonePaul TuohyBob CozziJon ParisAll are using RPG CGI and have written publications on how to get started
92CGIDEV2 Thank You, Giovanni B. Perotti 39 years at IBMCreator of CGIDEV2If you’re at V5R1 download CGIDEV2Lot’s of code samples and pre-written procedures
93You may contact me via email at: CADAIR@NATENV.COM Questions?You may contact me via at: