How can I use a variable of type Binary in a microflow?

0
I have a web service call which results in a "Binary" variable (I can't change the type). I would like to feed it into a custom Java action but the type is not listed. How can I use or convert this type?
asked
5 answers
4

The thing Chris mentions works. Did it before.

  1. Feed the object with the binary attribute to the Java action;
  2. In the Java action, access the IMendixObject of your object;
  3. Via the IMendixObject, iterate over all members (attributes);
  4. Check with something like below whether the member is a binary and cast to get access to the binary:
// check if attribute is a binary attribute
 if( member instanceof com.mendix.core.objectmanagement.member.MendixBinary ) {
	
	MendixBinary binMember = (MendixBinary) member;
	
	logNode.info("binary member name:" + binMember.getName());
 }

After this, do with the binary attribute what you want to do in the Java action.

answered
1

You can try storing the binary in a String in your import mapping. That should be accessible.

answered
0

Hi Everyone,

Thanks for your answers and sorry for not replying sooner.

I am still none the wiser how to do this. What I have so far is as follows:

In my microflow, I have a "Call web service" action.

In the "SOAP Response" tab, the only thing I can change is "Store in variable" between "Yes" and "No". Both options tell me I do not need to use an import mapping, which means that the only output I can get from the action is a "Binary" variable or nothing at all.

Just to clarify, the Mendix SOAP action returns a Binary variable, not an object containing a binary.

There is no action as far as I can tell that accepts a "Binary" variable as an input. I have tried creating an entity with a "Binary" attribute, but when I create a new instance of that entity, I cannot select that attribute to assign anything to.

If I create a new Java action, I cannot set "Binary" as the type of any parameter.

If I could get the actual XML response, I could then do something with it, but apparently it has been helpfully converted for me into something completely unusable.

answered
0

OK, so I have given up on the "Call web service" action and am now using "Call REST" and will just have to re-implement the SOAP parts manually. Any thoughts on how to avoid this would be good.

answered
0

 

Hi 

I had the same problem and I manged to solve it by opening the wsdl or the xml file and change data type of the response element of the related function,  in my case it was base64binary and changed to string 

answered