BAW does not have any supported datatype to handle byte array, I believe. Even if you use ANY type, it would contain the data as string, I think and it's getting corrupted during the string conversion with maybe a different character encoding.
Custom Java, I meant, creating a custom JAR file implementing the REST calls using any standard HTTP client like Apache HttpClient, OkHttp or from standard Java(HttpURLConnection) and use that JAR as an external service.
Original Message:
Sent: Mon February 05, 2024 05:36 AM
From: Sumit Bhardwaj
Subject: Handling binary data in IBM BAW Service Flows
Hi Atanu,
Thanks for the response. The REST API in question returns an application/octet-stream and right now, i try to save it in ANY, but as I said, it's not working out. For the immediate use case, since it had a BAW Coaches based UI showing up while this REST API is called, I have handled it in a coach view using jQuery.ajax() calls after adding binary transport to it, instead of doing it in background using a Service Flow.
However another upcoming application will be a headless one with UI built on React and communication with BAW happening through a Node JS backend. In that application, since BAW coaches are not used, either the API calls will have to happen in the React code itself (not preferable) or I will have to find a way to do it within Service Flows and then expose that Service Flow as a REST API operation to the UI.
As for the Java implementation, do you have know of any example implementations I can refer to?
------------------------------
Sumit Bhardwaj
Original Message:
Sent: Mon February 05, 2024 03:53 AM
From: Atanu Roy
Subject: Handling binary data in IBM BAW Service Flows
Hi Sumit,
I have a question - what is the return data type of the first service which is reading the file content?
You can combine these REST calls together in a Java code and use that, that will surely work.
Thanks!
------------------------------
Atanu Roy
Lead Engineer
London Stock Exchange Group
Original Message:
Sent: Wed January 31, 2024 10:05 PM
From: Sumit Bhardwaj
Subject: Handling binary data in IBM BAW Service Flows
Hi Everyone,
Every now and then, I have been dealing with situations where I am reading binary data from one REST API call and need to pass this data to another REST API call as it is without any modifications whatsoever.
A hypothetical example would be reading a file from, lets say, Sharepoint and uploading it to Azure Blob Storage or IBM Cloud Object storage. In such cases, during transition between the two API call (say, the calls are happening in two different service flows), is there a way to store this data somehow without any XML or String conversions happening to it?
I tried storing this data in an ANY variable but i believe internally, even ANY variables are serialized as XML hence the data when pushed back to the destination API becomes corrupt.
I do not have the liberty of converting this data to a binary string representation either as that would require the destination to convert it back to binary. I was able to achieve this on UI by using jQuery Ajax calls with a custom binary payload definition but not sure how to do it within backend code like Service Flows.
We have a use case coming up very soon for this, so any quick help would be really appreciated. If this is not possible, any alternate design pattern to handle this type of situations, like implementing something custom as a Java jar and utilizing that?
------------------------------
Sumit Bhardwaj
------------------------------