Service Virtualization

  • 1.  How to apply match script on incoming request?

    Posted Feb 09, 2016 05:24 AM

    Hi ,

     

    Below is the scenario:-

     

    • We have recorded two requests, request1 and request2. Both requests are part of same VSI and sharing same operation name.
    • Each request has separate response , so when incoming request is request1 then it should return only response1 also applies to request2.
    • Only way to differentiate between two requests is  , one argument i.e segRef_2 is  present only in request1 not in request2.
    • Based on that , We wrote match script under request1 , to validate if(count(segRef_2)!=0) then return true else return to request2.

     

    Could you please guide me on how  to redirect to request2 when match script returns false in request1.

     

    Thanks,

    Akshay



  • 2.  Re: How to apply match script on incoming request?

    Posted Feb 09, 2016 05:56 AM

    Hi Akshya,

     

    As there is a difference of just one argument, You can have 2 different request/ transaction for one operation. Response will be selected on the basis of signature.

    You don't need match script for this.

     

    Regards,

    Monika Mehta



  • 3.  Re: How to apply match script on incoming request?

    Posted Feb 09, 2016 06:19 AM

    Hi Monika,

     

    Forgot to mention that, In my case none of the match style is applicable . So I am trying with match script.

     

    String incomingValue = incomingRequest.getArguments().get("argumentName");

    if(incomingValue.equalsIgnoreCase("Text") {

        // true means these arguments match

    return true;

    else

    return to next request.

     

    I have to return control to next request i.e. request2. Could you please suggest me the correct syntax for the same.

     

    Thanks

    Akshay



  • 4.  Re: How to apply match script on incoming request?

    Posted Feb 09, 2016 07:32 AM

    Sure Akshay, i can guide you for match script but My concern is why it is not applicable with match style.

    If you will select match style as signature, it will validate the operation name and arguments both. So, If request has argument segRef_2 , then it will select corresponding response and vise versa.

     

    I don't see any issue in this.

    Please share the screenshot on my email id: monika.mehta08@gmail.com

    I can guide you more on that.

     

    Regards,

    Monika Mehta



  • 5.  Re: How to apply match script on incoming request?

    Posted Feb 09, 2016 07:57 AM

    Problem with Signature is , Signature of incoming request is not fixed. So when I apply signature as match style , it failed to match because match style didn't work.

    So none of match style is useful for me in this case. I will have to use match script to navigate through requests.

     

    Thanks,

    Akshay



  • 6.  Re: How to apply match script on incoming request?
    Best Answer

    Posted Feb 09, 2016 08:10 AM

    Alright. As It traverse to every request so In else section "return false". It will go to next request, Write same type of match script over there.

     

    If it will find no response from any transaction then it will send meta response.

     

    Hope that helps.



  • 7.  Re: How to apply match script on incoming request?

    Posted Feb 09, 2016 08:54 AM

    Short answer. If your match script returns false, DT will continue to the next entry in the VSI (top down order).

    if the match script returns true, then that entry is selected, and the search stops.



  • 8.  Re: How to apply match script on incoming request?

    Posted Feb 09, 2016 09:14 AM

    Hi,

     

    I did assume the same, but it doesn't seem to work like this.

     

    As per my understanding, we have to add match script again in next subsequent request to invoke request2.

    Only after the addition of match script in my next request i.e. request2 , service identified incoming request and returned me  response2.

     

    Correct me , if I am wrong on understanding.

     

    Thanks,

    Akshay



  • 9.  Re: How to apply match script on incoming request?

    Posted Feb 09, 2016 09:19 AM

    the match script overrides the normal signature matching rules.

     

    so, if the normal rules won't match, then you must add the match script to EVERY POSSIBLE response that you would need to select from..

     

    all I meant before is that false means continue checking the next possible response in order.

    normal rules unless a match script is supplied.