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 example, execute the following SQL statement in the web client database to create a procedure named SomeOperation2 that sends requests to the specified URL that puts restrictions on HTTP request headers:

CREATE PROCEDURE SomeOperation2()
    URL 'HTTP://localhost:8082/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. The GET request looks similar to the following:

GET /dbname/SampleWebService HTTP/1.0
ASA-Id: e88a416e24154682bf81694feaf03052
User-Agent: SQLAnywhere/12.0.1.3600
Accept-Charset: windows-1252, UTF-8, *
From: 
Host: localhost:8082
Connection: close
CustomAlias: 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 SomeOperation3()
    URL 'HTTP://localhost:8082/dbname/SampleWebService'
    TYPE 'HTTP:POST'
    HEADER 'heading1: This long value\n is really long for a header.\n 
    heading2:shortvalue';

The POST request looks similar to the following:



POST /dbname/SampleWebService HTTP/1.0
ASA-Id: e88a416e24154682bf81694feaf03052
User-Agent: SQLAnywhere/12.0.1.3600
Accept-Charset: windows-1252, UTF-8, *
Date: Fri, 03 Feb 2012 15:26:04 GMT
heading1: This long value is really long for a header.     heading2:shortvalue
Host: localhost:8082
Connection: close
Content-Type: application/x-www-form-urlencoded; charset=windows-1252
Content-Length: 0
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
 See also