Service Virtualization

 View Only
  • 1.  Response from live system

    Posted Aug 28, 2019 10:50 AM

    ​Hi,
    How can I get body response from Live system in Scripted Association?

    My virtual service is in "Live Invocation" mode.

    This code working only in Most Efficient:

    import com.itko.lisa.vse.stateful.model.TransientResponse;
    responseList = testExec.getStateObject("lisa.vse.response");
    TransientResponse response = responseList.get(0);
    String respText = testExec.parseInState(response.getBodyText());
    testExec.setStateValue("RespBody",respText);
    _logger.info("BODY"+respText);
    return true;

    THX



  • 2.  RE: Response from live system
    Best Answer

    Posted Aug 29, 2019 02:49 AM
    Edited by Christopher Hackett Sep 03, 2019 11:21 AM
    Hi Mario,

    I was able to extract response into a variable using the below script in both modes i.e. Normal and Live Invocation. I have used a do nothing step separately for extracting the response using script. Then variable "RespBody" is used for saving the property into a file. In both modes, different responses  are being captured in files.

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

    // This script should return a boolean result indicating the assertion is true or false
    import com.itko.lisa.VSE;
    import com.itko.lisa.vse.stateful.model.Request;
    import com.itko.util.ParameterList;
    import com.itko.util.Parameter;
    import com.itko.lisa.vse.stateful.model.TransientResponse;
    responseList = testExec.getStateObject("lisa.vse.response");
    TransientResponse response = responseList.get(0);
    String respText = testExec.parseInState(response.getBodyText());
    testExec.setStateValue("RespBody",respText);
    _logger.info("BODY"+respText);
    return true;

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

    Kind Regards,
    Vaibhav J