cancel
Showing results for 
Search instead for 
Did you mean: 

branching in create service statement

Baron
Participant
0 Kudos
1,444

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.

Accepted Solutions (1)

Accepted Solutions (1)

VolkerBarth
Contributor

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.

Baron
Participant
0 Kudos

Thank your for help. I could solve it after separating the webservice, so that I have two different webservices instead of one.

Answers (0)