I'm calling an api to return an excel file.
The call works in Service Studio :
But in runtime, when returning the binaryData output to a download widget I get :
Failed to parse response of the method 'GetNetPricingFile' of the 'FPGPricings' REST API:Parsing '': Unexpected character encountered while parsing value: P. Path '', line 0, position 0.
Everything works fine in POSTMAN and I can save and then open the excel file.
The trace of the call is :
In my specific case, the issue was related to the Rest's Response Format = Text and the output variable was a structure with 1 field of type binaryData.
I changed the Response Format to BinaryData and the output variable also to BinaryData, directly with no structure.
It works like this just fine.
Hi Nelson
Any other suggestions? When changing to binary the error stopped, but it returns empty, in my case it works perfectly through postman too.
Hi Nelson,
This is interesting, as the trace (I assume it's the Integration Log HTTP trace?) should only show <binary data> instead of the actual binary data if it's a binary data body. Can you share a (stripped, if needed) module that contains the REST API method consume?
I have faced such kind of an issue once before. Everything works fine everywhere except for runtime. The solution that I am aware about is that you will need to clear the cache from the frontend servers.
So what I am aware about is that outsystems application uses some frontend servers that do some caching of frequently used elements. When any value becomes old in these servers, it starts to show such kind of behavior.
What I did was that I used the Espace_InvalidateCache action in my code to clear the cache whenever we get such kind of a response. (You will always receive a similar kind of error just like what you are receiving)
You can try this if you want, and also let me know if there is any other good solution for this.
Thanks