Returns the value of an HTTP response header.
HTTP_RESPONSE_HEADER( header-field-name )
header-field-name The name of an HTTP response header field.
LONG VARCHAR
This function returns the value of the named HTTP response header field, or NULL if a header for the given header-field-name does not exist or if it is not called from an HTTP service.
Some headers that may be of interest when processing an HTTP web service response include the following:
Connection The Connection field allows the sender to specify options that are desired for that particular connection. In a SQL Anywhere HTTP server response, the option is always "close".
Content-Length The Content-Length field indicates the size of the response body, in decimal number of octets.
Content-Type The Content-Type field indicates the media type of the body sent to the recipient. Example: text/xml
Date The Date field represents the date and time at which the response was originated.
Expires The Expires field gives the date and time after which the response is considered stale.
Location The Location field is used to redirect the recipient to a location for completion of the request or identification of a new resource.
Server The Server field contains information about the software used by the origin server to handle the request. In a SQL Anywhere HTTP server response, the web server name together with the version number is returned.
Transfer-Encoding The Transfer-Encoding field indicates what (if any) type of transformation has been applied to the message body in order to safely transfer it between the sender and the recipient.
User-Agent The User-Agent field contains information about the user agent originating the request. In a SQL Anywhere HTTP server response, the web server name together with the version number is returned.
WWW-Authenticate The WWW-Authenticate field is included in 401 (Unauthorized) response messages.
More information about these headers is available at http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html.
The following special header allows access to the status within the response of a server response.
@HttpStatus Returns the status code of the processed request.
SQL/2008 Vendor extension.
When used within a stored procedure that is called by an HTTP web service, the following example displays the name and values of the HTTP response headers in the database server messages window.
BEGIN declare header_name long varchar; declare header_value long varchar; set header_name = NULL; header_loop: LOOP SET header_name = NEXT_HTTP_RESPONSE_HEADER( header_name ); IF header_name IS NULL THEN LEAVE header_loop END IF; SET header_value = HTTP_RESPONSE_HEADER( header_name ); MESSAGE 'RESPONSE HEADER: ', header_name, '=', header_value TO CONSOLE; END LOOP; |
Discuss this page in DocCommentXchange.
|
Copyright © 2012, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.1 |