HttpClient performs the request using its Execute() method, which takes an IHttpRequest and returns an IHttpResponse. The response's StatusCode property is evaluated and the request may be modified and resubmitted.

Note: The HttpClient has an Options property (of OpenEdge.Net.HTTP.ClientOptions type), which allows the setting of options for the HTTP client, such as timeouts and retry counts.

Example

It is recommended that the HTTP client be constructed using the OpenEdge.Net.HTTP.ClientBuilder class, as shown in the following example. Doing so allows the possibility of customising the HTTP client. (This advice is generally true for other components of this library.)

Executing a request

USING OpenEdge.Net.HTTP.IHttpRequest.
USING OpenEdge.Net.HTTP.IHttpResponse.
USING OpenEdge.Net.HTTP.ClientBuilder.

DEFINE VARIABLE oRequest AS IHttpRequest NO-UNDO.
DEFINE VARIABLE oResponse AS IHttpResponse NO-UNDO.
 
oResponse = ClientBuilder:Build():Client:Execute(oRequest).
MESSAGE
    oResponse:StatusCode SKIP   
    oResponse:StatusReason SKIP
VIEW-AS ALERT-BOX.