Service Virtualization

  • 1.  Create json response from jdbc query/dataset

    Posted Mar 12, 2018 07:38 AM

    Hello All,

     

    We are trying to create a json virtual service using data from database.

     

    We thought about differents ways :

    - using "SQL database execution" step, but we were not able to use the result on the next step (on workstation, testing SQL is working, testing filter is working, but on VSE the result is not available in "Virtual https responder" step)

    - using "Read Rows from a JDBC Table" step (as described here : Hi, I need to capture JDBC result set into variable ), we need to implement/test it

    - using "XSL transformation" as described here Perform JDBC Query to JSON Response but we didn't found the "XSL Transformation assertion"

     

    What is the best way to achieve our aim ? Is there any tutorial available ?

     

    Thanks.

     

    Benoit



  • 2.  Re: Create json response from jdbc query/dataset
    Best Answer

    Posted Mar 12, 2018 10:01 AM

    If I were to take a guess, I would think that your first approach would be best, and that the results are not available to the respond step since that step expects a "transient response" which is a complex object.

     

    A serialised view of this object resembles the one documented here - 

     

    <linked-list>
    <com.itko.lisa.vse.stateful.model.TransientResponse>
       <metaData>
          <p key="HTTP-Response-Code" value="200"/>
          <p key="HTTP-Response-Code-Text" value="Invalid Request Error"/>
          <p key="Date" value="Mon, 22 Mar 2010 12:33:25 GMT"/>
          <p key="Server" value="Lisa virtual server 5.0"/>
          <p key="Content-Type" value="text/xml; charset=utf-8"/>
       </metaData>
       <thinkTimeSpec>1</thinkTimeSpec>
       <isBinary>false</isBinary>
       <body>
    <![CDATA[{{flLiveResponse}}]]>
       </body>
    </com.itko.lisa.vse.stateful.model.TransientResponse>

    </linked-list>

     

    Alternatively, you may find the information in the thread How to manually set property "lisa.vse.response"? to be of use.



  • 3.  Re: Create json response from jdbc query/dataset

    Posted Mar 12, 2018 11:09 AM

    We made one step forward, using the first approach and your advice : now we have a VS which can provide some of the rows in database.

     

     

    Now, for parsing xml from JDBC step, is there a filter ? Or should I use script/java custom step to do it ?



  • 4.  Re: Create json response from jdbc query/dataset

    Posted Mar 12, 2018 11:22 AM

    We have a set of XML filters that you can run on a property - 

     

     

    Are these of any use?