-
1. Re: Calling a procedure(requiring multiple query parameters via OData/RestEasy) performing another REST call to a remote system
tejones Apr 1, 2015 3:09 PM (in response to fabiowebby)Hi Fabio,
For a DV REST service, define the REST:URI as myUri/{param1}/{param2}/{param3}/{param4} in the procedure REST properties with whatever import parameters you need. The REST procedure would just need the same input parameters defined.
Thanks,
Ted
-
2. Re: Calling a procedure(requiring multiple query parameters via OData/RestEasy) performing another REST call to a remote system
rareddy Apr 2, 2015 12:05 AM (in response to fabiowebby)Fabio,
The rest service over the Postgres, is that one you developed or somebody else wrote? You can simplify the architecture by using Teiid using the Postgres as source and sending JDBC calls for CRUD, then on top of Teiid you can use OData or REST to issue calls from your application. I would prefer OData as it gives you good way to do querying as well as CRUD operations.
If you can not change REST service, then follow what Ted says above.
Also, in the generated web service [1], you can submit them using form parameters not as path parameters. Note that you can create this VDB in Designer, when you deploy it to the server the web service is automatically created if the metadata on the procedure is correctly defined, along with with "auto-generate" property.
[1] REST Service Through VDB - Teiid 8.11 (draft) - Project Documentation Editor
Ramesh..
-
3. Re: Calling a procedure(requiring multiple query parameters via OData/RestEasy) performing another REST call to a remote system
rareddy Apr 2, 2015 12:07 AM (in response to rareddy)BTW if you go OData route, see this basic examples here Basic Tutorial | OData - The Protocol for REST APIs
-
4. Re: Calling a procedure(requiring multiple query parameters via OData/RestEasy) performing another REST call to a remote system
fabiowebby Apr 3, 2015 12:31 PM (in response to fabiowebby)First of all, thank you very much Ramesh and Ted for your prompt reply and help, appreciated. I managed to make it work with the method Ted suggested earlier. I added charset, method(GET) and Rest endpoint name in the form: <URI_Name>/{param1}/{param2} to the procedure rest options. Then I created Vdb and Generated REST war file so I can call the procedure by :
http:/<host>/<VDB_name>/<My_View_Model>/<procedure_name>/<params>, it works but it returns an XML parsing error and only the first string of the response is returned, the others are missing. Is it because I return strings as result of the procedure instead of XML? How do you query for the same procedure with params in OData style URL? I tried different options suggested in docs and forums but I seem to get a resteasy exceptions. Even though passing params like this works fine at the moment, it is not very scalable if parameters increase, how could I pass params in JSON via a POST call to the procedure? I think it is better if I manage to achieve this with POST and JSON because I have to pass more params to different Rest endpoints.
Thanks very much in advance for your help
Best Regards
Fabio
P.S
Ramesh to answer you question from earlier post. I have no control over REST application on the other side so I cannot connect to Postgresql via JDBC, I can only interact viat REST.
-
5. Re: Calling a procedure(requiring multiple query parameters via OData/RestEasy) performing another REST call to a remote system
rareddy Apr 3, 2015 8:08 PM (in response to fabiowebby)For odata based procedure call see "Functions & Actions" at http://www.odata.org/getting-started/basic-tutorial
Yes, the inbuilt procedures must return XML or JSON. The "REST:PRODUCES" defines it is XML or JSON. If you want to return a scalar value or resultset, then the only option to access it readily with REST style is OData. Otherwise, you need to wrap it with another procedure that returns XML or JSON.
In 8.10 there are many improvements for POST. As I said earlier, in the POST, one can use FORM parameters not just PATH parameters. That way you have you can send any number of parameters. If not send a SQLXML or CLOB as input parameter to procedure and send body payload. See link I provided above.
Ramesh..