I'm trying to learn how to create a web service in SQLA11, following the tutorial instructions at http://infocenter.sybase.com/help/topic/com.sybase.help.sqlanywhere.11.0.1/dbprogramming_en11/headers-soap.html (which /should/ be "SQL Anywhere 11.0.1 > SQL Anywhere Server - Programming > SQL Anywhere Data Access APIs > SQL Anywhere web services")
I can run all of the SQLA statements and DDL statements successfully, but when I try to run the last statement (CALL FahrenheitToCelsius(212);), it fails with an error code of -983:
Could not execute statement. HTTP request failed. Status code '400 Bad Request' SQLCODE=-983, ODBC 3 State="HY000" Line 1, column 1
I have already checked to make sure the firewall isn't blocking anything. Full db version info is: SQL Anywhere Network Server Version 22.214.171.1244.
My goal: PowerBuilder 11.5 application calls a web service, passing two parameters. Web service validates the parameters against a database, returning a generated data value.
Since SQLA has web services (and SOAP) built in, it seems like a no-brainer to use the feature. :)
asked 26 Apr '10, 16:06
Jason 'Bug' ...
The documentation has not been updated to reflect implementation updates. The correct way to define the client SOAP procedure is as follows:
CREATE PROCEDURE FtoC( temperature FLOAT ) URL 'http://localhost:8082/FtoCService' SET 'SOAP(OP=FtoCService)' TYPE 'SOAP:DOC';
The SET clause is required to explicitly specify the SOAP method. If it is not specified then the name of the client procedure is used as the SOAP method by default. The SOAP method corresponds to a SQL Anywhere SOAP service. Alternatively if convoluted naming is acceptable (I'm not suggesting that this is the case) you could simply rename the client procedure to FtoCService.
The documentation is in process of being updated. It will be ammended to demonstrate the use of a DISH service which serves as a SOAP endpoint. When a DISH service is accessed with an HTTP GET request, it will return the WSDL for all SOAP services within its context. When accessed by an HTTP POST request, it expects to process a SOAP request envelope. For example you may define a DISH service and ALTER the FtoC SOAP procedure as follows (I'm using the default port 80):
create service soap_endpoint type 'DISH' authorization off secure off user DBA;
ALTER PROCEDURE FtoC( temperature FLOAT ) URL 'http://localhost/soap_endpoint' SET 'SOAP(OP=FtoCService)' TYPE 'SOAP:DOC';
With the above modifications, calling FtoC will initiate an HTTP request to soap_endpoint (a DISH service) and automatically generate a SOAP request envelope (an XML document) that specifies its SOAP OPeration as FtoCService.
answered 26 Apr '10, 20:19