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

SAP Sybase SQL Anywhere 16.0 » SQL Anywhere Server - Programming » HTTP web services » SQL Anywhere as an HTTP web server » What are web services


Web service types

When a web browser or client application makes a web service request to a SQL Anywhere web service, the request is processed and a result set is returned in the response. SQL Anywhere supports several web service types that provide control over the result set format and how result sets are returned. You specify the web server type with the TYPE clause of the CREATE SERVICE or ALTER SERVICE statement after choosing an appropriate web service type.

The following web service types are supported:

  • HTML   The result set of a statement, function, or procedure is formatted into an HTML document that contains a table. Web browsers display the body of the HTML document.

  • XML   The result set of a statement, function, or procedure is returned as an XML document. Non-XML formatted result sets are automatically formatted into XML. Web browsers display the raw XML code, including tags and attributes.

    The XML formatting is the equivalent of using the FOR XML RAW clause in a SELECT statement, such as in the following SQL statement example:

    SELECT * FROM table-name FOR XML RAW

  • RAW   The result set of a statement, function, or procedure is returned without automatic formatting.

    This service type provides the most control over the result set. However, you must generate the response by writing the necessary markup (HTML, XML) explicitly within your stored procedure. You can use the SA_SET_HTTP_HEADER system procedure to set the HTTP Content-Type header to specify the MIME type, allowing web browsers to correctly display the result set.

    For an example of a stored procedure that works with the RAW web service type, see How to customize web pages.

  • JSON   The result set of a statement, function, or procedure is returned in JSON (JavaScript Object Notation). JavaScript Object Notation (JSON) is a language-independent, text-based data interchange format developed for the serialization of JavaScript data. JSON represents four basic types: strings, numbers, booleans, and NULL. JSON also represents two structured types: objects and arrays. For more information about JSON, see [external link]

    This service is used by AJAX to make HTTP calls to web applications. For an example of the JSON type, see %SQLANYSAMP16%\SQLAnywhere\HTTP\json_sample.sql.

  • SOAP   The result set of a statement, function, or procedure is returned as a SOAP response. SOAP services provide a common data interchange standard to provide data access to disparate client applications that support SOAP. SOAP request and response envelopes are transported as an XML payload using HTTP (SOAP over HTTP). A request to a SOAP service must be a valid SOAP request, not a general HTTP request. The output of SOAP services can be adjusted using the FORMAT and DATATYPE attributes of the CREATE or ALTER SERVICE statement.

  • DISH   A DISH service (Determine SOAP Handler) is a SQL Anywhere SOAP endpoint. The DISH service exposes the WSDL (Web Services Description Language) document that describes all SOAP Operations (SQL Anywhere SOAP services) accessible through it. A SOAP client toolkit builds the client application with interfaces based on the WSDL. The SOAP client application directs all SOAP requests to the SOAP endpoint (the SQL Anywhere DISH service).

 See also