Message (HttpResponse function)

From m204wiki
Jump to navigation Jump to search

<section begin=dpl_desc/><section end=dpl_desc/>

Message is a member of the HttpResponse class.

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

Syntax

%message = %httresp:Message

Syntax terms

%message A string or longstring variable for the assignment of the Message value of %httpresp.
%httpresp 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 . . .