In this lesson, you set up a SQL Anywhere web service server running a web service that tests the MIME-type setting of a web client.
Run the following command to create a SQL Anywhere database:
dbinit echo |
Start the network database server using the following command:
dbsrv12 -xs http(port=8082) -n echo echo.db |
This command indicates that the HTTP web server should listen on port 8082 for requests. Use a different port number if 8082 is disallowed on your network.
Connect to the database server in Interactive SQL using the following command:
dbisql -c "UID=DBA;PWD=sql;SERVER=echo" |
Create a new SOAP service to accept incoming requests.
Run the following SQL script in Interactive SQL:
CREATE SERVICE EchoService TYPE 'RAW' USER DBA AUTHORIZATION OFF SECURE OFF AS CALL Echo(:valueAsXML); |
This script creates a new SOAP service named EchoService that generates a RAW type as output. It calls a stored procedure named Echo when a web client sends a request to the service. You create the Echo procedure in the next step.
Create the Echo procedure to handle incoming requests. This procedure returns the body of the request.
Run the following SQL script in Interactive SQL:
CREATE PROCEDURE Echo( text LONG VARCHAR ) BEGIN DECLARE body LONG VARCHAR; SET body = isnull( http_variable('text'), http_variable('body') ); IF body IS NULL THEN SELECT 'failed'; ELSE SELECT body; END IF; END; |
Discuss this page in DocCommentXchange.
|
Copyright © 2010, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.0 |