cancel
Showing results for 
Search instead for 
Did you mean: 

Groovy Code to convert Audio file into Bytes

arnab_mondal2
Participant
0 Kudos
491

Hi Experts , I have a requirement -

Source system - Request byte -> CPI -> Target System ( FTP folder) - Transmit back audio files in the form of byte to source system .

I am not sure if any of the standard channels can do the conversion . I believe this needs to be handled in CPI for conversion .

Please advice on :

1. Possible groovy code to convert audio file to binary bytes

2.Possible good design if any to handle this situation .

Many thanks in advance to the experts !

Accepted Solutions (0)

Answers (1)

Answers (1)

Ivan-Mirisola
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Arnab,

I've found the following blogs that might help you.

https://blogs.sap.com/2017/10/03/adding-cloud-integration-attachments-in-code/

https://blogs.sap.com/2017/10/02/dark-side-of-groovy-scripting-behind-the-scenes-of-cloud-integratio...

https://blogs.sap.com/2018/05/22/get-groovin-with-your-iflows-groovy-scripting-with-eclipse-for-cpi/

From what I could figure you will be sending the binary data as MIME (so you have the code to grab that from the incoming message). Then process the data as a stream of bytes (don't know exactly what you are looking for here since it is an audio file). Once you have the processed stream you would have the binary data back into the message. All three blogs have details on how to do it.

I figure that if you don't want to change the incoming audio file, that a simple iFlow with FTP Adapter will suffice, considering you are already receiving the payload as binary data.

Best regards,
Ivan