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

SQL Anywhere 12.0.0 (Français) » SQL Anywhere Server - Programming » HTTP web services » HTTP web service examples » Tutorial: Using SQL Anywhere to access a SOAP/DISH service


Lesson 3: Send a SOAP request and receive a SOAP response

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

 ♦  To send a SOAP 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=ftc_client"
  2. Call the wrapper procedure to send a SOAP request and receive a SOAP response.

    Run the following SQL script in Interactive SQL:

    CALL FahrenheitToCelsius(212);

    This call passes a Fahrenheit value of 212 to the FahrenheitToCelsius procedure, which passes the value along with two customized SOAP headers to the FToC procedure. Both client-side procedures are created in lesson two.

    The FToC sends the Fahrenheit value and the SOAP headers to the FToCService, which returns a result set based on the Fahrenheit value.

The following SOAP response is returned in XML format by the FToCService web service when a Fahrenheit value of 212 is passed to the web server:

<tns:rowset xmlns:tns="http://localhost/ftc/FtoCService">

The SELECT statement in the FahrenheitToCelsius procedure of the web client database uses the OPENXML function to parse the XML representation of the SOAP response, extracting the Celsius value defined by the tns:answer structure.

The following response is generated in Interactive SQL:

temperature Celsius
212.0 100.0