I am consuming an API accepting multi-part form data.
When passing the binary file as one of the parts from client side or file system, API is responding sucessfully. But when passing it by fetching the binary data from Outsystems DB and passing it, then it is not responding .This is executed in the timer.What could be the possible reason?
Hi Saurabh Sengar,
Please check the API trace log for both cases: when the call is made from the timer and when it's made from the client side. Also, compare the request parameters in the API log for both scenarios and note any differences.
Thanks,
Vipin Yadav
Hi Saurabh,
First, if you are consuming an API that wants Multipart/form-data, please do not use this asset but the built-in functionality. It's easier to use than this asset, and offers all the advantages of built-in functionality.
Only if you are exposing an API that accepts Multipart/form-data this asset should be used.
Yes, i am consuming an API that accepts multipart/form-data..
But our current platform version doesn't match with the pre-requisites.
It's 11.18.1.
Right, I didn't realize people have this old versions :). You really should upgrade it, there's been a lot of critical security vulnerabilities fixed since then...
That said, you wrote "it is not responding". What do you mean by that? Do you get a time-out?
Case 1- When Binary file is directly passed from the client side of the application ##Success
Case- 2 When binary is fetched from the Outsytems DB
, exactly the same payload as Case 1 attached screenshot. No Full Response
So the issue is coming when we are fetching binary file from the DB.
I would say the problem is also on the other side of the API, as it's weird that that's the response if there would be something wrong with the payload. It's like it gets an empty payload, and decides that's A-OK.
Have you debugged the module to see what parts are added, and what the final message looks like before it is sent to the API? It should look the same whether a file is uploaded or fetched from the database.
Yes it looks same.
But there must be some difference, otherwise you can't explain why the API responds differently. You could consider saving the payload (by changing the code of the extension, either by saving it to disk if you are on-premise, are passing it as output then downloading), and binary compare the two payloads of the different situations.
Hi @Saurabh Sengar ,
I encountered a similar issue a month ago and reached out to the team that exposed the API. Together, we debugged and found that the filename needs to include the extension as well.
For example, it should be saved as "Filename.pdf."
Please check whether you are sending extension or not.
Please try this approach, and let me know if you need any help from my side.
Thanks and Regards,
Adarsh Patel
Hello @Saurabh Sengar
I have encountered the same issue, and this configuration did solve it
Im providing file name and binary from my outsystems database.
Regards