Permits a web service to set an HTTP header in the result.
sa_set_http_header( fldname, val )
fldname Use this CHAR(128) parameter to specify a string containing the name of one of the HTTP header fields.
val Use this LONG VARCHAR parameter to specify the value to which the named parameter should be set.
Setting the special header field @HttpStatus sets the status code returned with the request. The status code is also known as the response code. For example, the following command sets the status code to 404 Not Found.
CALL dbo.sa_set_http_header( '@HttpStatus', '404' ); |
The body of the error message is inserted automatically. Only valid HTTP error codes can be used. Setting the status to an invalid code causes a SQL error.
With the exception of the Connection response header, response headers generated automatically by the database server can be removed. For example, the following command removes the Expires response header:
CALL dbo.sa_set_http_header( 'Expires', NULL ); |
None
None
The following example sets the Content-Type header field to text/html.
CALL dbo.sa_set_http_header( 'Content-Type', 'text/html' ); |
Discuss this page in DocCommentXchange. Send feedback about this page using email. |
Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1 |