Forum Discussion

aedahh's avatar
New Contributor
6 years ago

Mock REST, how to save binary file attachment from client request to file system?


I have SOAPUI running mock REST and returing some json resonse, this part is working okay.

I would like to save the binary file attachment from the client's REST request, which is coming from another client, not SOAPUI test request, to SOAPUI server side during processing of the client's request. Where do I start with this? Thanks 

1 Reply

  • In your mock request definition lookup the Script tab, see also here.

    THen adjust to your needs, here I used a XML request to check if it is working.



    def holder = new mockRequest.requestContent )
    new File('c:/foo.txt').withOutputStream { 
    	it.write holder.getNodeValue("//<xpath>").getBytes()