Service Virtualization

  • 1.  Fetch response from excel file

    Posted Sep 06, 2018 08:03 AM

    Hi, 

    I am using dataset in VSM and I am trying to get dynamic response for the values present in the excel file. Please suggest me the way to accomplish this.

    I have created one data set in LISA workstation.

    Now I want read  the "TagName" from the request and provide the "Tagvalue" from data set.

    Do we have something which can be done without codding in this case.

    Input:

    <response>{{{{request_tagName}}}}</response>

    Output:

    <response>TagValue</response>

     

    something like this...will work??



  • 2.  Re: Fetch response from excel file

    Posted Sep 06, 2018 10:08 AM

    Hello Jitender,

     

    Have you had the chance to take a look at Data Driven Virtual Services:

    Create Data-Driven Virtual Services - DevTest Solutions - 10.1 - CA Technologies Documentation 

     

    Under Map Responses to Data Set Columns, you will find more information on how you use the data set in the response: Create Data-Driven Virtual Services - DevTest Solutions - 10.1 - CA Technologies Documentation 

     

    Hope it helps.

    Heloisa



  • 3.  Re: Fetch response from excel file

    Posted Sep 06, 2018 12:31 PM

    Did not get any help by this, but thanks for your effort.



  • 4.  Re: Fetch response from excel file

    Broadcom Employee
    Posted Sep 06, 2018 12:48 PM

    you could do

    Input:

    <response>{{request_tagName}}</response>  //from the request_argument.  

    Output:

    <response>{{TagValue}}</response>

     

    you could use the code to capture the Request argument as described below

     

    https://communities.ca.com/message/241892909?commentID=241892909#comment-241892909 

     



  • 5.  Re: Fetch response from excel file

    Posted Sep 06, 2018 12:50 PM

    Jitender,

     

    I believe using {{tagName}} in the VSI response should work.

    I am sending this document with an example of a data set in use with a VSM:

    How to reset a dataset for each transaction - CA Knowledge 



  • 6.  Re: Fetch response from excel file

    Posted Sep 07, 2018 11:24 AM

    Maria

    at this stage, request_???????, will it be the xpath of the tag or just a tagName.

    Can I change this now after created all the steps or I have to recreate it again from the beginning.

    Aslo, i will be deploying my vitual service on the console, will it work there?

     



  • 7.  Re: Fetch response from excel file

    Posted Sep 07, 2018 09:55 AM

    Hi 

    I have created one virtual service and I applied one filter in listener step and storing the value in one variable.

    Now suppose we have one property called {{abc}} that has value 123.

     

    the requirement is, I need to write a code using Execute Script (JSR 223)

    1. Pick TagValue from the request

    2. Treat this as a tagName and search appropriate tagValue from the excel

    3. Save it to one property so that we can use it in the response like "{{....}}"



  • 8.  Re: Fetch response from excel file

    Posted Sep 07, 2018 09:59 AM

    Please help me with the code



  • 9.  Re: Fetch response from excel file
    Best Answer

    Posted Sep 18, 2018 08:04 AM

    Approach1

    Please use a Magic String to eco values from Request Arguments to a Response argument.

    Example: 

    Request:

    <x>

    <y>1</y>

    </x>

     

    Now go to response section in VSI and edit the response argument as below.

     

    <z>

    <k>{{=request_x_y}}</k>   // so what ever values comes in request argument y the same value will come here.

    </z>

     

    Approach2

    We can use a data driven approach to send a response argument value based on the request argument value. Please visit the following link over mobile.

     

    https://m.youtube.com/watch?v=RMwrBa7L5_s