Variables Supplied in the Body HTTP Requests

You can supply variables in the body of an HTTP request by specifying HTTP:POST in the TYPE clause in a web client function or procedure.

By default TYPE HTTP:POST uses application/x-www-form-urlencoded mime type. All parameters are urlencoded and passed within the body of the request. Optionally, if a media type is provided, the request Content-Type header is automatically adjusted to the provided media type and a single parameter value is uploaded within the body of the request.

Example

The following example assumes that a web service named XMLService exists on a localhost web server. Set up an SAP Sybase IQ client database, connect to it through Interactive SQL, and execute the following SQL statement:

CREATE PROCEDURE SendXMLContent(xmlcode LONG VARCHAR)
    URL 'http://localhost/XMLService'
    TYPE 'HTTP:POST:text/xml';

The statement creates a procedure that allows you to send a variable in the body of an HTTP request in text/xml format.

Execute the following SQL statement in Interactive SQL to send an HTTP request to the XMLService web service:

CALL SendXMLContent('<title>Hello World!</title>');

The procedure call assigns a value to the xmlcode parameter and sends it to web service.