WebParseResponseStatus Function

Action

Parses the response header status line if a variable is specified as an out parameter. The subsequent low-level web function will NOT return until the request has finished. Other requests started before may run in parallel. This function might be used, for example, to avoid errors during an authentication handshake.

It is important to know that all parsing and verification functions must be specified before the Web API call for which the response data should be parsed/verified. You can specify multiple parse/verification functions before a Web API call. The order of the parse/verification functions is not relevant (Exception: WebParseDataBound and WebVerifyDataBound using the flag WEB_FLAG_SYNCHRON).

Note: This function avoids an error only once. After the specified error occurred, another WebParseResponseStatus function call is necessary.
Note: If you want to parse a Web document, you must first call the WebParseResponseStatus function. Then you call the function which retrieves the document.
Note: This function is obsolete. It can still be used, although it's recommended to use the WebIgnoreServerError function instead.

Include file

WebAPI.bdh

Syntax

WebParseResponseStatus(
in nIgnoreStatus : number,
out nStatusCode : number optional,
out sStatusMsg : string optional,
in nMaxStatusMsg : number optional): boolean;

Return value

  • true if the parsing modifier could be created successfully

  • false otherwise

Parameter Description
nIgnoreStatus Forces the subsequent request not to report an error for HTTP status code = nIgnoreStatus. Set this value to 0 to disable HTTP status code error reporting for all error codes.
nStatusCode Parameter that receives the value of the HTTP header status code (optional). Omit this parameter if the status code is not needed for further processing.
sStatusMsg String variable that receives the status message of the HTTP response header (optional).
nMaxStatusMsg Maximum length of the string to write into sStatusMsg (optional). This value must be less than or equal to the size of the string variable sStatusMsg.

Example

dcltrans
  transaction TMyTransaction
  begin
    // ignore HTTP error code: 401 Authorization Required
    WebParseResponseStatus(401);
    WebUrl("http://www.mydomain.com/", 0.0);
    // now send the request, including user name and password
    WebUrl("http://username:userpass@www.mydomain.com/", 0.0);
  end TMyTransaction;

Sample scripts

WebAuth01.bdf, WebStatusCodes01.bdf