Forum Discussion
Hi,
I read this as.....
"I have a huge request payload and I don't want to clog up SoapUI with it. Is is possible for SoapUI to load the contents of this file into a SoapUI request and then run the request?"
If so, then yes. But before I describe, please let me know that is what you want.
Yes Chris thats correct, i want to call this web service with this huge payload request which is present in that file.
Thanks
Chaitanya
- ChrisAdams4 years agoChampion Level 3
You need a couple of steps to achieve this. Firstly, a Groovy Script to load the file and secondly, the service call itself.
The Groovy script step must come before the service call. Here's an example, let's call the step "Get Payload - Groovy Script"...
import java.io.File; // Basic code to reference the file. def fullFolderPath = "C:\some folder\sub folder\"; def fileName = "payload.txt" def fullFilePath = fullFolderPath + fileName; // This var will contain the contents of the file. String returnValue; log.info("Opening Payload file ${fileName}."); try { returnValue = new File(fullFilePath).text; } catch(FileNotFoundException e){ log.info(e); }catch(IOException e){ log.info(e); } return returnValue;
Then, in the payload section of the request, you can 'call and pull in the result' of the Groovy script by entering...
${Get Payload - Groovy Script#result}
Here's a screenshot to reinforce...
- chaitanya5094 years agoOccasional Contributor
Thanks Chris ! I am able to get the data from the file , Can you please let me know how can i call this groovy script from my SOAP Request payload. when i am trying to access the script from SOAP request xml window like ${NameofStep#Result} i am getting "Invalid request" error
- ChrisAdams4 years agoChampion Level 3
Hi, I know you have said the payload is large, but have you tried calling the request with payload pasted in? Might be worth trying just to ensure the request and payload are correct.
Related Content
- 6 years ago
Recent Discussions
- 15 years ago