Best way to expose an API from Mendix

2
Hi, I'm doing an impact analysis on migrating an existing application to Mendix. The application is written in Java and uses a native Java API to communicate to the other platform. To be specific we have written a graphical planboard/gantt-chart client that talks to our server that in turn talks to BMC ARS. If we would like the same for Mendix I see 2 options: 1) Use web services 2) Use Mendix Java API The latter seems a lot easier when you look at it search-replace BMC API calls by Mendix API calls (it is not that simple...). Since it is a server it needs to be listening all the time. I've read on the forum about a call: Future<R> executeAsync(IContext context, String actionName, Object ... params) Can I use that to start the server? Is what I want possible, or do I need to go for Web Services? Thanks in advance, Bart
asked
1 answers
2

Two things:

  1. the API call you mentioned (executeAsync) is an API call to execute a microflow or javaaction from within java code. It needs a context, which is normally provided when you execute a java action from a microflow or from a published webservice. If you want to expose an API from mendix, it's theoretically possible to start a separate thread from a java action which would expose some kind of RPC/RMI interface, but we strongly discourage users from doing so.
  2. Web services sounds like a much better fit. It's an open standard with a lot of good support (libraries, documentation etc), making it a much better solution for integrating services.

So, in conclusion: while it's certainly possible to open other types of API's from Mendix, you'll probably be much happier going with webservices :)

answered