3 Ways to Get Started with CloudPort – Using WSDL
As part 3 in this series. In the first we captured a service using CloudPort’s proxy feature, and in the second we created a service copying and pasting mostly. In this tutorial we use a SOAP service that has WSDL. SOAP services currently differ from REST based service in that they include WSDL that defines the structure and parameters if the message header and bodies. In this case, I will use the simple temperature convert SOAP service.
1. Start CloudPort and select Build Simulation. In the Capture WSDL bar enter the URL followed by ?wsdl or in our case paste
http://www.w3schools.com/webservices/tempconvert.asmx?WSDL
2. Change the Network Listener Policy – in my case I just changing the port to 8888 and will leave it on local machine, and commit.
3. Now we can define any specific Request or Response values. You could build a VB script or create a random variable or any of a number of ways to match requests responses. In this case, our test coverage is 3 values.
- 0 Fahrenheit response expected -17.7777777777778
- 72 Fahrenheit response expected 22.2222222222222
- 100 Fahrenheit Response expected 37.7777777777778
So lets start by cloning the FahrenheitToCelsius simulator 3 times and renaming it 0, 72, 100
4. Now we need to change the rules for inbound documents. The default rule recognizes any value. Right click on the actual value and select Add XML Element Value Criteria, Contains Value for each of the 3 cloned services.
5. Now selecting the rule allows for entering the value. Enter 0, 72, 100 in each of the clones services and Exact Match.
6. Now Select the Response tab, and enter the desired response value for each of the 3 clones simulators.
7. If you want to test Celsius to Fahrenheit you can repeat this process.
8. Now launch your created simulation by selecting the green arrow icon Start Local Simulation. The Free Simulation player will launch and show you the URI and rules available. Select Copy Generated WSDL to Link icon. This is the listener we set up in step 2.
9. In SOAPSonar now, paste that WSDL link into the Capture WSDL field and the 2 services are shown in the project tree.
10. Test the 3 services listed in point 3 now. Do you get the expected response?