[TechCorner Challenge #11] Change Socket Timeout for HTTP requests using Groovy Script
Hi Community!🙂
Here's a new task for you to practice your skills of using the ReadyAPI tool. Check out the participation rules and TechCorner Leaderboard here.
ReaydAPI allows you to set a global socket timeout value for HTTP requests through its preferences, however, there are times where this is not enough.
Some specific requests may require a different value to better suit your expectations for the test. In these cases, you can use a Groovy script to change the socket timeout value then change it back to its original value.
Task: Write a Groovy Script that will set socket timeout to a new value, then return it to the default value.
Difficulty:
Good luck😊
I have learned that the operation works perfectly fine when I am at my home computer.
The proxy settings I entered into SoapUI at my work computer don't seem to have a positive effect. Other developers here at my office have left those settings at their blank defaults.
However, I KNOW it has to do with the security settings at my work's network.
So, I finally got this to work, as others have pointed out, by saving the WSDL information to a local file. The steps I took were as follows:
- Entering the path into my Chrome (or any other) browser; in this case the url is:
http://www.webservicex.com/currencyconvertor.asmx?WSDL - Take the resultant browser output and save it as an XML file. "XML" is the default file extension. An extension of "WSDL" may be technically more accurate. You can do this by right-clicking in the browser window with the resultant WSDL information present and choosing "Save As...". Save the file to your local machine.
- After creating a new project in SoapUI, right-click the project and choose "Add WSDL".
- Enter the path to the saved XML file. SoapUI will correctly interpret the file and create the necessary information tree.
- The resultant SoapUI tree looks similar to the following:
- Entering the path into my Chrome (or any other) browser; in this case the url is: