(REST Module)How to consume xml from Rest service

How do I consumer an xml response from a Rest service. I get message, response is not a json object, json object must start with '{'. With Rest Module, can I only consume json response?
2 answers

We created a workaround which allows us to consume XML from a REST service.

One way is to convert the response XML to JSON in the Java action (RestConsumer.java). For more info: http://www.json.org/javadoc/org/json/XML.html

However we preferred to keep the XML response and write it to a FileDocument and use the XML to Domain functionality of Mendix to import the data to entities. The Microflow would first create an object (XMLResponse) based on the FileDocument generalization. The seconds step would be the java action "request" and add the created object as var in the optResponseData field. Commit the XMLResponse (not sure if needed). Finally Import the XML document.

It would be nice if the REST services module would have default functionality to consume XML responses.


With the REST module you can currently only consume JSON responses indeed. But feel free to fork ;-). Note that consuming Webservices (WSDLs) is supported natively in Mendix.