Service Virtualization

 View Only
  • 1.  Request PUT - Match using body property

    Posted Aug 12, 2020 08:59 AM
    Hello everyone.
    I'm having a problem matching a request to a response.
    The match must be done through a property called "contactNumber" that is passed in the request body. The request is of the PUT type.
    I am configuring the VSI file to match through the "contactNumber" property with the same value.
    However, the match is never made and the service always tries to return the response from the real service. When removing the body from the request the response returns from the virtual service.
    Can someone help me? Below is a print of the VSI file.

    put request


    ------------------------------
    Matheus Souza
    Capgemini-BR
    ------------------------------


  • 2.  RE: Request PUT - Match using body property
    Best Answer

    Broadcom Employee
    Posted Aug 12, 2020 11:39 PM
    Hi Matheus,
    To match data from request body, while creating the virtual service you need to filter the "contactNumber" from requestbody and add as an argument.

    If request body is of xml content, one way to do this is filter "contactNumber" using Xpath. For this, Add "Generic XMLPayload parser" as a Request DPH and in next screen, choose Xpath of contatctNumber from request body and set as an argument.


       By doing this, for all incoming requests, this DPH will filter contactnumber from request body and set to the argument. And then, you can apply match style in VSI file to get exact response based on argument.




  • 3.  RE: Request PUT - Match using body property

    Posted Aug 13, 2020 12:31 AM
    Hi Matheus,

    Could you please share a screenshot of your VSM also.

    Thanks

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



  • 4.  RE: Request PUT - Match using body property

    Posted Aug 20, 2020 01:17 AM
    This looks like an issue in routing in VSM. Please cross verify in vsm that after receiving request, on what basis you are directing the flow to live system or virtual services. Usually it would be like if live system is available then response will be returned from live services, if live system is not available or some error then respond from virtual services. Might be in your case, when request body is removed, live system must be throwing error which is why system is being redirected to virtual services. So it's more like how vsm has been configured. Please inspect the route your transaction is taking.

    ------------------------------
    Regards
    Sonali
    ------------------------------