Service Virtualization

 View Only
  • 1.  How to call a script on Magic String Argument

    Posted Nov 17, 2017 12:33 PM


    We have a case where we want to run a simple script on a Magic String Argument Response to modify the Run Time Response value pickup-up from the Request. Typical usage could be a string simple parsing or concat ... etc 


    The Magic String Documentation mentions that: "{{=request_.... }} can execute arbitrary Java code ....  but no clue how to implement it concretely ?


  • 2.  Re: How to call a script on Magic String Argument
    Best Answer

    Posted Nov 17, 2017 04:42 PM

    Others may be able to provide examples. 


    1) Is it possible to use a JSR step, Request/Response-Side Scriptable or Custom DPH in the VSM to implement logic to generate and store a value in testExec?  For example:

    So long as myNewField is created prior to the Response step, the value should be able to substitute.


    2) Invoke a Static method on a class.  For example:

    The response body, can contain something like this:

    The result is a response that looks like this:



    3)  (Caveat: I have not tried this)  If one had a custom class / method that returns a string, you might:


    someMethod's signature accepts com.itko.lisa.vse.stateful.model.Request; thereby giving access to all of the methods on the lisa_vse_request object as well as other classes.