Showing results for 
Search instead for 
Did you mean: 

How to return binary Mock Responses?

Frequent Contributor

How to return binary Mock Responses?

I am trying to create a REST mock that returns a binary payload. By binary I mean the content of a file byte by byte "as is", without any character encoding/conversion or anything interfering.

Or in other words: If my browser saves the response to a file I expect this file to be bitwise identical to the file that the mock has read from disk.


A very similar question has been posed here:

... but the code shown there does not work (anymore or never did?)


I have come as far as that I have an array of byte's in my hand. But now I am stuck. Nothing I found via Google on that subject worked. The only way I found that returned something was to convert the bytes to a String and assign that to mockResponse.content and place "${content}" into the mock's response editor. But doing so the content is converted first to Java's internal String encoding and later to a UTF-8 and gets completely scrambled along the way.


Is a binary response at all possible with SOAP-UI? If so: how?

Community Manager

Re: How to return binary Mock Responses?

Thank you for asking the Community @mmoser18 !


@HimanshuTayal @ChrisA @Radford @msiadak 

Any suggestions?🙂

Sonya Mihaljova
Community and Education Specialist

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Frequent Contributor

Re: How to return binary Mock Responses?

No suggestions so far? I guess I have to conclude that this is not possible with SOAP-UI/Ready-API, then. 😞

New Here?
Join us and watch the welcome video:
Top Kudoed Authors