How to retrieve the xml file object using java action in Mendix?

0
We want to return the xml file as a response from java action to the Microflow. This Microflow will use further this xml response.  
asked
2 answers
0

Do you mean you have an XML file stored in a FileDocument, and you want to return the contents of this file as a String so you can use it in your microflow?

If you do, have a look at the Community Commons module in the Marketplace. It has an action called StringFromFile that can do this for you.

https://docs.mendix.com/appstore/modules/community-commons-function-library#4-3-files

Hope this helps.

answered
0

Hi Vivek,

Can you give some more details what you mean exactly with “the xml file”? What do you need to do with it in Mendix?

Often the best approach when you process an external file in Java is to return the serialized XML as a String from the Java action. In Mendix you can deserialize it with an import mapping to objects after which you can use the objects in microflows.

Storing the XML file in an object inherited from FileDocument in Java is more difficult and requires some more knowledge of Java.

answered