WebCustomRequestFile Function

Action

Requests and reads a complete document specified by a URL using the specified HTTP method. The optional request body consists of binary data.

Include file

WebAPI.bdh

Syntax

WebCustomRequestFile( in sMethod  : string,
                      in sUrl     : string,
                      in sFile    : string,
                      in sContent : string optional,
                      in formUrl  : form optional,
                      in fWait    : float optional ): boolean;

Return value

  • true if successful

  • false otherwise

Parameter Description
sMethod HTTP method used for the request (like GET, POST, or M-GET).
sUrl Absolute URL to the file on the server. The entire character content of the query string will not be URL-encoded.
sFile File to post to the server.
sContent Content type string used in the request, for example, "image/gif" (optional). If this parameter is omitted, an "application/x-www-form-urlencoded" header is sent.
formUrl

Form identifier used in the dclform section (optional). The expanded form string is appended to the URL after the "?". All unsafe characters are URL-encoded.

Set this parameter to FORM_NULL if you do not want to specify a form. You would do this when you want to specify the following parameters but want to omit this parameter.

fWait Minimum time or minimum mean time that this function call has to last (optional). The default value is 0.0.

Example

dcltrans
  transaction TMain
  var
    sFile: string;
  begin
    sFile := "c:\\temp\\dummyfile.txt";
    WebCustomRequest("GET", "http://standardhost/product.asp?code=2");
    WebCustomRequestFile("M-POST", "http://standardhost/main.asp",
    sFile, "application/octet-stream", SHOPIT_PRODUCT_ASP002);
  end TMain;

dclform
  SHOPIT_PRODUCT_ASP002:
    "code" := "2";