Consumed OData Services

Last update: Edit

1 Introduction

Data can be published from an app for use by other apps through published OData services. Consumed OData services can be used to integrate external data sources in apps through Mendix Data Hub.

Mendix Data Hub enables integration of available data sources from different sources in an organization into your Mendix apps. OData services that are registered in the Data Hub Catalog expose entities that can be dragged and dropped into your domain model through the Data Hub pane as external entities. The OData service document that is added to your project provides the information for retrieving the metadata for the service and exposed entities.

For further details on the consumed OData service document and updating consumed OData services in your project, see Consumed OData Service.

For details on the features that a published OData service must support and how the conversion from and to the Mendix data model works, see Consumed OData Service Requirements.

2 OData Services and External Entities

When an external entity is used in an app project, the associated dataset for the entity is retrieved through the information in the consumed OData service contract and returned.

2.1 External Entities

When an external entity is used in an app project, the associated dataset for the entity is retrieved through the OData service and returned. These entities have some limitations compared to persistable entities:

  • External entities are read-only
  • The aggregate functions (average, sum, maximum, minimum) cannot be used on external entities
  • There are certain limitations on XPath constraints for external entities (for instance, you cannot filter on an association between a persistable entity and an external entity)
  • External entities cannot be used in datasets
  • XPath constraints in the access rules of external entities cannot be set

Associations between external entities (as defined in the originating app) will be shown in the domain model. You can only use the associations where both sides are exposed.

You can create associations between local persistable entities and external entities. For those associations, the persistable entities need to be the owner.

2.2 Consumed OData Service

When an external entity is dragged into the domain model, the Consumed Odata document that is added to the model will display the values of the metadata contract from the service endpoint.

In the Data Hub pane the service and the entity will be shown as consumed both in the search results pane and also in the Project panels.

If the metadata contract at the specified service endpoint is different to the contract in the current project model, this will be indicated in the Data Hub pane search results and Properties pane for the service with a blue Update arrow:

Data Hub Pane update

update service project-pane

This means that the consumed service will have to be Updated to the new contract. If this is not done, then this will result in errors when data has to be retrieved from the endpoint based on an outdated contract. Changes in consumed OData service contracts is further described in Updating or Switching a Consumed OData Service.

3 Runtime Considerations

The service endpoint is called for every retrieval of consumed OData services. Therefore, the data retrieval for consumed external entities may be slower than local persistable entities.