In more complex scenarios it can be necessary to send binary data to a BizAPI. For example a signed PDF document has to be sent through IFS Connect to a third party system. With address chaining such scenario could be accomplished by first calling (chain link 1) a BizAPI that could sign the document and then sending the result (chain link 2) to the receiver using an ordinary Connect Sender. To make it possible it has to be possible to send binary content to a BizAPI and also to receive the function result from BizAPI execution in binary form.
Note: BizAPI is just an alias to Handler.Operation and is not mandatory in Routing Address definition. The principle of working with binary data can be applied to arbitrary operation.
BizAPI's work with documents (views) as arguments, which can be serialized to
XML. To make it possible to work with binary data there is a dedicated document
(view) in the IFS Connect framework (ifs.fnd.connect.views.BinaryParameter
) that
can encapsulate binary data. To use this view for interaction with a BizAPI
(or any other operation) you have
to define an external document in your serverpackage
model file:
externaldocument BinaryParameter "ifs.fnd.connect.views.BinaryParameter";
Then you can use this document as input and/or output in your method:
custom ModifyBmpImage { in Document<BinaryParameter> Data; return Document<BinaryParameter>; transaction Required; }
Within the implementation code you can retrieve or store the binary data
from/to an instance of the BinaryParameter
view:
@Override public BinaryParameter modifyBmpImage(BinaryParameter data) throws IfsException { // extract binary data encapsulated in the view byte[] bytes = data.getData(); // do your work here... // create new instance and put the data into it BinaryParameter result = new BinaryParameter(); result.setData(bytes); return result; }