HTTP Virtual Service to go to LIVE when META response is returned
search cancel

HTTP Virtual Service to go to LIVE when META response is returned

book

Article ID: 133359

calendar_today

Updated On:

Products

CA Application Test

Issue/Introduction

For the response to go to Live system if there is no exact match in the virtual service. 

Environment

Release : All supported DevTest environments

Component : CA Service Virtualization.

Cause

It is a customized functionality and not an issue. VS need to be customized.

Resolution

Here are few options to send the request to the LIVE system when META response is returned from VS.

. When there are no changes to the lisa.vse.requet then the article :

https://knowledge.broadcom.com/external/article?articleId=76623

. When the VSE request body need to be modified before going to the LIVE system (LIVE Invocation step) then the article:

https://knowledge.broadcom.com/external/article?articleId=127510   will provide information on changing the request.

. When, the endpoint need to be modified with a different URI. In this scenario, Replacement URI field can be used to update the URI.

. When LIVE endpoint does not use a port, then a Web Service Execution XML/REST step can be used instead of Live Invocation step in VSM. When a Test step used in VSM then save  the step response to a property like "LiveResponse" or something else. Then add a "Scripted Assertion" on the Test step to convert the response to Transient form and assign it to lisa.vse.response property. Set the "Scripted Assertion" logic "if False=Fail". Assertion will never fail as code returns true. You can write the custom code or use the below code to set the LIVE response to lisa.vse.response:

----------------------------------------

import com.itko.lisa.vse.stateful.model.TransientResponse;

import com.itko.lisa.vse.stateful.model.Response;

import com.itko.util.ParameterList;

Response response1 = new Response();

response1.setBody(testExec.getStateObject("LiveResponse").toString());

ParameterList metadata = response1.getMetaData();

metadata.setParameterValue("HTTP-Response-Code","200");

TransientResponse transRsp = response1.createTransientCopy();

testExec.setStateObject("lisa.vse.response", transRsp);

return true;