ADELIA |
VADELIA |
SADELIA |
WADELIA |
|
(I/B) |
(I/B) (C/S) |
(B) (S) |
(I/B) (C/S) |
|
Section for use
All
Syntax
EXECUTE_HTTP *URL(Url) *OPTIONS(Options) *DATA(data) *HEADER(Header) Response *COOKIES(Cookies) *HTTP_CODE (httpCode)
Þ |
<alpha variable> | <alpha constant> | |
Þ |
<alpha variable> | <alpha constant> | |
Þ |
Type, Value | |
Type |
Þ |
<alpha variable> | <alpha constant> |
Value |
Þ |
<alpha variable> | <alpha constant> | <image variable> | <list> |
List |
Þ |
<Adelia list: alpha, alpha, alpha, image, alpha> |
Þ |
<Adelia list: alpha, alpha> | |
Þ |
*RESPONSE(response) | *FILE(fileName) | |
Response |
Þ |
<alphanumeric variable | <image variable> |
FileName |
Þ |
<alphanumeric variable> | <alphanumeric constant> |
Þ |
<Adelia list: alpha, alpha, alpha, alpha, alpha, bool, bool> | |
Þ |
<numeric variable> |
Description
Used to create an HTTP connection with the Web server and transfer data with the indicated URL.
HTTP GET, POST, PUT, HEAD, OPTIONS, DELETE, TRACE and PATCH options are allowed.
In particular, it is possible to:
-
- establish secure connections via SSL using certificates,
- define a BASIC or DIGEST authentication mode,
- delegate the request to a Proxy
- use cookies.
Click below to rapidly access the description of the different parameters:
- *URL parameter
- *OPTIONS parameter
- *DATA parameter
- *HEADER parameter
- Response parameter
- *COOKIES parameter
- *HTTP_CODE parameter
*URL
The *URL parameter is a variable or alphanumeric constant which defines, as an input, the resource's URL (Uniform Resource Locator) address.
If the port number is not specified in the URL, Adelia uses port 80.
The URL refers to either a resource available via the HTTP or HTTPS protocol or a local resource accessible via FILE://.
Mandatory parameter.
Example:
EXECUTE_HTTP *URL('http://localhost:8080/awstest/ws/personnes/1') *RESPONSE(RESP_VAR)
Back to the list of parameters
*OPTIONS
The *OPTIONS parameter is used to define, as an input, the options of the HTTP request to execute. This contains the option names followed by their value.
The option name and value are separated by a space.
The option names always start with 2 dashes (--).
Option/value pairs are also separated by a space.
Optional parameter.
Example:
--request GET --header Accept: application/json
NB: if the *OPTIONS parameter is not defined or the --request option is not specified, Adelia considers that the HTTP method to execute is GET.
Example:
The EXECUTE_HTTP *url('http://localhost:8080/awstest/ws/people/') *RESPONSE(RESP_VAR) instruction retrieves the list of people returned by the Web service.
The following options are possible:
-
- Options relating to server authentication during connection via SSL (https):
Option |
Value |
Description |
--cacert |
<Certificate File Name> |
Defines the name of the file containing the certificates.. Remember: the certificates are used to distribute the public key and check the identify of the server to which the user wishes to send private information. The certificates must be in PEM format. If the option is defined several times, only the last one is taken into account. |
-
- Options relating to client authentication during a connection via SSL (https):
Option |
Value |
Description |
--cert |
<Certificate File Name> |
Defines the file containing the client certificate to use. The file may contain the private key concatenated with the client certificate (certificatechain file). It may only contain the certificate. In this case, the --key option must be used to define the private key. Remember: the client certificate enables the server to check that the client is what it claims to be. If the option is defined several times, only the last one is taken into account. |
--cert-type |
PEM | DER |
Type of certificate provided. If no format is specified, PEM format is used. If the option is defined several times, only the last one is taken into account. |
--key |
<private key file name> |
Name of the file containing the private key. |
--key-type |
PEM | DER |
Private key format. If no format is specified, PEM format is used. |
--pass |
<passphrase> |
Secret phrase to protect the private key. Remember: the passphrase is equivalent to a highly secure password for encoding the private key. This is necessary for loading the private key when it is encoded. If the option is defined several times, only the last one is taken into account. |
-
- Options relating to a connection via SSL (https):
- Options relating to a connection via SSL (https):
Option |
Value |
Description |
--insecure |
No value to indicate |
The server identity and certificate are not checked. However, the transferred data is always encrypted. |
--tlsv1 |
No value to indicate |
Uses the TLSv1 version of SSL. |
--tlsv1.0 |
No value to indicate |
Uses the TLSv1.0 version of SSL. |
--tlsv1.1 |
No value to indicate |
Uses the TLSv1.1 version of SSL. |
--tlsv1.2 |
No value to indicate |
Uses the TLSv1.2 version of SSL. |
--sslv2 |
No value to indicate |
Uses the SSLV2 version of SSL. |
--sslv3 |
No value to indicate |
Uses the SSLV3 version of SSL. |
-
- Options relating to using a proxy:
- Options relating to using a proxy:
Option |
Parameters |
Description |
--proxy |
<http://[user:password@] ProxyHostName [:PortNumber> |
Defines the address of the proxy to use. This can be:
If the port number is not specified, Adelia uses port number 1080. The username and password can be defined via the --proxy-user option. NB: the proxy must be an HTTP proxy. If the option is defined several times, only the last one is taken into account. |
--proxy-digest |
No value to indicate |
Uses DIGEST authentication mode to connect to the proxy server. |
--proxy-basic |
No value to indicate |
Uses BASIC authentication mode to connect to the proxy server. |
--proxy-user |
<user:password> |
Username and password for authentication at the proxy server. If the option is defined several times, only the last one is taken into account. |
--proxy-header |
<proxyHeaderName: value> |
Headers to include in the HTTP request to the proxy server. The option must be repeated as many times as there are headers to include.
Example: EXECUTE_HTTP *URL('http://exemple.fr/aws_resource') *OPTIONS('--proxy-header Cache-Control: proxy-revalidate --proxy-header Transfer-Encoding: chunked') *RESPONSE(RESP_VAR) |
-
- Option relating to cookies:
- Option relating to cookies:
Option |
Parameters |
Description |
--cookie |
<name1=value1 ; name2=value2> |
List of cookies to send to the server, which must have been sent previously by the server. If the option is defined several times, only the last one is taken into account. |
-
- Options relating to authentication:
- Options relating to authentication:
Option |
Parameters |
Description |
--user |
<user : password> |
Username and password for authentication at the Web server. If the option is defined several times, only the last one is taken into account. |
--digest |
No value to indicate |
Uses DIGEST authentication mode to connect to the server. |
--basic |
No value to indicate |
Uses BASIC authentication mode to connect to the server. |
--anyauth |
No value to indicate |
Uses the most secure authentication mode of the methods called by the remote site. |
-
- Option relating to the request header:
- Option relating to the request header:
Option |
Parameters |
Description |
--header |
<headerName: value> |
Headers to include in the HTTP request to the server. The option must be repeated as many times as there are headers to include.
Example: EXECUTE_HTTP *URL('http://exemple.fr/aws_resource') *OPTIONS('--header Content-Type: application/json --header Transfer-Encoding: chunked') *RESPONSE(RESP_VAR)
NB: this option does not include the response Header. The latter are written in the *HEADER parameter.. |
-
- Specific options for managing conversions in AS/400 or in Unicode generation:
By default on AS/400 or in Unicode, all the "alpha" input values must be converted from the current EBCDIC or Unicode code page to the ISO 819 code page.
The conversion mode must be defined for each option on which the user does not wish to manage the conversion by default.
Option |
Parameters |
Description |
--conv-utf8 |
<option name> |
Converts the associated value of the option from the current EBCDIC code page into UTF8. |
--no-conv |
<option name> |
No conversion is carried out between the EBCDIC or Unicode and ISO 819 code pages. |
In Java and Windows, you can change the conversion mode for the sent and received data.
By default, in Java, the data to send are converted from UTF16 into the current code page (ANSI/ASCII), and the received data are converted from the current code page (ANSI/ASCII) into UTF16.
Option |
Paramètres |
Description |
--conv-utf8 |
*DATA |
Convert the data to send from UTF16 into UTF8. |
--conv-utf8 |
*RESPONSE |
Convert the received data from UTF8 into UTF16. |
--no-conv |
*DATA *RESPONSE |
No conversion is carried out between UTF16 and the current code page. |
By default, in Windows (Unicode), the data to send are converted from Unicode into the current code page (ANSI), and the received data are converted from the current code page into Unicode.
Option |
Paramètres |
Description |
--conv-utf8 |
*DATA |
Convert the data to send from Unicode into UTF8. |
--conv-utf8 |
*RESPONSE |
Convert the received data from UTF8 into Unicode. |
--no-conv |
*DATA *RESPONSE |
No conversion is carried out between Unicode and the current code page. |
By default, in Windows (not Unicode), no conversion is carried out on data to send / to receive.
Option |
Paramètres |
Description |
--conv-utf8 |
*DONNEES |
Convert the data to send from the current code page (ANSI) into UTF8. |
--conv-utf8 |
*REPONSE |
Convert the received data from UTF8 into the current code page (ANSI). |
The option names must be entered without the "--" characters.
The conversion mode also concerns *DATA and *RESPONSE parameters.
Example: --no-conv *RESPONSE –no-conv *DATA)
- Miscellaneous options:
Option |
Parameters |
Description |
--location |
No value to indicate |
Authorizes protocol redirection (e.g. http to https). If the server returns a 3xx HTTP code, Adelia automatically redirects the request to the new location. |
--request |
GET GET | PUT | POST | DELETE | HEAD | OPTIONS | TRACE | PATCH |
HTTP method to use. |
--http1.0 |
No value to indicate |
The HTTP protocol version to use is HTTP 1.0. |
--http1.1 |
No value to indicate |
The HTTP protocol version to use is HTTP 1.1. |
--connect-timeout |
<timeout> |
Defines a maximum time (in milliseconds) for the server connection step. If this time is exceeded, the *RETURN_CODE reserved word receives the error code 28. If the option is defined several times, only the last one is taken into account. |
--max-time |
<timeout> |
Defines a maximum time (in milliseconds) for the whole operation: connection + data transfer. If this time is exceeded, the *RETURN_CODE reserved word receives the error code 28. If the option is defined several times, only the last one is taken into account. |
--user-agent |
<agent utilisateur> |
Alpha string enabling the client application to identify itself with the server. If the option is defined several times, only the last one is taken into account.
Example: EXECUTE_HTTP *URL('http://exemple.fr/aws_ressource') *OPTIONS('--requestGET --user-agent Mozilla/4.0') *RESPONSE(RESP_VAR) |
Back to the list of parameters
*DATA
The *DATA parameter defines the input data to send to the servers.
It has two fields (type and value) which are used to define the type of delivery and the data to send.
The type field defines the delivery method to execute:
Delivery method |
Description |
DATA |
Sending alphanumeric data. In this case, the value field can be either an alpha variable, an alpha constant or an image variable containing the data, or a list. When the value field is a list, this must be organized as follows: Column 1 => Alphanumeric field containing the field name. Column 2 => Alphanumeric field containing the type of value: A | F A: the value to send is contained in the alpha-type column 3. F: the value to send is contained in the file whose name is contained in column 3. Column 3 => Alphanumeric field containing either the value or the name of a file. Column 4 => Image type field. Column 5 => Alphanumeric field. Value unknown. When several name/value pairs are defined using the list, the data to send is assembled and separated by the & character. Adelia sends data using the MIME type application/x-www-form-urlencoded. |
DATA-FILE |
Identical to the DATA type, with the slight difference of when the value field is an alpha variable or alpha constant, it contains the name of a file containing the data to send. |
DATA-URLENCODE |
Identical to the DATA type to which URL encoding is applied: URL ENCODING. All the characters are converted into '%NN' (where NN is the hexadecimal code of the character), except for the following characters: a-z, A-Z, 0-9, '-', '.', '_' and '~'. |
DATA-URLENCODE-FILE |
Identical to the DATA-URLENCODE type, with the slight difference of when the value field is an alpha variable or alpha constant, this contains the name of a file containing the data to send. |
FORM |
Similar to an HTML form, the data is sent using the MIME type multipart/form-data. A list of name/value pairs to send to the server can be defined. In an HTML form, name represents the name of a form field and value represents its value. The value field must be a list organized as follows: Column 1 => Alphanumeric field containing the field name. Column 2 => Alphanumeric field containing the type of value: A | F | I A: the value to send is contained in the alpha-type column 3. F: the value to send is contained in the file whose name is contained in column 3. I: the value to send is contained in the image-type column 4. Column 3 => Alphanumeric field containing either the value or the name of a file. Column 4 => Image type field. Column 5 => Alphanumeric field indicating the content type of the value (e.g. 'image.png'). Optional input. The value field may also be an alpha variable, alpha constant or an image containing the data to send. When this delivery type is used, the HTTP method must be the POST method. It is not necessary to define it in the *OPTIONS parameter. |
FORM-FILE |
Identical to the FORM type, with the slight difference of when the value field is an alpha variable or alpha constant, this contains the name of a file containing the data to send. |
Back to the list of parameters
*HEADER
The *HEADER parameter is an Adelia list containing the headers associated with the response made by the server to the client.
Each element of the list is made up of the header name and value.
Column 1 |
Þ |
Alphanumeric field containing the header name. |
Column 2 |
Þ |
Alphanumeric field containing the header value. |
Optional parameter.
Back to the list of parameters
Response
The Response parameter contains the response made by the server to the client.
-
- If the parameter is encapsulated by *RESPONSE, it represents either an alphanumeric variable or an image-type variable.
The variable receives the content of the response. - If the parameter is encapsulated by *FILE, it represents an alphanumeric variable or an alphanumeric constant which defines the name of the file in which the response is written.
- If the parameter is encapsulated by *RESPONSE, it represents either an alphanumeric variable or an image-type variable.
Optional parameter.
Back to the list of parameters
*COOKIES
The *COOKIES parameter is an input/output list.
As an input, the list may contain cookies to send to the server, retrieved for example in response to a previous request. Added to this are cookies returned by the server as an output.
Optional parameter.
The list must contain seven columns and have the following structure:
Column 1 |
Þ |
Alphanumeric field containing the cookie name. |
Column 2 |
Þ |
Alphanumeric field containing the cookie value. |
Column 3 |
Þ |
Alphanumeric field containing the expiration date beyond which the cookie must no longer be sent.Corresponds to the expires option of the Set-Cookie header.The Date field must have the following format: |
Date |
Þ |
EEE, dd MMM yyyy HH:mm:ss |
EEE |
Þ |
Day of the week (in 3 characters): Mon | Tue | Wed | Thu | Fri | Sat | Sun |
dd |
Þ |
Day of the month: from 01 to 31 |
MMM |
Þ |
Month (in 3 characters): Jan | Feb | Mar | Apr | May | Jun | Jul | Aug | Sep | Oct | Nov | Dec |
yyyy |
Þ |
Year (in 4 figures) |
HH |
Þ |
Hour: from 0 to 23 |
mm |
Þ |
Minutes |
ss |
Þ |
Seconds |
Column 4 |
Þ |
Alphanumeric field containing the path, which must exist in the requested resource in order for the cookie to be sent.Corresponds to the path option of the Set-Cookie header. |
Column 5 |
Þ |
Alphanumeric field containing the domain for which the cookie must be sent.Corresponds to the domain option of the Set-Cookie header. |
Column 6 |
Þ |
Booleen field used to block (or not) the sending of a cookie over an insecure connection.Corresponds to the secure option of the Set-Cookie header. |
Column 7 |
Þ |
Booleen field used to block (or not) the reading of a cookie by a JavaScript script, browser side.Corresponds to the httpOnly option of the Set-Cookie header. |
Back to the list of parameters
*HTTP_CODE
The *HTTP_CODE parameter receives the HTTP code of the request result in return.
Optional parameter.
In the event of an internal error or due to incorrect parameter passing, this parameter may not be updated.
If this happens, reserved word *RETURN_CODE can be tested after executing the instruction. If the operation has been carried out successfully, *RETURN_CODE returns *NORMAL.
Back to the list of parameters
Example
* Consumption of a Web service: retrieval of a person's details (GET-type operation)
EXECUTE_HTTP *URL('http://localhost :8080/demo/rest/people/1') *OPTIONS('--header Accept: application/json') *RESPONSE(RESP_VAR) *HTTP_CODE(HTTP_WCODE)
* Consumption of a Web service: updating of a person's details (PUT-type operation)
EXECUTE_HTTP *URL('http://localhost :8080/demo/rest/people/1') *OPTIONS('--request PUT --header Content-Type: application/json --header Accept: application/json') *DATA('DATA' , '{"PERSON": {"NumIdentif":1, "Name":"SMITH", "First name":"JOHN"}}') *RESPONSE(RESP_VAR) *HTTP_CODE(HTTP_WCODE)
* Sending of an image as an attachment (POST-type operation with parameter in multipart/form-data)
EXECUTE_HTTP *URL('http://localhost :8080/demo/rest/uploadimage') *DATA('FORM-FILE' , 'C:\images\voiture.png') *HTTP_CODE(HTTP_WCODE)