Service Virtualization

  • 1.  Pass the header value from the request to response in virtualization

    Posted Mar 22, 2018 06:12 PM

    Hi,

     

    A real request from a application to VSE contains a header "Origin : ***.***.***.***:xxxx".  This value changes from where the app is running from. I want to extract that value from the request header and pass it alongwith my response header. I'm not getting a way around this. Please help.

     

    My sample lisa.vse.request : 

     

    Request {id=0, operation="POST /cars/inventory", arguments=, attributes=HTTP-Segment-Attr-0=cars&HTTP-Segment-Attr-1=inventory, metaData=HTTP-Method=POST&HTTP-URI=/cars/inventory&HTTP-Version=1.1&cache-control=no-cache&Postman-Token=ae8e3d6b-88d0-436d-8db7-149195194cf6&Origin=localhost:8701&User-Agent=PostmanRuntime/3.0.9&Accept=*/*&Host=***.***.***.***:xxxx&accept-encoding=gzip, deflate&content-length=0&Connection=keep-alive&lisa.vse.request.client.id=127.0.0.1:62902&matchedRule=not found, matchTolerance=Exact, binary=false, body=(non-binary)[0 bytes] <null>}

     

     

    J_NeSmith

    monika_mehta



  • 2.  Re: Pass the header value from the request to response in virtualization
    Best Answer

    Broadcom Employee
    Posted Mar 22, 2018 06:55 PM

    To extract the value from request header you can use one of two approaches:

     

    1. Use Request Data Manager DPH  to copy the value of Origin from metaData to the list of arguments.

     

    https://docops.ca.com/devtest-solutions/10-2/en/using/using-ca-service-virtualization/using-devtest-workstation-with-ca-service-virtualization/creating-service-images/using-data-protocols/request-data-manager-data-protocol

     

    or

    2. Use a XML xpath filter to extract the value of Origin from lisa.vse.request (assuming your model is of More Flexible type)

     

    https://docops.ca.com/devtest-solutions/10-2/en/reference/filter-descriptions/xml-filters/xml-xpath-filter

     

    In the first case, assuming the argument name is incomingOrigin, its value will be available as request_incomingOrigin that can be used in response. You may need to change the Comparison Operation to Anything for this argument as this will be a synthetic argument added to be used in the response.

     

    In the second case, the name of property used to store the xpath filter would have the value to use in your response. 



  • 3.  RE: Re: Pass the header value from the request to response in virtualization

    Posted Dec 10, 2020 11:54 AM
    Hi,

    I am not able to open above link.
    https://docops.ca.com/devtest-solutions/10-2/en/using/using-ca-service-virtualization/using-devtest-workstation-with-ca-service-virtualization/creating-service-images/using-data-protocols/request-data-manager-data-protocol

    It is directing me to https://techdocs.broadcom.com/


  • 4.  RE: Re: Pass the header value from the request to response in virtualization

    Broadcom Employee
    Posted Dec 10, 2020 11:57 AM

    this is the latest document.
    Using DevTest Workstation with Service Virtualization (broadcom.com)



    ------------------------------
    Gene Howard
    Principal Support Engineer
    Broadcom
    ------------------------------



  • 5.  RE: Re: Pass the header value from the request to response in virtualization

    Broadcom Employee
    Posted Dec 10, 2020 12:02 PM
    Check the information at https://techdocs.broadcom.com/us/en/ca-enterprise-software/devops/devtest-solutions/10-6/using/using-service-virtualization/using-devtest-workstation-with-service-virtualization/creating-service-images/using-data-protocols/request-data-manager-data-protocol.html



  • 6.  RE: Re: Pass the header value from the request to response in virtualization

    Posted Dec 11, 2020 01:04 AM
    Hi Ankit,

    You can refer to Request Data Protocol section in any recent version user guide for CA Devtest for this.

    Thanks

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