Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events
SOLVED

Questions on Invoking a Process from a web site

Avatar

Level 1

Question in regards to invoking processes.  I am new to this portion of technology and I am sure many would know how this works.  We have a process in Workbench that needs to be invoked from a remote web site.  The process would take one parameter.. ie an ID.  The process will then query the database and send a boolean value back to the site and then this site would perform a specific operation.   My question is, is there any examples out there that someone could provide that can show how this can be done?  What do i need in my website (I know how to set up buttons and  create OnSubmit processes and very familiar with javascript,html)?  I believe somehow it can be done with SOAP or REST?  Thanks very much in advance for any help.

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

You just need a form in HTML with elements(e.g. textbox - string, file - document etc.) having same name as the process input parameter name and the the form action attribute should be pointing to REST URL of the process.

For example : for a process(short-lived) having REST URL : http://localhost:8080/rest/services/WatchedFolder...  with one input parameter as XML and document as output variable, we'll use below HTML code :

<HTML>

<HEAD>

<TITLE> Sample Invoke REST endpoint </TITLE>

</HEAD> 

<BODY>

  <form action="http://localhost:8080/rest/services/WatchedFolder... method="post" enctype="multipart/form-data">

<p>Chose a file to send to the process.</p> <p>file: <input type="file" name="inputXML" /> </p> <p> <input type="submit"/> </p>

</form>

  </BODY>

</HTML>

When you click on submit, the output document would be opened in the browser automatically after submission of the form.

-Wasil

View solution in original post

3 Replies

Avatar

Level 10

Feel free to ring me on my mobile. I will explain you step-by-step how to invoke a process from a HTML page.

Avatar

Level 10

+ NINE-ONE          SEVEN-SEVEN-SIX-ZERO-SIX-NINE-FOUR-FIVE-FIVE-FIVE

Avatar

Correct answer by
Employee Advisor

You just need a form in HTML with elements(e.g. textbox - string, file - document etc.) having same name as the process input parameter name and the the form action attribute should be pointing to REST URL of the process.

For example : for a process(short-lived) having REST URL : http://localhost:8080/rest/services/WatchedFolder...  with one input parameter as XML and document as output variable, we'll use below HTML code :

<HTML>

<HEAD>

<TITLE> Sample Invoke REST endpoint </TITLE>

</HEAD> 

<BODY>

  <form action="http://localhost:8080/rest/services/WatchedFolder... method="post" enctype="multipart/form-data">

<p>Chose a file to send to the process.</p> <p>file: <input type="file" name="inputXML" /> </p> <p> <input type="submit"/> </p>

</form>

  </BODY>

</HTML>

When you click on submit, the output document would be opened in the browser automatically after submission of the form.

-Wasil