Header template
A header template only needs to be specified when special or custom headers are used or standard headers that are not (yet) supported. We advise however to be cautious in the use of a header template because:
- Headers in the template may become supported in future releases, leading to double definitions of the same HTTP header.
- Using the header template is error-prone and quickly leads to invalid HTTP messages. The header template must not contain empty lines for example.
The XML WebServices Connection will automatically generate a version 1.1 POST request message with the URI that has been specified in the connection configuration file. Furthermore, it automatically inserts the following lines in the header of the request message:
- Content-Type.
- Content-Length.
- UserAgent.
An identification of ITP and the XML WebServices Connection. - Host.
The hostname as specified in the corresponding DataManager setting, extended with the port number if this is different from the default port (80). - Authorization.
Other HTTP headers can be described in the header template. In the header template one can refer to keys in the DataManager ini file. These take the form @(DM:<name>), and are replaced by the value of the setting. The setting name should be specified with its name as it is known in the Connection Configuration window of the ITP Administration Program. These references are typically used in the header template. They are sometimes also used in the content template if it contains a section with connection information.
The creator of the header template is responsible for keeping the HTTP message in accordance with the HTTP 1.1 specification. In particular:
- Defining a header template should not lead to empty lines in the header, as these mark the end of the HTTP header section.
- Each line must end with a Carriage-Return (CR) and a LineFeed (LF) character. This is easily achieved on the Windows Platform, as this is the standard way of representing line-ends for text files on that platform. On other platforms however, this is less trivial, and something to be careful about.
- The last line must also end with a CR-LF combination. Otherwise the remaining headers will not start on a new line. However, pay attention that the header template does not end with an empty line.