How to access the API from a Tomcat application on the same tomcat as the Portal application ?

Hello,

I have a Tomcat application that needs to (sometimes) access a Bonita process through the API (start one instance or send a message).

I decided to use the HTTP API. It works well if I connect to the engine managed by the Studio for example.

But I want to deploy my application on the same server as Bonita portal.

Problem: both applications share the same system properties, including “bonita.home”. Thus I cannot have two different bonita homes in my Tomcat, one for the portal (using the LOCAL API) and one for my application(s) using the HTTP API.

What can I do ?

Thanks.

Hi,

In your application, as you use only the client side of Bonita Engine, you can define the API type programmatically without setting the bonita.home system property:

Map<String, String> apiTypeParams = new HashMap<>();
apiTypeParams.put(“server.url”, “http://localhost:8080”);
apiTypeParams.put(“application.name”, “bonita”);

    APITypeManager.setAPITypeAndParams(ApiAccessType.HTTP, apiTypeParams);

    LoginAPI loginAPI = TenantAPIAccessor.getLoginAPI();

Hello,

Great, thank you !!!

Michel