Service Virtualization

Expand all | Collapse all

Disable META answer

Jump to Best Answer
  • 1.  Disable META answer

    Broadcom Employee
    Posted 08-16-2018 01:08 PM

    Hi team,


    I need to create a service in Stand In mode, that if there isn't any EXACT match, it goes to the real service. The operation just have one parameter. 


    When I send a specific request it responds well, but if I send another parameter, the META is answering. Is there a way to META NOT answer? 




  • 2.  Re: Disable META answer

    Broadcom Employee
    Posted 08-16-2018 01:31 PM

    Hi Francis,


    I've run into this, too.  The solution isn't baked into the product, but I wish it was.


    My solution was to add metadata to the META transaction response.  Something like "META=true".  Then, I had a script look for the presence of this value in the metadata of the selected response.  If it's there, go to Live Invocation.  If it's missing, send back the virtualized response.


    I have another idea that I haven't actually tried.  If you try it, please report back if it works.  How about a match script on the META transaction that just says "return false;"?  I'm guessing it doesn't work, but give it a shot.



  • 3.  Re: Disable META answer
    Best Answer

    Broadcom Employee
    Posted 08-16-2018 02:17 PM

    Hi Mike, 


    I talked with J_NeSmith and he sugested an assertion in the VSI Responder step. 


    var is_match = testExec.getStateObject



    return true;

    else  return false;


    This worked fine! 


    Thanks ALL!

  • 4.  Re: Disable META answer

    Broadcom Employee
    Posted 08-16-2018 02:27 PM

    Clever.  I never knew this way off determining if a response is a meta response.



  • 5.  Re: Disable META answer

    Posted 08-16-2018 04:19 PM

    Correction on the above -- I suggest adding the Assertion in the VSI Selection Step not Responder Step.


    In fairness, I had never tried it and Francis decided to be my guinea pig. 

    The shortcut way that might do the same -- now that Francis has proved this out would be a simple


    return ( testExec.getStateObject( "lisa.vse.matched.transaction" ) == null );

    I normally use the approach of setting the META response and asserting on it in the VSI Selection Step. 

    Like you, Mike, I have never attempted a Match Script approach so unclear as to how that would work.

  • 6.  Re: Disable META answer

    Posted 08-17-2018 01:01 PM

    Another way is to add a specific "HTTP header" for the META response, for example HTTP-Response-Code = 404. Or any other value, and then check the "meta data" aka http headers for the given response and if it matches 404 or any other meaningful error code you've assigned then you know it's a META response.