Message (HttpResponse function): Difference between revisions
Jump to navigation
Jump to search
m (1 revision) |
mNo edit summary |
||
Line 1: | Line 1: | ||
{{Template:HttpResponse:Message subtitle}} | {{Template:HttpResponse:Message subtitle}} | ||
The <var>Message</var> non-settable method lets you examine the HTTP status line (return code and message) of the result of the most recent HTTP request. <var>Message</var> returns only the message portion of the status line (for example, <code>Forbidden</code> is returned from a <code>403</code> <code>Forbidden</code> status line). | |||
==Syntax== | ==Syntax== | ||
{{Template:HttpResponse:Message syntax}} | {{Template:HttpResponse:Message syntax}} | ||
Line 14: | Line 9: | ||
<td>A string or longstring variable for the assignment of the Message value of ''%httpresp''. | <td>A string or longstring variable for the assignment of the Message value of ''%httpresp''. | ||
</td></tr> | </td></tr> | ||
<tr><th> | <tr><th>httpResponse</th> | ||
<td>A reference to an | <td>A reference to an <var>[[HttpResponse_class|HttpResponse]]</var> object that was returned by a <var>[[Get_(HttpRequest_function)|Get]]</var>, <var>[[Post_(HttpRequest_function)|post]]</var>, or <var>[[Send_(HttpRequest_function)|Send]]</var> method of an <var>[[HttpRequest_class|HttpRequest]]</var> object.</td></tr> | ||
</table> | |||
==Examples== | ==Examples== | ||
<ol><li>In the following fragment, an XML document is being retrieved. In the event of an error, the text of the status message is printed: | |||
In the following fragment, an XML document is being retrieved. | |||
In the event of an error, the text of the status message is printed: | |||
<p class="code"> . . . | <p class="code"> . . . | ||
%httpresp = %httpreq: | %httpresp = %httpreq:get('HHELPCLI', 0) | ||
if (%httpresp:[[Success_(HttpResponse_function)|success]]) then | |||
%rc = %httpresp: | %rc = %httpresp:[[ParseXml_(HttpResponse_function)|parseXML]](%mydoc) | ||
%mydoc: | %mydoc:[[Print_(XmlDoc/XmlNode_subroutine)|print]] | ||
else | |||
print %httpresp:message | |||
end if | |||
. . . | . . . | ||
</p> | </p></ol> | ||
==See also== | ==See also== | ||
{{Template:HttpResponse:Message footer}} | {{Template:HttpResponse:Message footer}} |
Revision as of 06:04, 19 June 2011
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
%message | A string or longstring variable for the assignment of the Message value of %httpresp. |
---|---|
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 . . .