DevTest VS with a REST step using a URL with a dynamic base path
book
Article ID: 185420
calendar_today
Updated On:
Products
CA Cloud Test MobileCA Application Test
Issue/Introduction
How to create a Virtual Service stub that has an HTTP REST listen step with a parameterized base path.
Environment
Release : 10.3, 10.4, 10.5, 10.6
Component : CA Service Virtualization
Resolution
A good example of a dynamic base path in a Listen step with the REST DPH is the http-rest.vsm The example http-rest.vsm can be found in the 'Bank v5' project that is installed if the Demoserver is installed. Note the following: - In the HTTP/S listener step, Base path is configured as '/'. This is because the URL is parsed by the REST DPH. - Under Filters -> Data Protocol Filter, the URI Rules are shown. For example: GET /3/movie/{URLPARAM0}/ {URLPARAM0} indicates the parameter part of the URL - In the corresponding http-rest.vsi, the transactions are shown: For example: GET /3/movie/{URLPARAM0}/ In this case there are 5 responses for 5 specific values: 49047, 76338, 87421, 71679, top_rated - The Request Data, Arguments shows: URLPARAM0 = 49047 The = sign could be changed to the word 'anything' so it matches any value. - The Response 1 of 1 shows in the body: {{=request_URLPARAM0;/*49047*/}} The value of URLPARAM0 of the request can be returned in the response. This was because URLPARAM0 was ticked as magic in the request data.