Integrate a Legacy System into a Mendix App

Last modified: August 19, 2024

Introduction

Mendix applications frequently need to communicate with existing systems. Whether replacing an older platform entirely or leveraging an existing database to enhance your app, the ability to integrate with legacy systems is key to your success. This how-to introduces a range of options that exist within the Mendix Platform to integrate with legacy systems.

This how-to teaches you how to do the following:

  • Assess potential options for integrating an existing system with a Mendix app
  • Integrate with a legacy system using REST

Prerequisites

Before starting this how-to, make sure you have completed the following prerequisites:

Interacting with a Legacy System Using REST

If the legacy system has the ability to expose its data to web services, integration can be accomplished using the Mendix REST module. This technique will allow your to preserve a system of record while accessing data only as you need it.

These are some situations in which to consider using this technique:

  • SAP architecture with RFC calls exposing JSON
  • CRM systems or databases with a web-service layer

In this section, you will learn how to retrieve data from a legacy system using REST and integrate the data into your application.

For this how-to, we will use the publicly available Google Books API (for details, see Google Books APIs Getting Started). We will construct our example around this data model. Each legacy system will have a different JSON structure based on internal data models. This example will return a collection of books using a given author search parameter. To use this API, users must collect an API key (as outlined in Google Books APIs Acquiring and Using an API Key). The response structure of this particular API is as follows:

  1. The API we will use has a JSON structure.

  2. Construct the appropriate data model for this JSON.

  3. Create a non-persistable search entity called BookSearch that allows the user to enter an author and title. This should be linked to a second object:

  4. Create a page that contains a data view that will allow users to enter search terms. The data source for this data view should be a new microflow that generates a new search object and returns it:

  5. Create a microflow button and a corresponding microflow that will perform your search. This microflow will use the REST GET Java Action included in the Marketplace REST module:

    The microflow activities for this flow are the following:

    1. Creates a new response object.

    2. Makes the REST call to the API using the following target:


    3. Calls a sub microflow that retrieves all the items associated with the response. Each item then has all the associated volumes retrieved:


    4. Iterates through the VolumeList and makes a new BookResult object to display the search results:


    5. Retrieves the author list Over Association for each volume.

    6. Iterates through the list of author names and uses a Change activity to add the author name. This is done to accommodate this situation:

  6. When a user signs into the application and enters a search term, the results are successfully populated via the REST calls.

The above example demonstrates how a Mendix application can quickly integrate data systems using REST. This basic framework can be built upon to incorporate a wide range of activities. Possible ways to extend this framework include the following:

  • Adding additional microflow processing logic to leverage data in Mendix
  • Using the REST POST actions to push values from Mendix
  • Updating Mendix app data from a different source

For further documentation and to see the GitHub project for REST services, see the Mendix RestServices GitHub page.

Read More