Hi, here is another problem with the OData service. I have a user-defined function like this:
I granted execution permission to the corresponding role. At the end of the osdl-file I have the serviceop Definition as:
Taking a look at the generated metadata I see a FunctionImport element in the EntityContainer-object like:
So at first glance everything seems to be fine ... but ;-) When generating the service reference in Visual Studio I don't have an ability to call this function. And navigating to the following URL http://localhost:8090/odata/GetCurrentTimestamp doesn't work either. What am I doing wrong or what is missing here? Any help are very much appreciated. TIA Armin |
There is an issue with invoking SQL functions through Service Operations. As a work around, try making the function a stored procedure instead. Hi Philippe, thanks, will give it a try and let you know if this works. Armin
(07 Oct '14, 11:25)
Armin Back
Just tried it with a stored procedure but that doesn't work either ;-(.
(07 Oct '14, 12:12)
Armin Back
Replies hidden
2
The following works fine for me : create procedure GetCurUTC() result (t1 timestamp) begin select CURRENT UTC TIMESTAMP; end; service { serviceop get "DBA"."GetCurUTC" returns multiplicity "1"; } I can then browse to http://machine:port/model/GetCurUTC Reg
(07 Oct '14, 12:21)
Reg Domaratzki
I just did a test again and you're absolute right that it works with a stored procedure ... don't know what I have done wrong yesterday ... maybe it was an URL typo as Philippe noted ... but I can't really believe it because I have checked everything twice before posting a question ... anyway, problem solved ;-)
(08 Oct '14, 03:48)
Armin Back
Replies hidden
Well, I have another question regarding the stored procedure: calling it via the browser works fine ... but how to call it from within Visual Studio? I had expected to find a static method at the generated service reference class, but there is no method or something called GetCurrentUtcTimestamp ... Am I doing something wrong or can't a stored procedure be called through the service reference class (or an instance of it)? Armin
(08 Oct '14, 08:30)
Armin Back
|
The use of functions as service operations has been fixed for build 16.0.0.2030. |
You are also using the wrong URL to access the service operation. The metadata states the name is GetCurrentUtcTimestamp not GetCurrentTimestamp.