Prem's suggestion means adding a new step into Service A. Your Service B will need a VSM capable of handling the incoming response from Service A as input not the original incoming request into Service A. If the latter, there would be no need for Service B.
When you get the response from Service A's VSI selection step,
- Save the response value off into a property. For example, using a Scripted Assertion you could:
// parse in state is used in case you have magic string data that needs to be substituted
// get body as string gets the response body from the first lisa_vse_response which is a List object
// set state value places the response in a property name of your choice
testExec.setStateValue("theResponse", testExec.parseInState( lisa_vse_response.get(0).getBodyAsString() ) );
return true;
And, change the Assertion to only fail when the return is false.
Add a new WebService Execution step after the VSI Selection step. CLICK VS Image Selection, RIGHT CLICK, Add WS Exec... Step. In this step,
- make the request body equal to your {{theResponse}} and
- call Service B's endpoint.
You might also have to develop a base path or you could use "/" for the call so Service B accepts all incoming requests.
In Service B, the response from Service A is the input or incoming request, so take care of the mapping accordingly using your favorite DPH(s).
- Inside the WebService Execution step in Service A, Filter the response from the call to Service B into a filter property (theResponseFromB) and
add another Scripted Assertion to this step to set the response into Service A's response. For example,
lisa_vse_response.get(0).setBody( testExec.getStateValue("theResponseFromB") );
return true;
And change the Assertion to only fail when the return is false.
Then, let Service A respond using its Responder step. lisa_vse_response body will contain Service B's response.
Pardon typos in the above example.
Also, you might want to set Service B's VSI response Think Time to 0 and let the Think Time provided by Service A's VSI selection prevail. Otherwise, you will incur two think times. One in Service A waiting for the response from Service B and another when Service A replies to the SUT with the final response. You might not want the added Think Time.