How to create a Virtual Service Model that needs to reach to 2 different live systems.

Document ID : KB000014575
Last Modified Date : 14/02/2018
Show Technical Document Details
Question:

How to configure a Virtual Service Model (VSM) to reach to 2 different live systems in the same model.

Environment:
All supported DevTest versions.
Answer:

You could do it in different ways.

1. Create 2 different VSMs and VSIs and configure the live invocation step to reach different live systems. 

Each VSM can listen on the same port and have different base path. 

VSM1 - /AB1/base/path/abc/ 

VSM2 - /CD1/base/path/abc/ 

The VSI operations names would be different – following the base path above.

 

2. Customize your VSM to use 2 live invocation steps and the 'Compare Strings for Next Step Lookup' step.

In this case, if you have 2 VSIs, we first need to combine the two service images into one - Combine Service Images.

We also need to make sure the virtual service models DPH are updated to handle the incoming requests to the combined VSI. The unique VSM needs to have the proper DPHs under Virtual HTTPS Listener/ Filters.

The virtual service image in the example below was created against the DemoServer.

Service Image:

CompareStringsForNextStepLookupSI.PNG

 

In the VSM, add the step 'Compare Strings for Next Step Lookup' after the  'VS Image Response Selection'  step and add two 'Live Invocation' steps.

CompareStringsForNextStepLookup.PNG

Add new entries to the 'Compare Strings for Next Step Lookup' step: 

CompareStringsForNextStepLookupAddNewEntry2.PNG

1.In the 'Text to match:' field I provided the response of the 'Virtual HTTPS Listener' - {{lisa.Virtual HTTPS Listener.rsp}}. The step that receives the incoming request.

2.The 'Criteria' and 'Compare Type' fields are the ones that will do the comparison. 

3.The 'Next Step' field will be the step that will be executed when the match is found.

In the example above the step will first look for the string 'GET /itko-examples/user-manage.jsp/' in the 'lisa.Virtual HTTPS Listener.rsp' property. When this string is found, the request is forwarded to 'Virtual HTTPS Live Invocation 2' step. If the 'GET /itko-examples/' string is found, the request is forwarded to the 'Virtual HTTPS Live Invocation 1' step.

4.If no match is found the next step will be the ‘Virtual HTTPS Responder' step.

In the live invocation steps, set the 'Virtual HTTPS Responder' as the next step.

Additional Information:

More details regarding 'Compare Strings for Next Step Lookup' step can be found in the product documentation: Compare Strings for Next Step Lookup Step.