Web Client URL Clause

You must specify the location of the web service endpoint to make it accessible to your web client function or procedure. The URL clause of the CREATE PROCEDURE and CREATE FUNCTION statements provides the web service URL that you want to access.

Specifying an HTTP service URL

Specifying an HTTP scheme within the URL clause configures the procedure or function for non-secure communication using an HTTP protocol.

The following statement illustrates how to create a procedure that sends requests to a web service named SampleHTMLService that resides in a database named dbname hosted by an HTTP web server located at localhost on port 8082:

CREATE PROCEDURE client_sender(f REAL, i INTEGER, s VARCHAR(16))
    URL 'http://localhost:8082/dbname/SampleHTMLService'
    TYPE 'HTTP:POST'
    HEADER 'User-Agent:SATest';

The database name is only required if the HTTP server hosts more than one database. You can substitute localhost with the host name or the IP address of the HTTP server.

Specifying an HTTPS service URL

Specifying an HTTPS scheme within the URL clause configures the procedure or function for secure communication over Secure Socket Layer (SSL).

Your web client application must have access to an RSA server certificate or the certificate that signed the server certificate to issue a secure HTTPS request. The certificate is required for the client procedure to authenticate the server to prevent man-in-the-middle exploits.

Use the CERTIFICATE clause of the CREATE PROCEDURE and CREATE FUNCTION statements to authenticate the server and establish a secure data channel. You can either place the certificate in a file and provide the file name, or provide the entire certificate as a string value; you cannot do both.

The following statement demonstrates how to create a procedure that sends requests to a web service named SecureHTMLService that resides in a database named dbname in an HTTPS server located at localhost on the port 8082:

CREATE PROCEDURE client_sender(f REAL, i INTEGER, s VARCHAR(16))
    URL 'HTTPS://localhost:8082/dbname/SecureHTMLService'
    CERTIFICATE 'file=%ALLUSERSPROFILE%/SybaseIQ/demo\\Certificates\\rsaroot.crt'
    TYPE 'HTTP:POST'
    HEADER 'User-Agent:SATest';

The CERTIFICATE clause in this example indicates that the RSA server certificate is located in the %ALLUSERSPROFILE%\SybaseIQ\samples\Certificates\rsaroot.crt file.

Note: Specifying HTTPS_FIPS forces the system to use the FIPS libraries. If HTTPS_FIPS is specified, but no FIPS libraries are present, non-FIPS libraries are used instead.

Specifying a proxy server URL

Some requests need to be sent through a proxy server. Use the PROXY clause of the CREATE PROCEDURE and CREATE FUNCTION statements to specify the proxy server URL and redirect requests to that URL. The proxy server forwards the request to the final destination, obtains the response, and forwards the response back to SAP Sybase IQ.