Forum Discussion

kmanchu's avatar
12 years ago

Mock Service script new request to separate operation

Hi there ...

I was wondering if anyone can help me here as I am just getting into SOAPUI.. I have created a mock service response in Groovy following the "Creating Dynamic MockServices" tutorial .... the mock response needs to first call a separate webservice call to another operation before sending the response back ... my question is how do I code new request inside the groovy code...

so the flow is:

1) requestA for OperationA comes in
2) MockServiceA (groovy script response) consumes the request
3) MockServiceA makes a requestB call to operationB
4) once its gets the response from operation ... send response back to the original requestA

I cant find any samples of this .... any help is appreciated ..

thanks

1 Reply

  • Hi,

    You can select Script in dispatch and send the responses.

    http://www.soapui.org/Service-Mocking/c ... g-overview


    Also check the video,

    http://www.soapui.org/Service-Mocking/c ... vices.html


    You can create a testcase with
    Request A
    Request B

    And in Script you can then configure, response back to the original requestA using script

    def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context );
    def testCase = testRunner.testCase;
    def testStep = getTestStepByName(String stepName) ;
    testRunner = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner(testCase, null);
    testStepContext = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestRunContext(testStep);
    testStep.run(testRunner, testStepContext);


    You need to customize a groovy script.

    Thanks,
    Jeshtha