Forum Discussion
Thanks for the answer .Can you please show it in the code how to load a xml file from folder in soap ui using groovy scripting.
Thanks in advance
Hi,
Is this related to the question posted on StackOverflow recently? how-to-copy-a-request-in-soapui-to-a-folder-using-groovy/46542756#46542756
I answered something similar to this on StackOverflow recently....
The below flow is an example of writing the request to a file and then pulling it back in to another request.
Step 1 - Some REST request
Step 2 - Copy the Raw Request value from Step 1 to file
Step 3 - Load the Raw Request from file
Step 4 - Run REST Request with payload form file
Contents of 'Request Copy - Groovy Script'
def rawRequest = context.expand( '${REST Test Request#RawRequest}' ) def file1 = new File('c:/temp/groovy1.txt');file1.write (rawRequest); return rawRequest;
Contents of 'Load Saved Request from File - Groovy Script'. All this does is 'return' a string.
def file1 = new File('c:/temp/groovy1.txt'); return file1.text;
In the final step, I deleted the existing payload in the request section and added a call to the load Groovy script.
Chris
- Ashvne7 years agoNew Contributor
Thank you very much for your prompt reply Chris , Its working now