Service Virtualization

Expand all | Collapse all

How to map attribute in request xml to get response from the Results of Database

  • 1.  How to map attribute in request xml to get response from the Results of Database

    Posted 12 days ago
    Hi,
     I am new to Devtest workstation tool. I am using version 10.5. I have added dataset to pull data from Table. I am selecting Report_id from DB. If I replace the ReportId attribute present in response xml in 'Http Respond' step, and when I hit, I am getting response xml with Report_id value retrieved from DB. Upon further hits, it goes through all report_ids from the resultset. But what I want is, I want response xml with report id based on the attribute(Pan) present in request xml. How to achieve it ? How to do that mapping ? Please help. Attached files.

    Request:

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://XXX.com/sd/pc/service">
    <soapenv:Header/>
    <soapenv:Body>
    <ser:CreateVCNAuthsReportRequest
    FromDate="?" ToDate="?" Timezone="?"
    TransactionType="All" Pan="133"/>
    </soapenv:Body>
    </soapenv:Envelope>


    Response:

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <soapenv:Body>
    <CreateVCNAuthsReportResponse ReportId="12" xmlns="http://XXX.com/sd/pc/service">
    <!--attribute ReportId is optional-->
    </CreateVCNAuthsReportResponse>
    </soapenv:Body>
    </soapenv:Envelope>


  • 2.  RE: How to map attribute in request xml to get response from the Results of Database

    Broadcom Employee
    Posted 12 days ago
    You can create a filter on the PAN Attribute value and use that in your response. Here is how you can do that.
    . Run your VSM in ITR in the Workstation and send your transaction against it. Let the ITR finish i iteration and stop the execution.
    . In ITR, click on the Properties tab.  In the bottom of the properties tab, you should see an arrow(-->).
    . Click on the arrow and you should see a Properties window. In the Window, Select All and Export all the properties.
    . In VSM-->HTTP Listen step, right click and select XML Xpath filer. You should see the lisa.vse.request with VS request.
    . Select the PAN attribute value and give a name for the Filter, for example PAN.

    Then use the Filter {{PAN}} in your VSI-->Response.

    Hope the above information helps.

    Regards,
    Prema



  • 3.  RE: How to map attribute in request xml to get response from the Results of Database

    Posted 11 days ago
    Thanks for the steps you explained. I have 2 doubts.
    1. When I use Xpath filter, the value of lisa.vse.request property shows NODATA.
    2. Also When I run ITR test for VSM, it keeps executing. Not showing any response

    PFA files. Please help!


  • 4.  RE: How to map attribute in request xml to get response from the Results of Database

    Posted 11 days ago
    Hi,

    While testing it via ITR,
    --> Make sure you don't have the service as running on vse - it should be stopped
    --> As per the second screenshot, when you execute the service via ITR it starts listening, you have to trigger a request to the virtual service configuration separately so that the service will process it and proceed further.

    lisa.vse.request this property will be populated once you have the service executed, without a trigger it won't have any data.

    Thanks

    ------------------------------
    Regards,
    Vaibhav Jain
    Capgemini
    ------------------------------



  • 5.  RE: How to map attribute in request xml to get response from the Results of Database

    Posted 10 days ago

    Hi,

    After running a test in the ITR as descibed by Vaibhav, if you want to further design your VSM then export the needed properties (eg. lisa.vse.request, ...) to the VSM editor. To do so, in the ITR select the step for which you want to create filters and/or assertions, select the 'Properties' pane for that step, and at the bottom you find an 'export properties' button.

    Cheers,
    Danny
    ::DISCLAIMER::

    The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only. E-mail transmission is not guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or may contain viruses in transmission. The e mail and its contents (with or without referred errors) shall therefore not attach any liability on the originator or HCL or its affiliates. Views or opinions, if any, presented in this email are solely those of the author and may not necessarily reflect the views or opinions of HCL or its affiliates. Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of this message without the prior written consent of authorized representative of HCL is strictly prohibited. If you have received this email in error please delete it and notify the sender immediately. Before opening any email and/or attachments, please check them for viruses and other defects.






  • 6.  RE: How to map attribute in request xml to get response from the Results of Database

    Posted 7 days ago
    Thanks Premalatha for the solution


  • 7.  RE: How to map attribute in request xml to get response from the Results of Database

    Posted 11 days ago
    Hi,

    You can create a mapping for PAN and ReportID in your DB and then based on the incoming request
    1. Filter out the PAN from request using XPATH
    2. Fetch the relevant result set for respective PAN from DB
    3. Store the value of response element in property
    4. Use the property in response to have reportID as per the mapping configured

    Thanks

    ------------------------------
    Regards,
    Vaibhav Jain
    Capgemini
    ------------------------------



  • 8.  RE: How to map attribute in request xml to get response from the Results of Database

    Posted 7 days ago
    Thanks Vaibhav for your help. It works now


  • 9.  RE: How to map attribute in request xml to get response from the Results of Database

    Posted 6 days ago
    Also when I query my DB, it will return more than one transactions. But, response xml is formed for only first transaction return from DB. But expectation is, my xml response should be created by using all transactions something below. How to do mapping for this in response xml. Please help.

    Expectation:
    -----------------
    <reportId>123</report>
    <transactions>
        <transaction>    ----1
           <id>10</id>
           <name>Test</name>
       </transaction>
       <transaction>    ----2
           <id>10</id>
           <name>Test</name>
       </transaction>
    </transactions>


  • 10.  RE: How to map attribute in request xml to get response from the Results of Database

    Posted 6 days ago
    Hi Kaliappan,

    You can save the value of jdbc step i.e. lisa.JDBC.rsp in a file say testResult.xml using save property to a file filter. The result set will have all the rows returned but the column names will not be mapped.

    You can use xpath or db filters to create the mapping of column names and associated values.

    Thanks

    ------------------------------
    Regards,
    Vaibhav Jain
    Capgemini
    ------------------------------



  • 11.  RE: How to map attribute in request xml to get response from the Results of Database

    Posted 4 days ago
    Hi,
    I could not find the property  'lisa.JDBC.rsp' in the properties set of 'Http/s Respond' step. Also, the below
        <transaction>    ----n times depends on the number of result set from Data set
           <id>10</id>
           <name>Test</name>
       </transaction>

    How to construct the xml like this.



  • 12.  RE: How to map attribute in request xml to get response from the Results of Database

    Posted 4 days ago
    Hi Kaliappan,

    JDBC in lisa.JDBC.rsp is the stepname where jdbc call is made (sql database execution step). Example you have a step call query then you can seethe response of that step as lisa.<<stepname>>.rsp i.e. lisa.query.rsp in a property.

    You can use xpath to fetch the value of different columns from the step response and create the xml as expected. For predefined number of occurrences of rows, you can use multiple filters.

    Thanks


    ------------------------------
    Regards,
    Vaibhav Jain
    Capgemini
    ------------------------------