Export Mapping Error

0
I am trying to expose the rest service of an app that I am working on and I have been following the mendix documentation on how to do so. I am getting an error saying “Export mapping does not support mapping type returned by a microflow.” Does anyone know how to fix this error?
asked
3 answers
3

So you have a published rest service. That service has a problem with its export mapping. Since it is an export, not import, mapping, the mapping is in the Response-tab of your rest-service-activity. The rest service uses a microflow Location_Get_ByKey to fabricate the content of the response and the rest-service uses mapping EM_LocationExport to transform the result of your microflow to the required export format, JSON or XML. The result of your microflow is of entity type System.HttpResponse. The mapping EM_LocationExport however expects a different entity type. Hence this error.

So if you make sure that you make the microflow return its result in a format that the exportmapping can handle, this error will be resolved.

For better understanding / more details on what happens you have two options:

  1. Change the loglevel of ‘Published services’ to Trace
  2. Change your rest-call-activity to store the result in a string instead of in a mapping; add an activity ‘Export mapping’ passing that string to EM_LocationExport.
answered
0

I was under the impression that the mapping was used to convert the domain model entity along with its associations into a formatted JSON string. Then that is put into an http response and exported to wherever it it consumed. That is how the Mendix documentation "Publish a REST Service" does it at least.

answered
0

Hi community 

 

You can add an export mapping, and in the microflow, directly return the object or list as mentioned in the documentation. It will work as expected, based on my experience.

Steps to implement:

  1. Add Export Mapping: Create an export mapping as you normally would.
  2. Simplify the Microflow: There is no need to use the ExportWithMapping (Export to JSON) action or manually create an HttpResponse or HttpHeader. You can directly return the mapped object or the list retrieved from the database.

image.png

answered