Service Virtualization

Expand all | Collapse all

Generic/Dynamic Response Creation Using Copybook and DB data

  • 1.  Generic/Dynamic Response Creation Using Copybook and DB data

    Posted 01-16-2019 09:26 AM

    Dear CA Experts/Community Members,

    Can anyone please provide me any help  on creation of Dynamic Response Using Response Copybook and DB data in VSE if you had done something similar in the past?

     

    Regards,

    Manik



  • 2.  Re: Generic/Dynamic Response Creation Using Copybook and DB data

    Posted 01-16-2019 10:21 AM

    Hi Manik,

     

    Are you using DB step in VSM and querying some data and then use that in your response? If so, you can try creating filters on the query results and use the filters in your VSI response. 

     

    As you are using Copybook DPH, make sure you add the correct data otherwise your application mayn't receive the right response.

     

    If you need more help, you can open a support case and we can do a WebEx and look at the functionality what you are looking.



  • 3.  Re: Generic/Dynamic Response Creation Using Copybook and DB data

    Posted 01-17-2019 01:44 AM

    Hi Prema,

    Yes I will be using DB step in VSM and querying some data and then use that in my response  The response would be forming dynamically based on the based on the copybook definition.

    Could you please share me steps with screenshots on how I can achieve it ?

     

    Regards,

    Manik



  • 4.  Re: Generic/Dynamic Response Creation Using Copybook and DB data

    Posted 01-17-2019 02:38 AM

    Hi,

     

    These 2 requirements are not really related.

     

    If your payload is a fixed-length copybook then using the copybook response-side DPH (and request-side DPH) will allow you to manage your responses inside the virtual service image as an XML-structure. I.e. an XML-structure that is a representation of the data in your fixed-length cobol string.

     

    So, the solution breaks up into following steps:

    1. Configure your Copybook DPHs - the documentation is a starting point for this
    2. Replace the data elements inside the response-xmls which you want to populate dynamically with property definitions
    3. Add your DB step and filters, etc... to the VSM to populate the properties used in the dynamic response

     

    Cheers,

    Danny



  • 5.  Re: Generic/Dynamic Response Creation Using Copybook and DB data

    Posted 01-17-2019 02:58 AM

    HI Danny,

    Thanks for your valuable inputs. Just to be more specific here ... the response would be MQ response(stream of characters) and this I have to form dynamically in VSM step using the copybook definition for response and DB data which I fetch based on some query parameter in request.

    If you could advise your solution corresponding to the above requirement then it would be more helpful for me design my VSM steps.

    Regards,

    Manik



  • 6.  Re: Generic/Dynamic Response Creation Using Copybook and DB data

    Posted 01-17-2019 08:31 AM

    Unless I missed something, Danny's solution should still be OK for MQ. 

    Response-side copybook processing occurs prior to the message going onto the queue. This means that substitutions of data occur at the time the VSI XML representation of the copybook is converted back into a stream of characters that ends up on the queue. DevTest should process the response-side DPHs before handing control to the transport DPHs.  In this case, MQ is the transport. Unless you add some specialized logic, the 'magic strings' are replaced just prior to the transport class sending the response.

    I am more interested in the meaning of your comment "...VSM to populate properties in a dynamic response". If the data is dynamic (i.e., a {{magic string}} ), the above statements should be OK. If the response copybook definition is dynamic (meaning the logic needs to generate a variable number of copybook elements, fields, definitions, etc. at run time), you may experience issues in the Copybook DPH because it relies on Copybook mappings and Copybook definitions.