Lesson 2: Setting up a web client 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 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: Setting up a web server to receive RAW requests and send RAW responses.

 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.

    Execute the following SQL statement in Interactive SQL:

    CREATE PROCEDURE setMIME( 
        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.

    Note

    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 service].