Exchange rest-api the webapp is using

I have a business application with an embedded process engine, deployed as a war file on tomcat.
I embedded the camunda rest api into the war using jersey. This is running fine, I can see and execute tasks/instances/…

In addition, I use the standalone webapp (war) deployed on the same tomcat and connected to the same datasource to monitor the process-instances and so on. But: since I do not have a shared engine, when I for example complete a task with the standalone-tasklist, I get an error, because on the next task a create-listener is used and the standalone engine does not know that class.

What I want to do: Tell the standalone webapp to use the rest-api embedded in the business-application-war. It would just serve as a client of this rest-api. Since both are running on the same machine/port, cors wont be an issue.

Question: How can I configure the rest-endpoint used by the webapp (tasklist/admin/cockpit)?

1 Like

Hi Jan,

just to clarify usecase, you have 2 .war files deployed. One of them is exposing REST API which you want to utilize from the second .war. Did I get you right?

Question is: how to utilize exposed REST API?

Cheers,
Askar.

Exactly.

  • application.war configures the embedded engine and exposes /rest
  • camunda-webapp-standalone.war is deployed on the same machine and should not use the internal /api but /rest

You can change the location of the REST-Endpoint in the index.html files of the webapps. There you will find a section that looks like

<!-- settings the base path for relative links -->
<base href="$BASE"
      cockpit-api="$APP_ROOT/api/cockpit/"
      engine-api="$APP_ROOT/api/engine/"
      app-root="$APP_ROOT" />

If you replace engine-api with "$APP_ROOT/rest/", the webapp should use this endpoint for REST queries.

Note that for the Tasklist, this configuration is overridden by default with the lines

// override the following line to include configuration
var tasklistConf = {
  "apiUri": "$APP_ROOT/api/engine",
  "mock": false,
  "resources": {}
};

further down the index.html file. So you would have to change the REST path there as well.

1 Like

Nice, thanks.

But from what I see, I wont be able to run the cockpit against /rest because thats a different rest-api? Then I wont be able to interop with the process-instances running inside application.war, I would just have “read” access, like I do now.
What do I need to do to add the cockpit-rest-resources to the application.war (like I did with the embedded-spring-rest example)?
Or in other words: is it possible to use the full webapp-features UI running against a different rest-node?

If anyone is interested in Deploying Camunda REST service and Engine in external webapp here is my solution:

1 Like

@jangalinski - Did you find a solution to reconfigure the camunda app to use a embedded rest api from another WAR application

We hacked a solution where we basically replace the delivered html placeholders with a servlet filter … somehow works (but not all, some authorization stuff does not fit yet).
But I was not involved and cannot give you details … short answer: still not really possible to connect to a remote cockpit api.