Adding headers to VS response for all the transactions in VSI?

Document ID : KB000095238
Last Modified Date : 09/05/2018
Show Technical Document Details
Introduction:
When headers need to be added for few transactions, then add them to the transactions response in VSI-->Response MetaData by using Workstation or Portal or manually open it in some editor. If this option is not feasible if VSI has a large number of transactions. This article will provide information on how to add headers to VS response for all the transactions in VSI automatically.
Environment:
All DevTest supported environments.
Instructions:
Using the Scriptable DPH to the HTTP Responder with the below code will add the specific headers automatically to the response. 
------ 
import com.itko.util.ParameterList; 
import com.itko.util.Parameter; 

ParameterList metadata = lisa_vse_response.getMetaData(); 
metadata.addParameter(new Parameter("UserId", "0012xx")); 
lisa_vse_response.setMetaData(metadata); 
------------- 

In the above code, UserId=0012xx will be sent in the response headers.
 
Additional Information:
https://docops.ca.com/devtest-solutions/10-1/en/using/using-ca-service-virtualization/using-devtest-workstation-with-ca-service-virtualization/creating-service-images/using-data-protocols/scriptable-data-protocol