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
Prerequisite and related information
Installing Operations Navigator
How to send your comments
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
Overview
Uses for CGI
CGI process
Following Html form illustrates the various types of fields
Sending Information to the Server
Data Conversions on CGI Input and Output
EBCDICJCD/EBCDIC%%
EBCDIC/EBCDIC%%
BINARY/EBCDIC%% BINARY/BINARY%%
Mixed
Binary
Ebcdicjcd
IBM PC
CGI Output Conversion Modes
BINARY%%
MIXED%%
EBCDIC%%
Returning Output from the Server
How CGI Programs Work
Parsing
Environment variables
Httpuseragent
Gatewayinterface
Httpaccept
Ibmccsidvalue
Requests from Standard Search Isindex Documents
Passing SSL Environment Variables to a CGI Program
Httpsclientcertissuerlocality
Httpsclientcertissuercommonname
Httpsclientcertissuercountry
Httpsclientcertissuerstateorprovince
Httpsclientcertstateorprovince
CGI Programs and AS/400 Activation Groups
AS/400 Activation Groups
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
CPF3C17 E
Put Environment Variable QtmhPutEnv API
CPF24B4 E
CPF3C19 E
Read from Stdin QtmhRdStin API
Length or response available
Length of data variable
Write to Stdout QtmhWrStout API
Data variable
Convert to DB QtmhCvtDB API
Dbcs
Length of input string
Qualified database file name
Input string
Response variable
CPF9822 E
CPF9810 E
CPF9812 E
Form
Command string
Keywords
Read
Post
Target Buffer
Length of Target Buffer
Produce Full Http Response QzhbCgiUtils API
Status nnn
Nodate
Noel
Length nnn
Configuration APIs
Convert URL to Path QzhbCvtURLtoPath API
Length of the URL
Name of Configuration
URL
Path to physical resource
Retrieve Directive QzhbRetrieveDirective API
HTPA104 E
Number of values returned
Name of the directive
Length of the directive name
Format name
Bufactlen OUTPUTBINARY4
Buf
Bufsize INPUTBINARY4
Errcode
Create a Configuration QzhbCreateConfig API
HTPA001 E
CPFB602 E
Delete a Configuration QzhbDeleteConfig API
Errcode I/OCHAR
HTPA105 E
Read a Configuration File into Memory QzhbOpenConfig API
Writelock INPUTBINARY4
Write
Free a Configuration File from Memory QzhbCloseConfig API
Cfg
Value
Search for a Main Directive QzhbFindDirective API
HTPA106 E
Casesens INPUTBINARY4
Valuelen INPUTBINARY4
Startdir INPUTBINARY4
Dir
HTPA110 E
HTPA107 E
HTPA108 E
Maindir INPUTBINARY4
HTPA109 E
Hassubdirs OUTPUTBINARY4
CPF3C1D E
Add a Main Directive or Subdirective QzhbAddDirective API
Issubdir OUTPUTBINARY4
Newdir OUTPUTBINARY4
Position INPUTBINARY4
Reldir INPUTBINARY4
HTPA111 E
Length of the value string must be greater than or equal to
Server instance APIs
Outputvoid
Instance name
Format INPUTCHAR8
INSN0100 Format
Running status
Look up Server Instance Data QzhbGetInstanceData API
Bufactlen
Autostart
Configuration
Running OUTPUTBINARY4
Min threads
HTPA101 E
Change Server Instance Data QzhbChangeInstanceData API
Ccsid
Idata
Idatasize INPUTBINARY4
HTPA103 E
Create a Server Instance QzhbCreateInstance API
HTPA102 E
Delete a Server Instance QzhbDeleteInstance API
Group file APIs
Create a new Group File QzhbCreateGroupList API
Grplist OUTPUTBINARY4
Read a Group File into Memory QzhbOpenGroupList API
Pathlen INPUTBINARY4
HTPA202 E
Writelock
HTPA201 E
HTPA203 E
Free Group File from Memory QzhbCloseGroupList API
Grplist INPUTBINARY4
HTPA204 E
Prevgrp INPUTBINARY4
Grp
HTPA206 E
Grouplen INPUTBINARY4
Locate a named group in a Group List QzhbFindGroupInList
Group Inputchar
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
Usr
Retrieve the next User in the Group QzhbGetNextUser API
Prevusr INPUTBINARY4
HTPA207 E
Locate a User in a Group QzhbFindUserInGroup API
HTPA205 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
Named Activation Groups
Using Persistent CGI Programs
Overview of Persistent CGI
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
Server runs only CGI programs
Default fail rule
Explicit CGI enablement
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
Overview of the Server API
General procedure for writing Server API programs
Writing Server API programs
Guidelines
Basic server request process
Data Filter
Service
Application functions
PostExit
Name Translation
Log
Error
Http return codes and values
Predefined functions and macros
Value Return code
HTTPDextract
HTTPDauthenticate
HTTPDattributes
HTTPDset
HTTPDreversetranslate
HTTPDtranslate
HTTPDexec
HTTPDread
HTTPDlogtrace
HTTPDlogerror
HTTPDwrite
HTTPDrestart
Httpdparametererror
Return codes
Server API directives and syntax
Server API configuration directives
Server API usage notes
URL templete
Server API directive variables
Specific URL
Porting CGI programs
Authentication and Authorization
Compatibility with other APIs
Environment variables
Server API variables
Proxyaccess
Errorinfo
Password
Proxycontenttype
Responsecontentlength
Proxycontentlength
Requestcontenttype
Proxymethod
Userid
Ssiroot
Example
Username
Web Programming Guide V4R5
Writing Java Servlets
Overview of servlets
Web Programming Guide V4R5
Preparing to use server-side includes
Using Server-Side Includes
Considerations for using server-side includes
Examples
Directives for server-side includes
Result 1K Default ″abbrev″
Format for server-side includes
Result Example
Specifier Meaning
Specifier Meaning
Dategmt
Content-type
Content-encoding
Datelocal
Result 1K
Last-modified
Directive Formats
#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