Forum Discussion

esfomeado's avatar
esfomeado
Occasional Contributor
9 years ago

MockService return two responses

I have a mock service that simulates a external application on my application.

Right now i'm able to send only one response depending of input but i want two send two responses sometimes but i don't know how to do this on SOAPUI or if its even possible.

 

To give a better understanding how it works my application i send a request to the external application to create an account. The external service only returns if it's valid or not and if its valid the external application will send a request to my application to procede with the account creation.

 

Flow:

App -----------Request----------------> External

App<-----------Is Valid ----------------- External

App<-----------Create Account ----------------- External

 

I want to simulate this flow with mock service if possible.

 

Current flow:

App -----------Request----------------> MockService

App<-----------Is Valid ----------------- MockService

Missing last step

 

Thanks

1 Reply

  • rupert_anderson's avatar
    rupert_anderson
    Valued Contributor

    Hi,

     

    If I understood you correctly you want to call a mock once and have the mock reply with one initial response (is valid) and then perhaps rather than make a second response, more perform a call back for (create account)?

     

    If this is what you like to do, I think one good way is to get the mock to trigger/run another TestCase (asynchronously) in order to perform the call back using a SOAP/REST Request TestStep. For this please see the code from a post I answered previously:

     

    http://community.smartbear.com/t5/SoapUI-Open-Source/How-to-simulate-an-asynchronous-web-service-with-mock-services/m-p/98365#M17496

     

    Of course if I didn't get your intentions correctly, please let me know and I'll see if I can help.

     

    Cheers,

    Rupert