HTTP request header management

HTTP request headers can be added, changed, or removed with the HEADER clause of the CREATE PROCEDURE and CREATE FUNCTION statements. You suppress an HTTP request header by referencing the name. You add or change an HTTP request header value by placing a colon after the header name following by the value. Header value specifications are optional. For more information, see Web client SQL statements.

For example, run the following statement in the web client database to create an procedure named MyOperation that sends requests to the specified URL that puts restrictions on HTTP request headers:

CREATE PROCEDURE MyOperation ()
    URL 'HTTP://localhost:8020/dbname/SampleWebService'
    TYPE 'HTTP:GET'
    HEADER 'SOAPAction\nDate\nFrom:\nCustomAlias:John Doe';

In this example, the Date header, which is automatically generated by SQL Anywhere, is suppressed. The From header is included but is not assigned a value. A new header named CustomAlias is included in the HTTP request and is assigned the value of John Doe.

Folding of long header values is supported, provided that one or more white spaces immediately follow the \n.

The following example illustrates long header value support:

CREATE PROCEDURE MyOperation ()
    URL 'HTTP://localhost:8020/dbname/SampleWebService'
    TYPE 'HTTP:POST'
    HEADER 'heading1: This long value\n is really long for a header.\n
    heading2:shortvalue'
Note

You must set the SOAPAction HTTP request header to the given SOAP service URI as specified in the WSDL when creating a SOAP function or procedure.

 Automatically generated HTTP request headers