cancel
Showing results for 
Search instead for 
Did you mean: 

Calling Web Service via a rule that executes a JavaScript

mirtunis
Champ in-the-making
Champ in-the-making
Hi all,
I need to extract metadata file from an external database (Oracle) , so i create a java-backed web-script to make connection with the database and i need to call this webscript via a rule that executes a JavaScript.
That is why I am trying to use the [var conn = remote.connect("alfresco");] but i cannot able to call the webscript it throws the following error: "ReferenceError: "remote" is not defined." as exception.

Have you any idea ???????????
7 REPLIES 7

lutz_horn
Champ in-the-making
Champ in-the-making
Did you make the Java class available with the name
remote
for the JavaScript level?

mrogers
Star Contributor
Star Contributor
Your rule is executing on the alfresco repository.    There's no remote object.

mirtunis
Champ in-the-making
Champ in-the-making
the remote is the remote object to get a connector to a specific endpoint in alfresco ,by default it is only available in share but not repository .
I need enable remote endpoint in repository.

midoscofield
Champ in-the-making
Champ in-the-making
Hi,
I have the same problem ,do you find a solution please?
Thanks

mrogers
Star Contributor
Star Contributor
you don't need the remote object.  

If you have a java backed web script then use the java API directly.    If you have a rule then implement a java action.

If you are using java script then use the java script API directly.

satheeshkumar
Champ in-the-making
Champ in-the-making
Hi,
I too have a Java backed webscript, I want to execute this Java backed webscript from the rule using "Execute Script" selection which execute a JavaScript,  can you post some examnple code, how to use Java API directly to invoke the Java Backed Webscript.

drrez
Champ in-the-making
Champ in-the-making
Maybe I'm being REALLY obtuse…..but:

My use case is to make a remote call (in this case to a Confluence REST endpoint) when a folder is created in a particular site. I'm running into the same exact issue as OP, and reading this thread, it seems I'll need to develop a web script. I am able to locate the tutorials for developing a java-backed web script. However, it seems that once complete with my custom web script, I'll still run into the same problem : there's STILL no way to call a URL from the javascript called by the Rule on the folder, whether it's an Alfresco REST/Web Script URL or something else….since remote is still undefined.

As this will be a 'sometimes on' usage, my users need to be able to manage it from the Rules interface, rather than removing/re-adding a web script every time.

What am I missing?