Set HttpHeader on Published Rest to Get FileDocument
A published REST-service contains a GET operations. This operation returns one (.pdf) document. Calling the service returns the (.pdf) FileDocument. However, when opening the .pdf a error appears, the file is corrupt, damaged or not correctly decoded. In the GET operation, an HTTP Header is created with Key 'Content-Type' and Value 'application/octet-stream' but this doesn't solve the problem, also application/x-binary and application/pdf dont solve it. My best guess is that other HTTP Header values. Question: Which http header are needed and in the request MF or response MF? Image 1: Request MF Image 2: Response MF Update 1: Problem solved. Modelling mistake 1: In the response handling of the Call REST action, store in file document was selected. This saves the complete response in a filedocument in its contents, but I had to MAP te response to the domain model. Hence, Apply import mapping had to be selected. Modelling mistake 2: After selecting Apply import mapping, the boolean A List was choosen for The response contains. The response contains only one object, and therefore the response does not contain the [ & ] around it. The import mapping did not work because in this case it expects one object. Hence. An object was selected for The response contains boolean. Model bug? Confident this was the right setup, it still did not work. Therefore, I have deleted the request microflow and import mapping, and recreated both After this, I worked. Note: Adding the HTTP Headers did not have any influence. Without it, I can still map any filetype. Thanks for helping me out anyway!
You need at least the content type header:
In the Response MF, you should add a 'Create Object' activity.
Try to add Accept headers:
Pim van der Noll
Thijs, Does the pdf become corrupt upon creation in your service or during transport?
𝕿𝖎𝖒 𝖛𝖆𝖓 𝕾𝖙𝖊𝖊𝖓𝖇𝖊𝖗𝖌𝖊𝖓
Have you tried consuming the service using for example Postman? This is generally a quicker and easier way to test what headers to send and it will even give you some proper error messages.