You cannot deal with binary data unencoded in XML, and that is what the message is telling you.
Use GatewayScript "Buffer" type to deal with binary data:
https://www.ibm.com/docs/en/datapower-gateway/2018.4?topic=objects-buffer-object
------------------------------
Hermann Stamm-Wilbrandt
Compiler Level 3 support & Fixpack team lead
IBM DataPower Gateways (⬚ᵈᵃᵗᵃ / ⣏⠆⡮⡆⢹⠁⡮⡆⡯⠂⢎⠆⡧⡇⣟⡃⡿⡃)
https://stamm-wilbrandt.de/en/blog/------------------------------