Skip to content

How do I set timeout for a web service request

This example demonstrates to set the "timeout" for all service requests that get executed in the context of a wsBlock.

In the solution shown below, Test execution gets aborted if no response comes back from Worksoft SaaS wsCONNECT within the time value set. If this command is NOT used within a wsBlock, a default value will be applied for the timeout.

Solution:

# Command Target Value
Start of a web service block
1 wsBlockOpen

To set the Header Protocol
2 wsSetProtocol
REST
To set the URL for Triggering Runs Using Worksoft SaaS QaCONNECT REST API
3 wsSetRequestURL
https://www.eureqatest.com/rest/v1/
${test_cycle_QaCONNECT_domain}/executions
URL
To set the type of request method to hit the appropriate service  
4 wsSetRequestMethod
GET
To set the authentication type - Basic
5 wsAuthenticationType Basic
To set the Username to login to Worksoft SaaS Domain
6 wsSetUsername
your user name
To Set the Password to login to Worksoft SaaS Domain
7 wsSetPassword your password
To set the request body format and output type
8 wsSetRequestHeaderParam Content-Type
application/json
To set the Request Payload with the Request Input JSON
9 wsSetRequestTimeOut 30000
Execute the Service Request
10 wsExecuteRequest
${URL}
Response
End of a web service Block
11 wsBlockEnd


Tips, Tricks, Gotchas & Best Practices:  

  • You can also Remotely trigger executions of automated tests in Worksoft SaaS and expect a Callback from Worksoft SaaS when execution completes/aborts using the GET method
  • You can repeat the command with multiple header parameters


    Feedback and Knowledge Base