ReadyAPI - Dynamic POST using .xml files or using .csv file that are saved in the directory
I am using ReadyAPI (SOAPUI) POST method.
I would like to POST content from an external file.
1) In the media type drop down I select application/xml OR application/json
2) And in the area where we put the actual payload, I would like to use the external file path so that content of that extenral file can be read and gets Send via POST method.
Is above achievable?
I can see it can be done for SOAP requests as per - https://www.soapui.org/docs/data-driven-tests/using-files.html
BUT i am not sure if its possible to it for REST Request for POST method. I have been googling for days but can't find a solution so any help would be much appreciated. Basically my need is that i will have a bunch of XML payloads created at the given directory which i will need to send via POST method. I know how to make it data driven using DataSource/Loop but not sure if i can send POST request that exists as an external file. I hope i have explained the question correctly. Any further questions please let me know.
Thanks for your help in advance.
- Hi ZP,
Yep this works for REST requests, but you won't include the 'path' to the file in the request, but if you're using a directory datasource (as ypu appear to describe) then each of your files will be loaded into a single property and within the request field you simply reference the datasource property. (e.g. something like '${#datasource#dataprop}', depending on the name of your datasource and property name)
I'm driving at moment, but will answer properly with complete details once i get into work (unless someone else answers before then)
Cheers,
Rich Hi ZP,
The Media Type of the request matters - it should be `application/xml`.
On my side, your scenario with a sample Petstore project works fine. My project and a video showing how I run it are attached.
Let me know if this helps.