on 2018 Dec 10 3:30 AM
I am trying to build a new webserive in Sybase 10, whose structure of output parameters depends on the value of input parameters:
CREATE SERVICE S1 TYPE 'XML' AUTHORIZATION OFF USER DBA AS begin if (parameter1='A') then call myprocedure1(:parameter1, :parameter2); else call myprocedure2(:parameter1, :parameter2); end if; end;
This syntax is not accepted in Sybase.
The question is how can I make this branching in the call of the service (the point is because myprocedure1 and myprocedure2 return different number and type of parameters, and I need to have one single service but the answer of the service should have different fields depending on parameter1)
Thanks in advance for any help.
Request clarification before answering.
OK, I just noticed the following quote from the v16 CREATE PROCEDURE doc topic that apparently fits to your test results:
Web services Web services rely on the RESULTS clause of the stored procedure to determine the number and types of the column in the result set. Web services do not support procedures that return multiple result sets, nor do they support variable result sets through the use of EXECUTE IMMEDIATE.
AFAIK, when a client expects a static result set from a procedure (like in this case) and there is no RESULT SET clause, SQL Anywhere describes that as a single value (IIRC, of type int). I guess that's the same when you use SELECT * from myprocedure()" without providing a WITH clause...
That being said, you might try to use a TYPE RAW web service as that may offer more flexibility (at the obvious cost of more coding effort) - but again, that's just a guess.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
9 | |
8 | |
6 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.