cancel
Showing results for 
Search instead for 
Did you mean: 

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

New Contributor

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

Hello,

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 1
Contributor

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

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 com.eviware.soapui.support.XmlHolder( mockRequest.requestContent )

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

 

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