10-24-2019 03:50 AM
Hello,
I have a rule that needs to add data coming from an outside RDBMS (MySql) to a document custom model.
Is it possible to call an Http request from javascript within Alfresco?
My call is simply like this "http://<my db server>/Alfresco/XGetDO.php?DO=14569" and it return a json object.
Any help welcomed. Thank you!
Alfresco 5.2
10-25-2019 04:19 AM
JavaScript Rhino has no support out-of-the-box for httpClients.
There are some exotic alternatives (https://stackoverflow.com/questions/22157910/using-rhino-js-engine-to-make-http-requests) but in this case the recommended alternative is to use a Java Backend service or action.
11-05-2019 02:04 AM
Thanks Angel,
I'll give a try even if it is a bit exotic as you say!
Pablo
11-05-2019 03:23 AM
Our Master Data Alfresco addon for our commercial solution "smart business context services" has such an API but a product may be out of scope? This addon supports read/write access to other enterprise apps and ships with connectors for OpenSource products like MySQL, Postgres or REST-APIs like Redmine, EspoCRM. You could either use the integrated Alfresco Share controls to read/show external data like properties on the fly or you do what ever you whant by accessing the javascript api. In the upcoming version we also support amqp messaging as best practice to trigger modifications from one to many apps, to avoid expensive sync or availability issues.
Pimp Alfresco for Everyday Activities
Please be aware that the solution Angel describes does not cover any error handling. So if you want/need to rely on such a solution you need some java implementation taking care about the protocol stuff and how to handle exceptions.
Explore our Alfresco products with the links below. Use labels to filter content by product module.