Chapter 1 - The GETURI Command

Get URI Data (GETURI)

Type choices, press Enter.

URI . . . . . . . . . . . . . . ___________________________________

Output . . . . . . . . . . . . . * *, *FILE, *STMF, *NONE

To file name . . . . . . . . . . __________ Name

Library . . . . . . . . . . . *LIBL Name, *LIBL

Member . . . . . . . . . . . . . *FIRST Name, *FIRST

Stream file . . . . . . . . . . ___________________________________

User Agent . . . . . . . . . . . 'e-RPG'

URL String . . . . . . . . . . . ___________________________________

Data Stream File . . . . . . . . ___________________________________

Proxy Server . . . . . . . . . . ___________________________________

Server Port . . . . . . . . . . 80 Number

Request Method . . . . . . . . . *GET *GET, *POST, *HEAD

Accept . . . . . . . . . . . . . 'text/html'

Host . . . . . . . . . . . . . . *DFT

Cookie . . . . . . . . . . . . . *NONE

Referer . . . . . . . . . . . . *NONE

Connection . . . . . . . . . . . *NONE

Content Type . . . . . . . . . . *DFT

Protocol . . . . . . . . . . . . HTTP

Protocol version . . . . . . . . 1.0 Character value

User Defined Header:

Header ID . . . . . . . . . . _______________

Header Value . . . . . . . . . ____________________________________

Upload File . . . . . . . . . . *NO *YES, *NO

Upload stream file . . . . . . . ____________________________________

Upload file name . . . . . . . . ____________________________________

Upload file form field name . .

Upload file content type . . . . 'text/plain'

Basic Auth Userid . . . . . . . *NONE

Basic Auth Password . . . . . .

Proxy Userid . . . . . . . . . . *NONE

Proxy Password . . . . . . . . .

SSL Connection . . . . . . . . . *NO *YES, *NO

SSL Application ID . . . . . . . ____________________________________

SSL Certificate Store . . . . . *SYSTEM

SSL Certificate Password . . . . *NONE

SSL Timeout . . . . . . . . . . *NONE Number, *NONE

Timeout . . . . . . . . . . . . 30 Number

Codepage . . . . . . . . . . . . 1208 Number

Close connection . . . . . . . . *YES *YES, *NO

Debug . . . . . . . . . . . . . *NO *YES, *NO

CCSID . . . . . . . . . . . . . 1208 Number

EBCDIC to ASCII table . . . . . QTCPASC Character value

ASCII to EBCDIC table . . . . . QEBCDIC Character value

Local IP Address . . . . . . . . *NONE _____________________________

Local Port . . . . . . . . . . . *NONE Number, *NONE

Supress Headers . . . . . . . . *NO *YES, *NO

SSL Mode . . . . . . . . . . . . > *GSKIT *DFT, *GSKIT

Server Name Id . . . . . . . . . *DFT


F3=Exit F4=Prompt F5=Refresh F12=Cancel F13=How to use this display

F24=More keys

The Get URI (GETURI) command allows you to simulate a web browser request from your AS/400. This can be useful in sending and retrieving data, verifying credit cards over the internet, gathering shipping information, simulating a web page file upload, and many other applications.

  • URI - Enter the URI to be used. Do not include any data (GET or POST) parameters on this command. Example: www.myserver.com/apps/getcustomer.asp

  • Output - Enter the output type that you wish to use. * will output the data to the screen, *FILE will store the results in a physical file, *STMF will store the results in a stream file, *NONE will do nothing with the results. (Note: If you wish to return results to a calling program, you must use the GETURI API Interface)

  • To File Name - Enter the library and file name used to store results if *FILE was specified on the Output parameter.

  • Member - Enter the member name used to store results if *FILE was specified on the Output parameter.

  • Stream file - Enter the fully qualified stream file path and file name used to store the results if *STMF was specified on the Output parameter.

  • User-Agent - Enter the user agent that you wish to be used for the request. This parameter may or may not have an affect on the success of the request. If you are having problems you can try a common user agent value such as "Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)" (without the quotes).

  • URL String - Specify the data you wish to pass to the application for a GET or POST as name-value pairs. For example: name=Brad&age=45&eyecolor=blue. If you are including a large amount of data you can specify *STMF or *STMFRAW (for no data conversions) on this parameter so that the URL string will be read from a pre-created stream file.

  • Data Stream File - If *STMF or STMFRAW was specified on the URL String parameter, specify the fully qualified path of the stream file containing the URL String data.

  • Proxy Server - Specify the IP address or DNS-resolvable name of a proxy server if required.

  • Server Port - Enter the port number used to make the request. If you are using a proxy server, this should be the proxy server port that is used. In this case, if you are making a URI request from a server on a port other than 80, you will need to specify that port in the URI request. For example www.myserver.com:442.

  • Request Method - Specify the request method used for the URI request. The valid values are *HEAD, *GET, and *POST.

  • Accept - Specify the type of data that you will accept. This value should be in a valid content-type form (such as "text/html").

  • Host - Specify the host name that will be sent with the request. The value of *DFT will default the host to the domain in the request.

  • Cookie - Specify any cookie data to be sent with this request. If you are unfamiliar with how to format this data then you should read RFC2109 at http://www.w3.org/Protocols/rfc2109/rfc2109.

  • Referer - Specify the value to be used as the referer for this request.

  • Connection - Specify a value to sent with the Connection HTTP header. For example the value "keep-alive" may be used.

  • Content-Type - Specify the content type of the request. The value of *DFT will specify the content type of application/x-www-form-urlencoded. If you are uploading a file using GETURI this parmater will be ignored and the value of multipart/form-data; boundary=<boundaryid> will be used.

  • Protocol - Specify the protocol being used.

  • Protocol Version - Specify the protocol version being used.

  • User Defined Header - Specify up to 20 user defined header/data pairs. The special value of *STMF can be used for the Header ID, and a path to a stream file in the IFS will then be used in the Header Value to have GETURI insert headers from a stream file.

  • Upload File - Specify *YES on this parameter if you are simulating an HTML file upload web page.

  • Upload stream file - Specify the fully qualified location of the stream file that you will be uploaded if *YES was specified for the Upload File parameter.

  • Upload file name - Used to name the file that is being uploaded. The default paramater of *UPSTMF will use the name of the stream file used on the UPSTMF parameter.

  • Upload file form field name - When specifying *YES for the Upload File parameter, you will need to name the form field from the upload page that you are simulating.

  • Upload file content type - When specifying *YES for the Upload File parameter, specify the content-type of the file being uploaded.

  • Basic Auth User - If using Basic Authentication on this request, specify the user id on this parameter.

  • Basic Auth Password - If using Basic Authentication on this request, specify the password on this parameter.

  • Proxy User - If using a proxy that requires a userid, enter it here

  • Proxy Password - If using a proxy that requires a password, enter it here

  • SSL Connection - If making a Secure Sockets Layer (SSL) request, specify *YES on this parameter.

  • SSL Application ID - Used to assign GETURI an application ID that can be used to associate it with certain SSL certificates.

  • SSL Certificate Store - Specify the certificate store to use with the SSL request. This value defaults to *SYSTEM which will specify to use the system certificate store. If you wish to use another certificate store, specify the qualified location of the store.

  • SSL Certifiate Password - Enter the certificate password (if applicable).

  • SSL Timeout - Specify a value in seconds to cause a timeout during an SSL handshake. A value of *NONE will specify no timeout value.

  • Timeout - Specify a value in seconds for a time out on the request.

  • Codepage - Specify a code page to be used when creating stream files.

  • Close Connection - Specify whether to close the connection or not after the request has completed. Leaving the connection open may increase performance with multiple calls to the same server.

  • Debug - Specify *YES to debug the request that was made. A file will be created in the IFS name /tmp/geturidebug.txt that can be used to view the actual request that was made with the GETURI command. Specify *OFF to tell GETURI to not send any messages during the running of the command.

  • CCSID - (v3.36 and up) Used to specify a CCSID for EBCDIC to ASCII and ASCII to EBCDIC translations.

  • EBCDIC to ASCII Translation Table - The name of the table to perform EBCDIC to ASCII Translation

  • ASCII to EBCDIC Translation Table - The name of the table to perform ASCII to EBCDIC Translation

  • Local IP Address - Specify the IP address to bind the request to. If *NONE is specified, the system will determine the IP address to specify.

  • Local Port - Specify the local port to bind the request to. The parameter is only valid if a Local IP Address is specified.

  • Supress Headers - Use this parameter to supress HTTP headers when the output type is *STMF or *RETURN. When this value is *YES *STMF is used as the output type, the headers will be removed from the output file and placed in another output file named "xxxxx.hdr" where "xxxxx" is the file name specified to receive the output. When *ALL is used the .hdr file will not be created. When using this parameter in the API, the headers will be returned in the GetUri_Head parameter when using either *STMF or *RETURN as the output type.

  • SSL Mode - Use this parameter to tell GETURI to use the default SSL APIs (*DFT) or the GSKit SSL Functions (*GSKIT). The default is to use the system APIs but in the future this make change to GSKit as IBM seems to be dropping support for the "legacy" APIs.

  • Server Name ID - Use this parameter to set the Server Name ID (SNI) for the SSL communications. By default (*DFT) this will use the host name in the URI but it can be overridden if needed. This field is only valid when using *GSKIT for SSL communications.