Service Virtualization

Expand all | Collapse all

How to manually set property "lisa.vse.response"?

Jump to Best Answer
  • 1.  How to manually set property "lisa.vse.response"?

    Posted 10-06-2017 11:35 AM

    Hi All,


    I am currently using Devtest Solutions v9.5.1, and due to heavy customizations I would like to know how to properly set the lisa.vse.response property without first going through the out of box VS Image Response Selection or the Live Invocation step. 


    As far as past experience goes, I was always able to first go through those two steps to ensure the property is set and exists, and then I was able to do change just the body text in the response using a java script with something like lisa_vse_response.get(0).setBody( testExec.getStateValue("SomeResponseBody") );


    I have tried changing the property used in the Responder step, but clearly there is some kind of format that is different from lisa.vse.response and it will not work when I tried. If I don't use the two steps out of box steps listed above, the property is not set and an error is thrown at the Responder where the property doesn't exist.


    Is there any way to setup lisa.vse.response properly on my own (assuming I can retrieve a response from elsewhere)f?



  • 2.  Re: How to manually set property "lisa.vse.response"?

    Broadcom Employee
    Posted 10-09-2017 11:23 AM

    lisa.vse.response is in Transient form from "VS Image Response selection" step or from "LIVE Invocation" step and that is what "Responder" step uses it.


    If you want to use your response and Responder step to send that then you need to convert your response to Transient form and then set it to lisa.vse.response.


    Here is what I tried and worked for me.


    Added a property customResponse2 in config file and changed the workflow in VSM to a JS step with below code. Set the next step of JS step to Http Responder.
    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();
    ParameterList metadata = response1.getMetaData();
    TransientResponse transRsp = response1.createTransientCopy();
    testExec.setStateObject("lisa.vse.response", transRsp);



  • 3.  Re: How to manually set property "lisa.vse.response"?
    Best Answer

    Posted 10-06-2017 04:26 PM

    There may bean easier way to do this.

    I added the following as a JSR-223 and let the Responder send lisa.vse.response.


    import com.itko.lisa.vse.stateful.model.TransientResponse;
    import com.itko.lisa.vse.stateful.model.Response;
    import com.itko.util.ParameterList;

    import java.util.List;
    import java.util.ArrayList;

    // set up a response and add a body
    Response rsp = new Response();
    rsp.setBody( "ABCDE" );

    // add HTTP response meta data values
    ParameterList metaData = new ParameterList();
    rsp.setMetaData( metaData );

    // set a 100ms think time
    rsp.setThinkTimeSpec( "100t" );

    // add response to a response list and convert it to Transient Response list

    // then place it in the lisa.vse.response list object
    List lst = new ArrayList();
    lst.add( rsp );
    testExec.setStateValue("lisa.vse.response", TransientResponse.convert( lst ) );

    // display output of access vse response list to return data set by routine
    return "response body is: " + testExec.getStateValue("lisa.vse.response").get(0).getBodyAsString() +
    "\r\nMetaData is: " + testExec.getStateValue("lisa.vse.response").get(0).getMetaData().toString() +
    "\r\nThinkTime is: " + testExec.getStateValue("lisa.vse.response").get(0).getThinkTimeSpec();


    Service Model:

    Raw REST Call Output:

  • 4.  Re: How to manually set property "lisa.vse.response"?

    Posted 10-09-2017 12:30 PM

    See, there is more than one way to do this.  :-)

    I used the TransientResponse.convert( lst ) ); static method to convert each response in the response list to TransientResponses but probably should have used setStateObject. gadpr08 used createTransientCopy()... and set using setStateObject. 

  • 5.  Re: How to manually set property "lisa.vse.response"?

    Posted 10-11-2017 04:06 PM

    Sorry about the late response as I've been busy with other projects. But this is amazing to know. Thank you. I will keep a copy of this for future reference.