Service Virtualization

  • 1.  Run time Updation of the mainframe response

    Posted Dec 22, 2017 10:12 AM

    Hi All,

     

    One of our mainframe transaction has has been upgraded from V1 to V2 with some 9 additional fields in the response copybook for different groups. I have a situation where I have few hundreds of these transactions and I cannot manually update all of them. Hence I have arrived at a solution where I have added a scriptable DPH before the response copybook filter. In this filter I have used the below line to extract the response from the response selection step which is in XML format 

    String xmlRecords = testExec.parseInState(lisa_vse_response.getBodyAsString());

    Then I used the DOM parser to parse this XML string and add the new fields to the required groups. (As this I felt easy to read the specific nodes and add the new fields accordingly).

     

    Once I have added the fields, I created the transient response copy using the below code and passed the updated XML string.

     

    com.itko.lisa.vse.stateful.model.TransientResponse r = new com.itko.lisa.vse.stateful.model.Response().createTransientCopy();
    r.setBodyText(xmlRecords);
    testExec.setStateObject("lisa.vse.response",r);

     

    Now when the response copybook filter is getting implemented on this, I'm getting the below error and the copy book implementation is not happening. Instead of getting a fixed length response, I'm getting the XML which I have set in the above code.

     

    Did not get a valid response object so we ignore processing this transaction.
    java.lang.RuntimeException: Unable to convert the generic XML version of this response back to raw: <?xml version="1.0" encoding="UTF-8"?><copybook-payload>
    <Body>
    <OUTPUT-MESSAGE>
    XXXXXXXXXXX - Copybook Msg
    </OUTPUT-MESSAGE>
    </Body>
    </copybook-payload>

    at com.itko.lisa.vse.stateful.protocol.copybook.CopybookDataProtocol.updateResponse(CopybookDataProtocol.java:614)
    at com.itko.lisa.vse.stateful.common.DataProtocolStandardControlFilter.subPreFilter(DataProtocolStandardControlFilter.java:175)
    at com.itko.lisa.test.FilterBaseImpl.subFilter(FilterBaseImpl.java:148)
    at com.itko.lisa.test.FilterBaseImpl.preFilter(FilterBaseImpl.java:95)
    at com.itko.lisa.test.TestNode.doFilters(TestNode.java:1464)
    at com.itko.lisa.test.TestNode.doPreFilters(TestNode.java:1417)
    at com.itko.lisa.test.TestNode.executeNode(TestNode.java:964)
    at com.itko.lisa.test.TestCase.execute(TestCase.java:1288)
    at com.itko.lisa.test.TestCase.execute(TestCase.java:1203)
    at com.itko.lisa.test.TestCase.executeNextNode(TestCase.java:1188)
    at com.itko.lisa.editor.WalkThruPanel.prepAndExecNode(WalkThruPanel.java:1058)
    at com.itko.lisa.editor.WalkThruPanel.access$900(WalkThruPanel.java:71)
    at com.itko.lisa.editor.WalkThruPanel$10.doCallback(WalkThruPanel.java:965)
    at com.itko.util.swing.panels.ProcessingDialog$2.run(ProcessingDialog.java:194)
    at java.lang.Thread.run(Unknown Source)

     

    When I manually kept this updated XML string in the VSI , the copy book is able to parse it and generate the fixed length response. Not sure what is that I'm missing.

     

    Any help is much appreciated.

     

    Regards,

    Shivakumar.



  • 2.  Re: Run time Updation of the mainframe response

    Posted Dec 28, 2017 05:02 AM

    Hi Listeners,

     

    Any ideas please. 

     

    Regards,

    Shivakumar.



  • 3.  Re: Run time Updation of the mainframe response

    Posted Jan 02, 2018 09:49 AM

    Hi All,

     

    I Could able to fix the issue but ran into one more.

     

    As I'm parsing the xml format of the response using the DOM parser, I have a specific node value which I need to retrieve and convert into an integer which I will use subsequently. The argument is as below.

     

     <NUM-PRODS left-pad-length="0" origin-length="5">{{=request_Body_INPUT_MESSAGE_NO_OF_OCCS;/*00001*/}}</NUM-PRODS>

     

    I'm using something like this.

    Node Grp = doc.getElementsByTagName("NUM-PRODS").item(0);
    Value = Grp.getTextContent().trim();
    testExec.log(Value);
    int Cnt = Integer.parseInt(Value);

     

    this is throwing the below exception:

     

    Target exception: java.lang.NumberFormatException: For input string: "00001"

     

    instead if I replace the magic string with the value in the response with hard coded value or If I uncheck the magic string check box in the request for the request argument in the magic string, the code is able to convert the string value to integer.

     

    Not sure what exactly the issue. Any advice is much appreciated.

     

    Regards,

    Shivakumar.



  • 4.  Re: Run time Updation of the mainframe response
    Best Answer

    Posted Jan 03, 2018 07:22 AM

    Finally, I could able to get around with the above issue as well.  I used the below line to capture the response from the response selection step.

    testExec.parseInState( lisa_vse_response.get(0).getBodyAsString() ) );  instead of testExec.getStateValue("lisa.vse.response").get(0).getBodyAsString();

     

    This has help me to substitute the magic string data which fixed the type casting exception. thanks to Joel Nesmith  (How to take a VSI matched response and turn it into a new request? ) post.

     

    Regards,

    Shivakumar.