Hi all, in this post I will explain you how to create a mock service to mimic a SOAP backend using SOAP UI. It is really easy and straight forward to do. In order to make things super easy and simple I'll be using WSO2 ESBs echo service as the base service (Just to create the structure of the service). Or you can use any existing SOAP service as you wish.
1. Login to WSO2 ESB and navigate to to Service ==> List and click on WSDL 1.1 link of the echo service and copy the URL of the WSDL. e.g: http://localhost:8280/services/echo?wsdl
2. Now Open SOAP UI and Click on File menu and select New SOAP project, now add the copied WSDL URL as shown below and click on OK.
3. Now the Project will be created. Now right click on echosoap service and select New SOAP Mock Service.
4. Now you can select the necessary operations and define the context path of the SOAP service you are creating. After changing the fields click on OK.
5. Now if you click on any of the operations you can customize the WSDL Operations and Name and the Description.
6. Now in-order to specify the response you need to send to the client, click on the Response 1. It will open a new window. You can add the Intended response body. Refer the below image.
7. Now double click on the Mock Service and click on the green arrow to start the Mock Service.
8. After starting the mock service you can test it by changing the endpoint of the echo service as shown below. As you can see it will give you the expected output.
There are advance features included in SOAP UI where you can script and do complex customization to the mock service. You can play with these and see what can be done.
Hope this will help someone interested. Please drop a comment if you have any queries.
1. Login to WSO2 ESB and navigate to to Service ==> List and click on WSDL 1.1 link of the echo service and copy the URL of the WSDL. e.g: http://localhost:8280/services/echo?wsdl
2. Now Open SOAP UI and Click on File menu and select New SOAP project, now add the copied WSDL URL as shown below and click on OK.
3. Now the Project will be created. Now right click on echosoap service and select New SOAP Mock Service.
4. Now you can select the necessary operations and define the context path of the SOAP service you are creating. After changing the fields click on OK.
5. Now if you click on any of the operations you can customize the WSDL Operations and Name and the Description.
6. Now in-order to specify the response you need to send to the client, click on the Response 1. It will open a new window. You can add the Intended response body. Refer the below image.
7. Now double click on the Mock Service and click on the green arrow to start the Mock Service.
8. After starting the mock service you can test it by changing the endpoint of the echo service as shown below. As you can see it will give you the expected output.
There are advance features included in SOAP UI where you can script and do complex customization to the mock service. You can play with these and see what can be done.
Hope this will help someone interested. Please drop a comment if you have any queries.
0 comments:
Post a Comment