Java File Document

1
Good day, Sorry to ask this question, based on my previous question, but I think I am really struggling unnecessary. I have a String parameter containing XML. I need to convert this to a XML document object, so that it can be mapped with the XML-TO-Domain. I seem not to succeed in populating the contents in my java action. Java code: @Override public IMendixObject executeAction() throws Exception { // BEGIN USER CODE InputStream inputStream = new ByteArrayInputStream(XmlParam.getBytes()); IMendixObject mendixObject = Core.create(this.getContext(), "System.FileDocument"); Core.storeFileDocumentContent(getContext(), mendixObject, inputStream); return mendixObject; // END USER CODE } This must become XMLDocument in mendix for microflow from mapping xml. The content isn't populated, and obviously I am missing that. Can anyone please assist, what I am missing. Really thanks!!
asked
1 answers
2

That code looks fine, but to make sure I ran it as well and it's working for me. Are you sure the content of the file isn't there? Have you tried adding a download activity after this java action and having a look at the contents in a text editor?

Extra tip: Use the FileDocument proxy to at least get the entity name of the filedocument entity without risk of spelling it wrong, like this:

FileDocument.entityName

Or you could use the proxy's convenience methods to create entities of that type.

answered