Call microflow from java action and convert image to base64
0
I am calling a microflow from the java action and sending a file as a parameter from java action. and I want to call a microflow from the java action to convert this image into base64. can anyone help me where m doing wrong!! Thank you Regards, Shashi // This file was generated by Mendix Studio Pro. // // WARNING: Only the following code will be retained when actions are regenerated: // - the import list // - the code between BEGIN USER CODE and END USER CODE // - the code between BEGIN EXTRA CODE and END EXTRA CODE // Other code you write will be lost the next time you deploy the project. // Special characters, e.g., é, ö, à , etc. are supported in comments. package myfirstmodule.actions; import com.mendix.systemwideinterfaces.core.IContext; import com.mendix.webui.CustomJavaAction; import com.mendix.systemwideinterfaces.core.IMendixObject; import java.util.Base64; public class Java_action extends CustomJavaAction<java.lang.Void> { private IMendixObject __imageDocument; private myfirstmodule.proxies.XMLDocument imageDocument; public Java_action(IContext context, IMendixObject imageDocument) { super(context); this.__imageDocument = imageDocument; } @java.lang.Override public java.lang.Void executeAction() throws Exception { this.imageDocument = __imageDocument == null ? null : myfirstmodule.proxies.XMLDocument.initialize(getContext(), __imageDocument); // BEGIN USER CODE //throw new com.mendix.systemwideinterfaces.MendixRuntimeException("Java action was not implemented"); com.mendix.core.Core.microflowCall("MyFirstModule.convertImgToBase64"); // calling microflow return null; // END USER CODE } /** * Returns a string representation of this action */ @java.lang.Override public java.lang.String toString() { return "Java_action"; } // BEGIN EXTRA CODE // END EXTRA CODE }
asked
Shashi Sharma
1 answers
1
It might be more simple to use the community commons Base64EncodeFile and Base64DecodeToFile.
Regards,
Ronald
answered
Ronald Catersels