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.
Step2: Check Create MockService checkbox to create a mock service during the project creation and click OK.
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.
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.
- 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.
Step 4: Clicking OK will prompt to specify the mockservice name. Enter a name and click OK as shown below.
Thus mock service is created successfully as shown below.
Note: In a mockservice you will find response instead of request which needs to hard-coded. This response will be used in another request.