Http Server for AS/400 Web Programming Guide
Page
Http Server for AS/400 Web Programming Guide
Fifth Edition May
Contents
Enabling your AS/400 to run
Conventions in this book
AS/400 Operations Navigator
How to send your comments
Installing Operations Navigator
Prerequisite and related information
About Http Server for AS/400 Web Programming Guide GC41-5435
Viii Web Programming Guide V4R5
Writing Common Gateway Interface Programs
Overview of the CGI
CGI and Dynamic Documents
CGI process
Uses for CGI
Overview
Following Html form illustrates the various types of fields
Sending Information to the Server
Data Conversions on CGI Input and Output
EBCDIC/EBCDIC%%
BINARY/EBCDIC%% BINARY/BINARY%%
EBCDICJCD/EBCDIC%%
Mixed
Binary
Ebcdicjcd
IBM PC
CGI Output Conversion Modes
EBCDIC%%
MIXED%%
BINARY%%
Returning Output from the Server
How CGI Programs Work
Parsing
Environment variables
Gatewayinterface
Httpaccept
Httpuseragent
Ibmccsidvalue
Requests from Standard Search Isindex Documents
Passing SSL Environment Variables to a CGI Program
Httpsclientcertissuercommonname
Httpsclientcertissuercountry
Httpsclientcertissuerlocality
Httpsclientcertissuerstateorprovince
CGI Programs and AS/400 Activation Groups
AS/400 Activation Groups
Httpsclientcertstateorprovince
Httpskeysize
Activation Group Problem Examples
CGI Considerations
Writing Common Gateway Interface Programs
Web Programming Guide V4R5
Writing Common Gateway Interface Programs
Web Programming Guide V4R5
Application Programming Interfaces
APIs for CGI applications
Get Environment Variable QtmhGetEnv API
Put Environment Variable QtmhPutEnv API
CPF24B4 E
CPF3C17 E
CPF3C19 E
Read from Stdin QtmhRdStin API
Length or response available
Data variable
Write to Stdout QtmhWrStout API
Length of data variable
Convert to DB QtmhCvtDB API
Dbcs
Qualified database file name
Input string
Length of input string
Response variable
CPF9812 E
CPF9810 E
CPF9822 E
Command string
Keywords
Form
Read
Post
Target Buffer
Length of Target Buffer
Produce Full Http Response QzhbCgiUtils API
Nodate
Noel
Status nnn
Length nnn
Configuration APIs
Convert URL to Path QzhbCvtURLtoPath API
Name of Configuration
URL
Length of the URL
Path to physical resource
Retrieve Directive QzhbRetrieveDirective API
HTPA104 E
Name of the directive
Length of the directive name
Number of values returned
Format name
Buf
Bufsize INPUTBINARY4
Bufactlen OUTPUTBINARY4
Errcode
Create a Configuration QzhbCreateConfig API
HTPA001 E
Delete a Configuration QzhbDeleteConfig API
Errcode I/OCHAR
CPFB602 E
HTPA105 E
Read a Configuration File into Memory QzhbOpenConfig API
Writelock INPUTBINARY4
Cfg
Free a Configuration File from Memory QzhbCloseConfig API
Write
HTPA106 E
Search for a Main Directive QzhbFindDirective API
Value
Valuelen INPUTBINARY4
Startdir INPUTBINARY4
Casesens INPUTBINARY4
Dir
HTPA107 E
HTPA108 E
HTPA110 E
Maindir INPUTBINARY4
HTPA109 E
Hassubdirs OUTPUTBINARY4
Issubdir OUTPUTBINARY4
Add a Main Directive or Subdirective QzhbAddDirective API
CPF3C1D E
Reldir INPUTBINARY4
Position INPUTBINARY4
Newdir OUTPUTBINARY4
HTPA111 E
Length of the value string must be greater than or equal to
Server instance APIs
Outputvoid
Format INPUTCHAR8
INSN0100 Format
Instance name
Running status
Look up Server Instance Data QzhbGetInstanceData API
Bufactlen
Configuration
Running OUTPUTBINARY4
Autostart
Min threads
Ccsid
Change Server Instance Data QzhbChangeInstanceData API
HTPA101 E
Idata
Idatasize INPUTBINARY4
HTPA102 E
Create a Server Instance QzhbCreateInstance API
HTPA103 E
Delete a Server Instance QzhbDeleteInstance API
Group file APIs
Create a new Group File QzhbCreateGroupList API
Read a Group File into Memory QzhbOpenGroupList API
Pathlen INPUTBINARY4
Grplist OUTPUTBINARY4
HTPA202 E
Writelock
HTPA201 E
Grplist INPUTBINARY4
Free Group File from Memory QzhbCloseGroupList API
HTPA203 E
Prevgrp INPUTBINARY4
Grp
HTPA204 E
HTPA206 E
Group Inputchar
Locate a named group in a Group List QzhbFindGroupInList
Grouplen INPUTBINARY4
Retrieve the Name of a Group QzhbGetGroupName API
Buflen OUTPUTBINARY4
Group name to add to the list
Remove a Group from a Group List QzhbRemoveGroupFromList API
Prevusr INPUTBINARY4
Retrieve the next User in the Group QzhbGetNextUser API
Usr
Locate a User in a Group QzhbFindUserInGroup API
HTPA205 E
HTPA207 E
Userlen INPUTBINARY4
Retrieve the Name of a User QzhbGetUserString API
Add a new user to the end of a Group QzhbAddUserToGroup
Buflen INPUTBINARY4
Required Parameter Group Grplist Input Binary4 Usr
Errcode Char Threadsafe Yes
Using Net.Data to Write CGI Programs for You
Overview of Net.Data
Web Programming Guide V4R5
Using Persistent CGI Programs
Overview of Persistent CGI
Named Activation Groups
Accept-HTSession CGI Header
HTTimeout CGI Header
Considerations for using Persistent CGI Programs
Persistent CGI Program Example
Web Programming Guide V4R5
How to enable the server to run CGI programs
Enabling your AS/400 to run CGI programs
Using directives for security and access control
Default fail rule
Explicit CGI enablement
Server runs only CGI programs
CGI program considerations
Protection Example1 AuthType Basic Userid
Sample programs in Java, C, and RPG
Example of Java language CGI program
Samplejava String userMethod String cl Cl = new String
Sample programs in Java, C, and RPG
Web Programming Guide V4R5
Sample programs in Java, C, and RPG
Example of C language CGI program
Sample programs in Java, C, and RPG
Web Programming Guide V4R5
Sample programs in Java, C, and RPG
Environment variable
Example of RPG language CGI program
Create the *PGM object called Samplecrtrpgmod and Crtpgm
INZ
CZ-ADD 16QUSBPRV
Subst
Cat Htmli0 BufOut
Example of a C language server configuration API program
Web Programming Guide V4R5
Sample programs in Java, C, and RPG
Web Programming Guide V4R5
General procedure for writing Server API programs
Writing Server API programs
Overview of the Server API
Guidelines
Basic server request process
Service
Application functions
Data Filter
PostExit
Name Translation
Http return codes and values
Error
Log
Predefined functions and macros
Value Return code
HTTPDattributes
HTTPDauthenticate
HTTPDextract
HTTPDtranslate
HTTPDreversetranslate
HTTPDset
HTTPDexec
HTTPDread
HTTPDlogerror
HTTPDwrite
HTTPDlogtrace
HTTPDrestart
Httpdparametererror
Return codes
Server API usage notes
Server API configuration directives
Server API directives and syntax
Specific URL
Server API directive variables
URL templete
Compatibility with other APIs
Authentication and Authorization
Porting CGI programs
Environment variables
Server API variables
Errorinfo
Password
Proxyaccess
Proxycontenttype
Proxycontentlength
Requestcontenttype
Responsecontentlength
Proxymethod
Ssiroot
Example
Userid
Username
Web Programming Guide V4R5
Writing Java Servlets
Overview of servlets
Web Programming Guide V4R5
Using Server-Side Includes
Considerations for using server-side includes
Preparing to use server-side includes
Examples
Result 1K Default ″abbrev″
Format for server-side includes
Directives for server-side includes
Result Example
Specifier Meaning
Specifier Meaning
Content-type
Content-encoding
Dategmt
Datelocal
Directive Formats
Last-modified
Result 1K
#flastmod virtual=&PARENTURI
Alert bell
Troubleshooting your CGI programs
Symptom
Web Programming Guide V4R5
Troubleshooting your CGI programs
Put the CGI programs in a separate library
Symptom
Web Programming Guide V4R5
145
Programming Interface Information
Trademarks
Page
Web Programming Guide V4R5
Readers’ Comments We’d Like to Hear from You
How satisfied are you that the information in this book is
Business Reply Mail
Page
GC41-5435-04
Web Programming Guide V4R5