Forum Discussion

chrwie's avatar
chrwie
New Contributor
5 years ago

Start Virtual Service with specific Response in Service V Pro

I have a question regarding the REST Virtual Service with Serice V Pro.

In my case, I configured a REST POST request. There I have defined two different answer, as an example.

Response 1:
<Value> 1 </ value>

Response 2:
<Value> 2 </ value>

Is it possible to start the service with a specific response as desired? In one case it is Response 1 and in another case Response 2.
Best regardless of data from the request etc. No headers, no parameters etc.

It would not be that bad of Soapui, maybe even Groovy.

Thank you!

Best regards, Christoph
  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi Christoph,

     

    Can you provide more details? Should service always reply with Response1? Or should it randomly use Response1 or Response2?

     

    • chrwie's avatar
      chrwie
      New Contributor

      Hello, Alex,
      Thank you very much for your request.

      In the best case permanently, as required Response 1, or Response 2 as well as Standard. But so that I can set the standard from the outside. Best per Groovy.

      Many greetings, Christoph

      • AlexKaras's avatar
        AlexKaras
        Champion Level 3

        Hi,

         

        Can you provide an example?

         

        Static request assumes same static response. I can hardly imagine web service that for the same static request returns one response today and another response tomorrow.

        If you need to reply with different responses to the request of the same structure but with different parameters, then you should use different dispatch style depending on how parameters are provided in the request.