1) Web Service Mocking
Now, let's see how you add a MockService.
Introduction
Web Service Mocking is way to fake or simulate the functionality of a Web Service in soapUI; to create a Mock Up. But why do you need such functionality?
Web Service Mocking is very useful in projects where implementation of the Web Service has not started or is not finished for use yet or where you for some other reasons can't access the Web Services live.
In other words, Web Service Mocking makes it possible for you to start creating test for a Web Service the same time you start to develop the same Web Service. This means, when the real Web Service is ready for testing; you can already have the tests done. This can be extremely powerful and will make it possible to work according to Test Driven or Agile Methodologies.
In soapUI you can create a MockService simply by choosing to add a Web Service Request to a MockService in order for the MockService to listen to it. Or you can even right-click the Interface Icon and choose "Generate MockService", which will generate a MockService containing each defined response in the Interface.
Tutorial
- To add a MockService, right click on the interface icon and select Generate MockService.

- The Generate MockService dialog will open.
- Enter the name of your MockService and click OK.

Note: You will receive a Composite Warning if you have two mockservices with the same name. - The MockService will now be successfully generated.

You can then choose how to Respond to the Request and choose how to Dispatch (send out) different responses. - Now, let's take a look at how the Mock Service works. There is a SampleServiceSoapBinding Mock Service already in the Sample Pro Project, so if you followed the steps above, please discard what you've created or move to the SampleServiceSoapBinding MockService. Open the MockService by double clicking on it.

- Browse through the different Interfaces in the MockService; login, logout, search, and buy, and see what we do with different requests. As you see all the requests are dispatched using scripts. This is by far the most common way of dispatching, but early on in a project you might just want to create a set of responses and dispatch them in sequence or at random.
- Click on the Run button
to start the MockService. - You should now see the MockService running on port 8088.






