Service Virtualization

 View Only
  • 1.  How to respond with Response 2 of  2 in VSE

    Posted Sep 19, 2016 02:45 PM

    Hi ,

     

      I have one request with two response recorded in DevTest with "Response 1 of 2"  and "Response 2 of 2" , How we can send "Response 2 of 2" when request comes second time. 



  • 2.  Re: How to respond with Response 2 of  2 in VSE
    Best Answer

    Posted Feb 15, 2017 12:53 PM

    This technique is accomplished by using the Allow Duplicate Response check box.  But, you need to modify your VSI to accomplish this task.

    1) Go into the VSI and select the operation on which you want to allow duplicate responses.  Check the Allow Duplicate Transactions box in the Transaction Basics screen.

     

    2) Now you need to create two specific transactions that are identical.  Select the transaction that contains Response 1 of 2 and 2 of 2.  RIGHT CLICK and copy/paste this transaction to create a new entry.

     

    3) Now you should see two transactions that are identical.  At this point, both have Response 1 of 2 and 2 of 2.  In the second transaction, delete (remove) Response 1 of 2.  This action leaves the 2nd response in this specific transaction.

     

    4) Navigate to the first response and remove Response 2 of 2 which leaves only the first response.

    5) Save the VSI and deploy the model.

     

    Now, you have two specific transactions, and the Allow Duplicate specific transactions checkbox drives the behavior.  The first time the service matches, the first response is sent.  The second call to the service results in the second response.  The third call results in the first response.  The process repeats over and over.  If you want to "reset" so the initial call responds from the first response, stop/start/deploy the service or stop/start the VSE.  These are the only actions that 'reset' the response order.  

     

    You may want to alter your META response to contain a different response so the consumer does not get confused when sending all other requests.   



  • 3.  Re: How to respond with Response 2 of  2 in VSE

    Posted Aug 11, 2017 08:15 AM

    Hi J_NeSmith,

     

    Your suggestion helped me to create 2 different responses for one identical request.However ,I want to check is there any way  of sending first response on 1st Hit ,second response on 2nd hit and all other hits (3rd,4th,.....and so on).

     

    I have a business requirement to send the response (1st response) that a user is not created so that I can create a user and after that on all times,send the created user details(2nd response).

     

    Thanks

    Sarthak Gupta



  • 4.  Re: How to respond with Response 2 of  2 in VSE

    Posted Aug 17, 2017 04:39 PM

    Sarthak,

     

    As Joel explained, after you have created all of your responses for a given request they will be returned in a round robin fashion just like how you want it to be. In other words, it will return Response 1 on the first request, it will return Response 2 when the virtual service gets the exact same request again, and so forth.