Service Virtualization

  • 1.  Multi and modified response for single request

    Posted Apr 24, 2017 10:48 AM

    Hi Team,

    I have a unique requirement where I send a single request to vsm this should then retrieve response from LISA where first response should be modified with some field values and need to get back original + modified response for single test I do. Also I have requirement to set the records for example 1000 then 1000 response should be returned with each responses unique. Below sample example of this requirement for 10 records.

     

    Example parameters and the response should respond with 10 records of the same structure with a field value changed in appended response to original. The response should have the same structure with field value change for name, age for 10 records in the response. Data returned back from append response is not a concern here.

     

    Protocol used Rest.

     

    Ex:

    Request:

    <?xml version="1.0"?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2001/12/soap-envelope" SOAP-ENV:encodingStyle="http://www.w3.org/2001/12/soap-encoding" >

    <SOAP-ENV:Body xmlns:m="http://www.xyz.org/quotations" >
    <m:GetQuotation>
    <m:QuotationsName>MiscroSoft</m:QuotationsName>
    </m:GetQuotation>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>

     

    Response:

    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2001/12/soap-envelope" SOAP-ENV:encodingStyle="http://www.w3.org/2001/12/soap-encoding" >

    <SOAP-ENV:Body xmlns:m="http://www.xyz.org/quotation" >
    <m:GetQuotationResponse>
    <m:name>Here is the name</m:name>

    <m:age>Here is the age</age>

    <m:***>Here is the ***</m:***>

    </m:GetQuotationResponse>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>



  • 2.  Re: Multi and modified response for single request

    Posted Apr 27, 2017 03:23 PM

    You can use Scriptable Data Protocol to modify the response. Use Magic String for value needed from request to response.

     

    Refer : Scriptable Data Protocol - DevTest Solutions - 10.0 - CA Technologies Documentation 

    Magic Strings - DevTest Solutions - 10.0 - CA Technologies Documentation 

     

    Hope that helps. 



  • 3.  Re: Multi and modified response for single request

    Posted May 02, 2017 06:11 AM

    Hi Monika,

     

    Thanks for taking time to reply. I had this solution in place as in scripting . But i wanted specifically what has to go in script for dynamic response for the same request all the time.

    yes, Magic string would be helpful based on any request to respond. I need the response to be different each time for the same request.

     

    Problem statement: suppose there are 100 addresses associated to a particular organisation. The UI shows only 40 at any particular instance. Now it has to request for others which are there. How to deal with such particular requests. looking for a solution for this requirement.



  • 4.  Re: Multi and modified response for single request
    Best Answer

    Posted May 02, 2017 09:39 AM


  • 5.  Re: Multi and modified response for single request

    Broadcom Employee
    Posted May 02, 2017 09:59 AM

    Another thing you might look at is the "allow duplicate specific transactions" functionality in the service image. You can have multiple responses to one request, and it will round-robin those responses



  • 6.  Re: Multi and modified response for single request

    Posted May 02, 2017 10:11 AM

    Hi,

    I think I understand your ask - which others have answered. However I am concerned by you method flow. You have one method.
    Request One - first set of records
    Request Two - the next set of records
    etc..

    Questions:
    How do you reset to the first set of records? How do you go back a set of records? How do you know how many more requests to make? How do you know when there are no more records to get?
    Will there ever be a need to make the response data "real" - if so, then I would invest in interfacing with an external datasource ASAP - maybe either a DataDriven VS or a custom DataProtocolHandler.
    Just thinking about how this project will grow and making it reusable.