Deploying embedded forms using REST

Hello,

I would like to deploy my BPMN process and some embedded forms using REST API and make them run.

For the moment, I succeeded deploying my BPMN file and my form (html file)
Running the process works fine until the task where my embedded form is called.

At that step, I got a message “Form failure: Origin is not allowed by Access-Control-Allow-Origin” in Chrome (and a never-ending loading screen in Firefox)
I suspect that my form is not referenced correctly in my bpmn file.
(Indeed, I got the same message when I try to reference a html file with a dummy name instead of my html name)

I tried referencing my form with

userTask id=“Test_6” name=“Test Embedded form” xmlns:camunda=“http://activiti.org/bpmn” camunda:candidateGroups=“Testers” camunda:formKey=“embedded:app:forms/start-form.html”

and

userTask id=“Test_6” name=“Test Embedded form” xmlns:camunda=“http://activiti.org/bpmn” camunda:candidateGroups=“Testers” camunda:formKey=“embedded:app:start-form.html”

I got the same message error in both occasions.

Here is how my deployment looks like:

Could you help me fgure out what I’m doing wrong ?

1 Like

@Francois_Barthelemy

I had similar problem before then I had to use the full path for the path to solve this.

My form is at
src/main/resources/app/forms/start-form.html

Now BPM refers it as
embedded:/app/forms/start-form.html

See if this helps.

Just so you know, I picked this up from http://stackoverflow.com/questions/35461715/error-using-embedded-forms-with-camunda-spring-boot

Problem is I don’t know the path to use as the form has been uploaded via REST.
I just see that the html form has been deployed next to the BPMN…

There’s maybe a link to the folowing issue:
https://app.camunda.com/jira/browse/CAM-5256

The “Origin is not allowed by Access-Control-Allow-Origin” part is a side effect of that bug.
The requests URL starts then with something like “app:” or “embedded:” which is understood as a protocol by the browser which will try a cross origin request aka CORS… for the record.

I do not think it is related to the issue @vale references.

The virtual path embedded:app:forms/start-form.html assumes that the file is located in a process application deployed as a WAR file. You say that you deploy the form using the rest api and we can see that in your cockpit screenshot).

In fact resolving a form from the deployment, this is currently a missing feature. I created a feature request for it: https://app.camunda.com/jira/browse/CAM-5632

It would be fairly simple to contribute that. Do you have a working knowledge of Javascript? I could guide you to the necessary changes in tasklist.

Unfortunately, I have no good knowledge of Javascript :pensive:

That’s too bad that we can’t automatically deploy embedded forms…

Related topic in Google Groups: https://groups.google.com/forum/#!topic/camunda-bpm-users/dMQ-5A1tDKI (But links posted there seem to have changed in the meanwhile).

Anybody by any chance started working on it? I stumbled across this today as well :slight_smile:

I created a pull request for this feature: https://github.com/camunda/camunda-bpm-webapp/pull/6

1 Like

That’s really great :slightly_smiling:

One last question: how to know in which version it will be available ?

Thanks again for your help…

Hi,

it was merged into master with commit eb0f1c06. This commit is already part of 7.5.0-alpha3 released last week. And will therefore be part of the 7.5.0 release end of may. You can also see the fix versions on the Jira Issue.

Cheers,
Sebastian

Hi,
I am very new to camunda bpmn, Just i am trying deploy new workflow using create api. But i am getting 405 status.
Below are details, could someone help me on this issue.

Hi,

check the URL you are using. Try http://localhost:8080/engine-rest/engine/default/

regards

Rob

Hi,

I have a problem that goes in a similar direction. What does work:

  • Using the REST API in Postman
  • Using camunda-bpm-sdk-js in node console

What does not work:

  • Using the camunda-bpm-sdk-js on a website

When doing this I receive the error message:

XMLHttpRequest cannot load localhost:8080/engine-rest/engine/default/process-definition. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.

This seems to be independent of the request’s type. I have included the CORS filter in engine-rest/WEB-INF/web.xml as first filter in the file.

Thanks in advance!

Felix

Seems like I included the wrong CORS filter. I now tried this one and it works fine.