One request and two responses in a HTTP/S Virtual Service

book

Article ID: 127961

calendar_today

Updated On:

Products

CA Application Test CA Continuous Application Insight (PathFinder) Service Virtualization

Issue/Introduction

Our requirement is to have an asynchronous HTTP/S virtual service that receives a incoming request and sends two responses to different endpoints.

How can this be accomplished?

Cause

N/A

Environment

All supported DevTest releases and platforms/

Resolution

Some considerations when working on the with a HTTP Virtual Service.

With HTTP/S we cannot have one request and two responses.

Once the client application receives the response the connection is closed, it doesn't stay in listening mode waiting for a second response.

With Messaging that is possible, a queue will be listening all the time and you can publish messages in the queue whenever needed.

To accomplish this request we built a VSI that contained the request and response pair provided by the customer. This would cover the first response.

The client application sends one request and the virtual service sends the matching response.

For the additional response, a Web Service step was added to the VSM after the HTTP/S Respond step. 

This Web Service step was sending the additional response provided by the customer to the different endpoint.

The response was provided under the Request Editor in this test step.

Since this test step does not receive a response, the Call Timeout in the Advanced tab was modified to 10ms and the action under 'On Error', it was changed from Abort the Test to go to HTTP/S Listen. In this case, instead of failing with timeout, the virtual service goes back to the Listen step.

With the Web Service step after the HTTP/S Respond step, we were able to configure the virtual service to send the additional response to the different endpoint.