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
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.
Thanks Angel,
I'll give a try even if it is a bit exotic as you say!
Pablo
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.
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.