Service Virtualization

 View Only
  • 1.  Parse or Extract Value from HTTP Header

    Posted Oct 28, 2020 02:33 PM
    I am using a Request Data Protocol Filter to copy a header value to argument.  I am using the full value of the header in a header on the response. 

    I also need to extract part of this value 'TA00998'  to be used in a different header.  Any thought on how I do this.  I have tried a scripted assertion as well as but it is not working.  The value will look similar to this:

    headervalue = Fault_/V1/invalid/app/id/TA00998
    headercode = TA00998


    ------------------------------
    Thanks,
    TAM
    ------------------------------


  • 2.  RE: Parse or Extract Value from HTTP Header

    Broadcom Employee
    Posted Oct 28, 2020 02:44 PM
    You can capture the value TA00998 to a property using "Create Property Based on Surrounding Values" filter in VSM-->Listen step.

    Documentation on the filter is available at https://techdocs.broadcom.com/us/en/ca-enterprise-software/devops/devtest-solutions/10-6/reference/filter-descriptions/utility-filters/create-property-based-on-surrounding-values.html



  • 3.  RE: Parse or Extract Value from HTTP Header

    Posted Oct 29, 2020 08:40 AM
    Is this available in 10.5?


  • 4.  RE: Parse or Extract Value from HTTP Header

    Posted Oct 28, 2020 11:27 PM
    Hi Tamika,

    You can use the approach suggested by Prema or use script (substring- as i assume the length of headercode will remain constant) to extract the exact expected value from the retrieved value.

    Thanks

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



  • 5.  RE: Parse or Extract Value from HTTP Header

    Posted Oct 29, 2020 08:40 AM
    Where would you add this substring?


  • 6.  RE: Parse or Extract Value from HTTP Header

    Posted Dec 10, 2020 10:34 AM
    Edited by Rahul Verma Dec 10, 2020 10:46 AM
    After extracating header value in a proeperty . Add a Execute javascript step anywhere after step where proeprty is extracted and before imageresponse selection step .
    In Script get header value from proeprty using testexec . 
    Assign that value to a string variable and you can play around the string using any string methods and once done assign that to a propety and place that property in response header in VSI (Respective transaction(s))

    ------------------------------
    Regards
    Rahul V
    ------------------------------