Forum Discussion

psr7474's avatar
psr7474
New Contributor
12 years ago

URGENT - How to add time delay to MockService in SOAPUI proj

Hello All,

I have created a mock service for an external wsdl in SOAP UI 4.5.0. I want to add time delay of 40 seconds to the mock service or response. I mean when we send a request instead of getting the response immediately. I want the response to come after certain delay.

How can i add that delay in SOAP UI project for mock service / response OR can i add time delay using any attribute in nohup command used in linux system to deploy the SOAP UI mock service.

Sample nohup command - nohup /opt/Cordys/soapui-3.5.1/bin/mockservicerunner.sh -m"ConfigurationServiceBinding MockService" -p 8092 -D"MockRespFilePath=/opt/Cordys/SoapUIProjects/BigMachinesConfigure/Response/" "/opt/Cordys/SoapUIProjects/BigMachinesConfigure/BigMachinesConfigure-soapui-project.xml" > /opt/Cordys/SoapUIProjects/BigMachinesConfigure/nohup-BigMachinesConfigure.out 2>&1 &

Need you inputs immediately and your help is most appreciated?

Regards,
Sreez

1 Reply

  • redfish4ktc2's avatar
    redfish4ktc2
    Super Contributor
    Hi,
    I've previously done this using groovy code in the response definition
    This is uggly, but this works.
    In the responsee panel, open the script tab and put the following code

    System.out.println("Prepare a very slow response")
    def timeout = 40000 // in millis
    System.out.println("Ready to wait for " + timeout + " ms")
    Thread.sleep(timeout)
    System.out.println("End of wait")
    System.out.println("End of the very slow response")


    Tell me if this matches your need

    Note: next time, please do not put "URGENT" in your post message, this won't make user answer quickly