Classes

Method HttpClient():send() Foundation

Sends a synchronous request to the server.

Syntax
 
METHOD :send( [<oHttpRequest>] ) --> cResponse | oHttpResponse 
Parameters
<oHttpRequest>
A HttpRequest object which specifies the server, the parameters and other properties of the request. The parameter is optional and can be used for sending requests prepared manually by the application. By default, :send() uses the request object in the :HttpRequestmember variable.
Return

By default, :send() returns a binary string with the content of the response returned by the server. This is the same string as returned by the :getContent() method of the response object assigned to the :HttpResponse member variable. However, if a HTTP request object is passed in the <oHttpRequest> parameter, :send() returns a discrete HTTP response object instead of the content string.

Description

The method :send() sends a HTTP request to the server and returns the server's response. The method executes synchronously. It does not return until the request is processed completely. However, callback methods such as :onBusy() are available for monitoring the various states of a send operation.

By default, :send() sends the request message defined via the HttpRequestMessage object in the :httpRequestmember variable. In this mode, the method returns the content of the server's response for immediate processing, and the full details are accessible via the HTTP response message object stored in the :HttpResponse member variable.

If an alternative request message is to be sent using the same HTTP client object, this request must be prepared manually and passed to :send() via the <oHttpRequest> parameter. The request will then be executed via this HTTP request object, and the server's response will be returned in a discrete HTTP reponse object which can be used for processing the response.

Once processing is complete, the status of the operation is reflected in the HTTP status code returned by :getStatusCode(). The HTTP status code should be checked prior to accessing the response data for ensuring the request was processed successfully.

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.