I have a method that calls multiple webservices in it.

When I implement a mock webservice how does it tie that mock webservice to the actual web service it is mocking?

Is it possible to create multiple mock webservices in a class so each webservice callout will use the corresponding mock webservice?

This article is what I'm working from.

1 Answer 1


You should look into mocking the responses using MultiStaticResourceCalloutMock. It is designed to be a mechanism to provide different responses based on the URL that is requested during the test.

Essentially you reference a Static Resource which includes your various response payloads and you associate them to the URL that you're going to be making calls out to.

When your code calls the given URL, the MultiStaticResourceCalloutMock will respond with the payload from the Static Resource.

Related documentation

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .