Service Virtualization

  • 1.  Help on Match a Response Parameter

    Posted Sep 24, 2018 08:36 AM

    Hi community,

     

    I`ve a question on how to match an parameter inside a operation.

     

    Scenario:

    The operation on the image below has 4 parameters on the request. The last one is that matters for us to match the response.

    The problem is, I have the whole string inside, as example:

     

    "<PROPOSTA><NOMEPROPONENTE>Victor Silva</NOMEPROPONENTE><NOMEMAE>Rita</NOMEMAE><DOCUMENTO>60599769050</DOCUMENTO><TIPODOCUMENTO>1</TIPODOCUMENTO><UFEXPEDICAOCPF/><DATANASCIMENTO>19911121</DATANASCIMENTO><LOGINSOLICITANTE>ShopSP2</LOGINSOLICITANTE><CANAL>SH</CANAL><NOMECANAL>ShopSP</NOMECANAL><DDD/><TIPOPEDIDO>PR</TIPOPEDIDO><CNPJLOJA>84074504172788</CNPJLOJA><CPFVENDEDORLOJA/><SCOREMEC/><TIPODOCPJ/><DOCUMENTOPJ/><RAZAOSOCIAL/><FUNDACAO/><NOMESOCIO/><TIPODOCSOCIO/><DOCUMENTOSOCIO/><CEPEMPRESA/><QTDFILIAIS/><QTDSOCIOS/></PROPOSTA>"

     

    The only parameter that matters to me is the "<DOCUMENTO>", Or that I want to use to match an response. 

    Is there a way to only pick that parameter, instead of the whole string ? Using Match Script or something else ?

    Thank you,

    João Paulo Ramos



  • 2.  Re: Help on Match a Response Parameter

    Broadcom Employee
    Posted Sep 24, 2018 08:57 AM

    Hi João,

     

    There are a number of ways to deal with this. The most straightforward would be to set the Comparison Operator to "Regular Expression" and then test for the value:

     

    .*<DOCUMENTO>60599769050</DOCUMENTO>.*

     

     



  • 3.  Re: Help on Match a Response Parameter

    Posted Sep 24, 2018 01:01 PM

    Hi Danny,

     

    I tried this but got no successful result.

     

    Tks



  • 4.  Re: Help on Match a Response Parameter
    Best Answer

    Broadcom Employee
    Posted Sep 24, 2018 09:10 AM

    Then the cleanest, most "non-technical" virtual service image could be attained by:

     

    • A add a Generic XML Payload Parser
      • Whereby you read from Argument DataFlux_Item_4
      • And Query for the DOCUMENTO element in the xml payload
      • And Set an Argument with Name DOCUMENTO  with that value
    • And then add a RDM DPH whereby you
      • delete all DataFlux_Item_* parameters

     

    Hope this helps,

     

    Cheers,

    Danny