Service Virtualization

 View Only

 Redirect the incoming request to live invocation in case of Signature match

Anzar Ahsan's profile image
Anzar Ahsan posted Apr 27, 2022 09:14 PM
I am trying to redirect the incoming request to live invocation step in case of Signature match.
(For No Match, I am able to redirect the request after setting the execution mode to STAND_IN and deploying the service in stand_in)

Looking for some advice in achieving the same in case of Signature match.

Thanks in advance for your help.
Danny Saro's profile image
Broadcom Employee Danny Saro
Hi Anzar,

Re. "in case of Signature match", my assumption is that when you have a META match that the request should go to the Live system?

My approach has always been:
  1. Replace the full response of the META transaction with just one word: META (this way it is clear in the .vsi that this response is not supposed to ever go back to the client)
  2. Add a scripted assertion to the "VS Image Response Selection" step
  3. Configure as follows:
    1. If "True" then "Go To: Virtual Http/S Live Invocation"
    2. Script:
return lisa_vse_response.get(0).getBodyAsString().equals("META");


Hope this helps,
Danny
Vaibhav Jain's profile image
Vaibhav Jain
Hi Ahsan,

As suggested by Danny, you can put an assertion on the response body of meta transaction in vsi and then route it to a live system based on certain conditions

Thanks
charlieParker's profile image
charlieParker
Hello Everyone,

Is there an option to update all the META/Default responses after/when the virtual service is created ? Either via API . SDK , etc ? 
Want to automate the part and add in a build pipeline  / script as updating all the META responses manually via Portal / Workstation might not feasible when there are many of them
Vaibhav Jain's profile image
Vaibhav Jain
Hi CharliePraker,

You can try using Service Virtualization API v3 for updating the response for a specific virtual service. Make sure the overwriteTxns is marked as true.

Another option is to read the VSI as an XML and edit it with expected changes and save it for further usage.

Thanks