Service Virtualization

Variable Substitution in binary JMS Payload

  • 1.  Variable Substitution in binary JMS Payload

    Posted 10-03-2017 11:30 AM
      |   view attached

    Greetings Team,


    I am also in the similar situation, as stated in ticket

    Variable Substitution in binary JMS Payload  

    I too added the script below after "VS Image Response Selection" and before "Respond" step .

     

    Am working on DevTest v9.0.0.297

     

     'Execute Script' step just before the 'Respond' step, containing the following code:

     

    list = testExec.getStateObject("lisa.vse.response");
    rsp = list.get(0);
    body = rsp.getBodyAsString();
    body = testExec.parseInState(body);
    rsp.setBody(body);

     

    Any help would be of great help:) 


    However I am getting the below error is displayed

    DevTest Server Console


    ============================================================================ | Error in Script ============================================================================ | Step: Execute script (JSR-223) ---------------------------------------------------------------------------- | Message: bsh.TargetError: Sourced file: inline evaluation of: ``list = testExec.getStateObject("lisa.vse.response"); rsp = list.get(0); body = . . . '' : Method Invocation testExec.parseInState : at Line: 4 : in file: inline evaluation of: ``list = testExec.getStateObject("lisa.vse.response"); rsp = list.get(0); body = . . . '' : testExec .parseInState ( body ) Target exception: java.lang.NullPointerException in inline evaluation of: ``list = testExec.getStateObject("lisa.vse.response"); rsp = list.get(0); body = . . . '' at line number 4 ---------------------------------------------------------------------------- | Trapped Exception: bsh.TargetError: Sourced file: inline evaluation of: ``list = testExec.getStateObject("lisa.vse.response"); rsp = list.get(0); body = . . . '' : Method Invocation testExec.parseInState : at Line: 4 : in file: inline evaluation of: ``list = testExec.getStateObject("lisa.vse.response"); rsp = list.get(0); body = . . . '' : testExec .parseInState ( body ) Target exception: java.lang.NullPointerException in inline evaluation of: ``list = testExec.getStateObject("lisa.vse.response"); rsp = list.get(0); body = . . . '' at line number 4 | Trapped Message: javax.script.ScriptException: bsh.TargetError: Sourced file: inline evaluation of: ``list = testExec.getStateObject("lisa.vse.response"); rsp = list.get(0); body = . . . '' : Method Invocation testExec.parseInState : at Line: 4 : in file: inline evaluation of: ``list = testExec.getStateObject("lisa.vse.response"); rsp = list.get(0); body = . . . '' : testExec .parseInState ( body ) Target exception: java.lang.NullPointerException in inline evaluation of: ``list = testExec.getStateObject("lisa.vse.response"); rsp = list.get(0); body = . . . '' at line number 4 ---------------------------------------------------------------------------- STACK TRACE javax.script.ScriptException: bsh.TargetError: Sourced file: inline evaluation of: ``list = testExec.getStateObject("lisa.vse.response"); rsp = list.get(0); body = . . . '' : Method Invocation testExec.parseInState : at Line: 4 : in file: inline evaluation of: ``list = testExec.getStateObject("lisa.vse.response"); rsp = list.get(0); body = . . . '' : testExec .parseInState ( body ) Target exception: java.lang.NullPointerException in inline evaluation of: ``list = testExec.getStateObject("lisa.vse.response"); rsp = list.get(0); body = . . . '' at line number 4 at bsh.BshScriptEngine.evalSource(BshScriptEngine.java:97) at bsh.BshScriptEngine.eval(BshScriptEngine.java:61) at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264) at com.itko.lisa.test.ScriptExecHandler.executeScript(ScriptExecHandler.java:670) at com.itko.lisa.test.ScriptExecHandler.executeScript(ScriptExecHandler.java:427) at com.itko.lisa.test.UserScriptNode._execute(UserScriptNode.java:210) at com.itko.lisa.test.UserScriptNode.execute(UserScriptNode.java:175) at com.itko.lisa.test.TestNode.executeNode(TestNode.java:981) at com.itko.lisa.test.TestCase.execute(TestCase.java:1283) at com.itko.lisa.test.TestCase.execute(TestCase.java:1198) at com.itko.lisa.test.TestCase.executeNextNode(TestCase.java:1183) at com.itko.lisa.test.TestCase.executeTest(TestCase.java:1127) at com.itko.lisa.coordinator.Instance.run(Instance.java:204) Caused by: java.lang.NullPointerException at java.lang.StringBuilder.<init>(StringBuilder.java:125) at com.itko.lisa.test.TestExec.parseInState(TestExec.java:1967) at com.itko.lisa.test.TestExec.parseInState(TestExec.java:1947) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at bsh.Reflect.invokeMethod(Reflect.java:166) at bsh.Reflect.invokeObjectMethod(Reflect.java:99) at bsh.Name.invokeMethod(Name.java:858) at bsh.BSHMethodInvocation.eval(BSHMethodInvocation.java:75) at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:102) at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:47) at bsh.BSHAssignment.eval(BSHAssignment.java:77) at bsh.Interpreter.eval(Interpreter.java:664) at bsh.Interpreter.eval(Interpreter.java:758) at bsh.Interpreter.eval(Interpreter.java:747) at bsh.BshScriptEngine.evalSource(BshScriptEngine.java:89) ... 12 more ============================================================================