3 iSeries GUI Debugger Chris Adair Information Systems Director - National EnvelopeTreasurer – Metro Midrange Systems Association
4 DisclaimerNote: 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.
5 HTTP Server And CGIHow many of you have a HTTP Server running on a Systemi?How many of you have CGI running on that server?
6 What 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.).
7 Why 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.
8 What 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
9 The 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)
12 Accessing 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
15 Now that the Admin Server is started, we can use the wizard to create a new IBM HTTP Server Powered by Apache
16 Create 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”
21 Step 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”.
23 Step 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”.
25 Step 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”.
27 Step 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”.
29 Step 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”.
31 Step 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”.
33 Back 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.
41 Create 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
45 Add 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.
54 Create 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”.
57 Restart 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.
60 There’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
63 Summary 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
66 Step 1: CGI Create a new library to hold your new programs CGILIBCreate source fileCGILIB/QRPGLESRCCopy Service Program to your new libraryQHTTPSVR/QZHBCGI
68 Step 2: Binding Directory Create a binding directoryCGILIB/CGIBNDDIRPut your QZHBCGI service program in the binding directory.ADDBNDDIRE
69 Step 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
74 Step 4: Create a Sample Program Don’t let all the CGI routines scare youBasically, all it’s doing is formatting some HTML and giving it to the browser.Compile using CRTBNDRPG and place in the CGILIB
77 If It Doesn’t Work Check the error log in the IFS /www/apache01/logs/error_logCheck you server configurationIf you didn’t APPLY your changes, it may not have takenCheck security of the CGI directory
78 SummaryWe made a library and put a service program and binding directory in it.Changed a few things on our HTTP Server to allow for CGIWrote some sample code to test CGI
80 Interactive 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
90 Summary 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.
91 Hints 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
92 CGIDEV2 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
93 You may contact me via email at: CADAIR@NATENV.COM Questions?You may contact me via at: