Message (HttpResponse function)

From m204wiki
Jump to navigation Jump to search

Return code message of most recent request (HttpResponse class)

The Message non-settable method lets you examine the HTTP status line (return code and message) of the result of the most recent HTTP request. Message returns only the message portion of the status line (for example, Forbidden is returned from a 403 Forbidden status line).

Syntax

%string = httpResponse:Message

Syntax terms

%string A string or longstring variable for the assignment of the Message value of httpResponse.
httpResponse A reference to an HttpResponse object that was returned by a Get, Post, or Send method of an HttpRequest object.

Examples

In the following fragment, an XML document is being retrieved. In the event of an error, the text of the status message is printed:

. . . %httpresp = %httpreq:get('HHELPCLI', 0) if (%httpresp:success) then %rc = %httpresp:parseXML(%mydoc) %mydoc:print else print %httpresp:message end if . . .

See also