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 3: Send a RAW request and receive a RAW response

In this lesson, you call the wrapper procedure created in the previous lesson, which sends a request to the web server database you created in lesson one. For more information about setting up a web client database to send the requests described in this lesson, see Lesson 2: Set up a web client database to send RAW requests and receive RAW responses.


This lesson contains several references to localhost. Use the IP address of the server database from lesson 1 instead of localhost if you are not running the web client on the same computer as the server database.

 To send a request
  1. Connect to the client database in Interactive SQL if it is not already open from lesson two.

    dbisql -c "UID=DBA;PWD=sql;SERVER=echo_client"
  2. Call the wrapper procedure to send the request and obtain the response.

    Run the following SQL script in Interactive SQL:

    CALL setMIME('<hello>this is xml</hello>', 

    The http://localhost:8082/EchoService variable indicates that the database server runs on localhost and listens on port 8082. The desired SOAP web service is named EchoService.

The following result set is displayed in Interactive SQL:

Attribute Value
Status HTTP/1.1 200 OK
Body <hello>this is xml</hello>
Date Thu, 04 Feb 2010 13:37:23 GMT
Connection close
Expires Thu, 04 Feb 2010 13:37:23 GMT
Content-Type text/plain; charset=windows-1252
Server SQLAnywhere/

The following is representative of the HTTP packet that is sent to the web server:

POST /EchoService HTTP/1.0
Date: Thu, 04 Feb 2010 13:37:23 GMT
Host: localhost
Accept-Charset: windows-1252, UTF-8, *
User-Agent: SQLAnywhere/
Content-Type: text/xml; charset=windows-1252
Content-Length: 49
ASA-Id: 1055532613:echo_client:echo:968000
Connection: close

valueAsXML=<hello>this is xml</hello>

The following is the response from the web server:

HTTP/1.1 200 OK
Server: SQLAnywhere/
Date: Thu, 04 Feb 2010 13:37:23 GMT
Expires: Thu, 04 Feb 2010 13:37:23 GMT
Content-Type: text/plain; charset=windows-1252
Connection: close

<hello>this is xml</hello>