This guide will offer a detailed explanation of mock services. It will enable you to understand:
- What mock services are and their importance
- How to form a mock service in SOAPUI
- An overview of mock operation and dynamic mock response
- A demonstration of mock operation and dispatch methods
- How to apply scripting for mock response
Key Takeaways:
Understanding Mock Service:
Forming a mock service facilitates the simulation of a response to a web service inquiry. This mechanism is particularly useful for offline testing and review of web services during software development.
Recommended IPTV Service Providers
- IPTVGREAT – Rating 4.8/5 ( 600+ Reviews )
- IPTVRESALE – Rating 5/5 ( 200+ Reviews )
- IPTVGANG – Rating 4.7/5 ( 1200+ Reviews )
- IPTVUNLOCK – Rating 5/5 ( 65 Reviews )
- IPTVFOLLOW -Rating 5/5 ( 48 Reviews )
- IPTVTOPS – Rating 5/5 ( 43 Reviews )
For additional details, browse through our selection of highly-rated SoapUI guides
The procedure for constructing a project using a WSDL web service and generating a mock service is presented in the following steps:
We will use a sample WSDL for simplicity in this guide:
#1) Establish a SOAP project using this WSDL:
http://www.webservicex.com/globalweather.asmx
(Note: Click on any picture for a bigger view)
#2) Right-click on the project designation and pick the ‘Generate MockService’ option.
#3) In the MockService dialog box, you have the option to change the port number and host name.
#4) A default reply is generated in the Mock Service.
#5) Commence the mock service.
#6) Leverage a browser to access the WSDL service.
#7) The browser will display the WSDL of the mock service:
#8) Duplicate the WSDL service URL and utilize it as the New EndPoint for sending a request to the mock service.
#9) Submit a request to the recently added endpoint to get a response from the Mock Service.
Mock Operation and Dynamic Mock Responses:
When the mock service accepts a request, it sends it to the mock operation. The mock operation subsequently selects the appropriate response from a list and returns it to the web service.
1) You can increase the number of mock responses and set up a dynamic response as per the request/query, or dispatch a response in sequence or at random.
2) To incorporate a fresh mock response, right-click on the mock operation and select “New Mock Response”.
3) Configure the New Mock Response to construct a soap fault response if required.
4) Double-clicking on the mock operation opens the configuration panel, which presents options for forming dynamic responses.