Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 12.0.0 » SQL Anywhere Server - Programming » HTTP web services » HTTP web service examples » Tutorial: Working with MIME types in a RAW service


Lesson 2: Set up a web client database to send RAW requests and receive RAW responses

In this lesson, you set up a MIME-type on a new web client. This lesson assumes that you have set up a web server database as instructed in the previous lesson. For more information about setting up a database server to receive the requests from the web client described in this lesson, see Lesson 1: Set up a web server database to receive RAW requests and send RAW responses.

 To set up a database client for sending RAW requests and receiving RAW responses
  1. Run the following command to create a SQL Anywhere database:

    dbinit echo_client
  2. Start the personal database client using the following command:

    dbsrv12 echo_client.db
  3. Connect to the database in Interactive SQL using the following command:

    dbisql -c "UID=DBA;PWD=sql;SERVER=echo_client"
  4. Create a new stored procedure to send requests to a web service.

    Run the following SQL script in Interactive SQL:

        value LONG VARCHAR, 
        mimeType LONG VARCHAR, 
        urlSpec LONG VARCHAR
    URL '!urlSpec'
    TYPE 'HTTP:POST:!mimeType';

    In the next lesson, the web client passes the necessary variables to the setMIME procedure, which requires three parameters. The urlSpec parameter indicates which URL to use to connect to the web service, the mimeType indicates which MIME-type to use for the HTTP:POST type, and the value parameter represents the body of the request that should be returned by the web service.


    The server sets the default TYPE to SOAP:RPC when the clause is not specified, which does not support custom MIME-types. For more information about the TYPE clause, see CREATE PROCEDURE statement (web clients).