SOAP UI – Create Mock Services
Let’s see how to mock a service in SOAPUI Beta (Open source version). Services can also be mocked in SOAPUI Pro using the same procedure.
Before you create a mock service, learn to create a project in SOAPUI using the previous tutorials.
Follow the steps to mock a service.
Step 1: You can create a mock service while creating a new project in SOAPUI using File –> New SOAPUI project as shown below in the image.
Create a mock service
Step2: Check Create MockService checkbox to create a mock service during the project creation and click OK.
(Or)
Step 1: You can also generate a mockservice for an already created project by right clicking on the project binding name and choosing Generate MockService as shown in the image below.
Generate mockservice from binding
Step 2: Clicking on that will open the Generate MockService dialog box as shown in step 3.
Step 3: In the Generate MockService window, choose the operations in the WSDL to be mocked and click OK.
Create a mock service
Note:
- The Path and Port for the mockservice will be specified automatically by SOAPUI. If you wish to edit the port and path, you can do it in this window.
- If you check on Start MockService, it will start the mockservice when you click OK.
Create a mock service
Step 4: Clicking OK will prompt to specify the mockservice name. Enter a name and click OK as shown below.
Create a mock service
Thus mock service is created successfully as shown below.
Create a mock service
Note: In a mockservice you will find response instead of request which needs to hard-coded. This response will be used in another request.