Service Virtualization

Expand all | Collapse all

How should I get the response from virtual service if request changes?

  • 1.  How should I get the response from virtual service if request changes?

    Posted 09-25-2018 05:58 PM

    Hi, This issue i'm facing quite long.

    Implemented virtual service using below request.

    VSrequest:

    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
    <ns4:process xmlns:ns2="***" xmlns:ns4="***" contentType="application/json" encoding="charset=utf-8">&lt;![CDATA[{"request":{"id":"600570075"}}]]&gt;</ns4:process>
    </soap:Body>
    </soap:Envelope>

     

    But service got updated and added new attributes in the request.

    API-VSrequest:

    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
    <ns4:process xmlns:ns2="***" xmlns:ns3="***" xmlns:ns4="***" contentType="application/json" encoding="charset=utf-8">&lt;![CDATA[{"request":{"id":"600570075","hpc":["abc","def","god"],"includeOLAAccountsOnly":false}}]]&gt;</ns4:process>
    </soap:Body>
    </soap:Envelope>

     

    My Virtual service has to provide response based on id attribute only not other. when I consumed my virtual service in my application,  got the request to my virtual service as API-VSrequest. So virtual service is not providing exact response. Usually what i will do if any changes happened in service, i'll reimplement service again. Please suggest me solution for this issue. How should I get the response from virtual service if request changes?



  • 2.  Re: How should I get the response from virtual service if request changes?

    Posted 09-26-2018 08:34 AM

    Hi Swathib,

     

    VSrequest and API-VSrequest are not ordinary SOAP requests, except for the SOAP operation name, in this case “process” there is no further XML data in the Soap Body which can be used for arguments. Instead, the rest of the payload is a JSON structure.

     

    So, I am assuming that your virtual service has various data protocol handlers defined and as such in the .vsi file you see a transaction with operation “process” and which has one argument called “id”.

     

    If you want the argument “id” to be the only argument that is always to be used to do matching then you need to add a Request Data Manager data protocol to the Listen Step and you need to define a rule “ ‘Keep’ ‘Argument’ ‘id’ “. With this for any incoming request all the arguments will be deleted and the Request object at runtime will only have the “id” argument when it is presented for matching against the transactions defined in the .vsi

     

    Cheers,

    Danny



  • 3.  Re: How should I get the response from virtual service if request changes?

    Posted 09-27-2018 03:48 PM

    Thank you Danny for your suggestion.When I apply 'keep' rule to my argument i'm getting response from virtual response if request attributes changes.