ReadData

Description

Reads the response body.

Applies to

HTTPClient object

Syntax

objectname.ReadData ( data, bufferSize )

Argument

Description

objectname

The name of the HTTPClient object for which you want to read the response body.

data

A blob value into which the function returns data.

bufferSize

A long value specifying the buffer size.


Return value

Integer.

Returns values as follows. If any argument's value is null, the method returns null.

1 -- Success

0 -- Reading data is finished

-1 -- General error

-2 -- Timed out

Examples

Integer li_rc
Blob lblb_photo, lblb_NextData
HttpClient lnv_HttpClient 

lnv_HttpClient = Create HttpClient

// Not to read data automatically after sending request (default is true)
lnv_HttpClient.AutoReadData = false

// Send request using GET method
li_rc = lnv_HttpClient.SendRequest("GET", "http://demo.appeon.com/PB/webapi_client/employee/102/photo")

// Receive large data
if li_rc = 1 and lnv_HttpClient.GetResponseStatusCode() = 200 then
 do while true
  li_rc = lnv_HttpClient.ReadData(lblb_NextData, 1024*16)
  if li_rc = 0 then exit // Finish receiving data
  if li_rc = -1 then exit // Error occurred
  lblb_photo += lblb_NextData
 loop
end if