file data embedded in json
using SoapUI 5.1.3
doing a post request
have selected Media Type of application/json
the json looks like
{
"myname":"Ox"
}
I have added an attachment but there does not seem to be a way to embed in the json like
{
"myname":"Ox"
"file":"data in the file"
}
have added an attachment and in the parameters table at top have
name value style level
file file:myfile.txt QUERY METHOD
if I do a media type of multipart/mixed or form data I can see the file and json in the Raw view but the file is not embedded in the json.
what I am looking for is a Media type of application/json and to have the data in the file as a value.
thanks
For SOAP TestRequests we have an option called Inline Files, which lets you set the file as an Attachment and refer to it in the body of the request to put the file data inline.
This isn't available for REST requests, but it's not much harder to use an inline script:
{ "myname":"Ox" "file":"${=new File("C:/somefile").bytes.encodeBase64()}" }
(Presuming you want to insert the file encoded as base 64)
You don't need to attach the file to the request, but you will need to give an absolute path to the file on disk.