Using SoapUI to help build a simple Web Service

Create the XML using SoapUI

Before digging in, let’s review what we are about to do…

One of the cooler web service sites on the Internet is the publicly-available ‘WebservicesX.net’. This offers a host of services, including things like stock quotes, currency conversion, and language translation. The web service that we’re interested in is the temperature conversion tool, as it can convert between various temperature scales (such as Fahrenheit, Celsius and Kelvin).

Using SoapUI, we will create a new project and then inspect the Temperature Convert WSDL that defines this service’s contract (bindings, port types, schemas, etc…). Next, we use SoapUI’s ability to inspect the service’s request XML to copy and pasted it into our own Iguana channel. This channel can then use the XML to convert a message’s temperature value from Fahrenheit to Celsius.

Before You Start

If you haven’t got it already, download and install the latest version of SoapUI.

Note: For other operating systems besides Microsoft Windows, please visit SoapUI’s ‘Getting Started‘ section for detailed instructions.

How It Works

Now that we have SoapUI installed and configured properly, it’s time to start creating the temperature conversion web service!

  1. Launch SoapUI.
  2. From the File menu, choose New SoapUI Project. The New SoapUI Project window appears:
  3. As shown above, fill out the following fields with the values indicated:
    • Project Name = Convert Temperature
    • Initial WSDL/WADL = http://www.webservicex.net/ConvertTemperature.asmx?WSDL
    • Create Requests check box = enabled
    • Click OK. The Convert Temperature project is created in the SoapUI main window.
  4. In the Projects tree on the left, double-click the ConvertTemperatureSoap binding entry. Its corresponding summary window appears on the right:
  5. In the summary window, click the WSDLtab to view the WSDL information:In this case, we can see that the web service is expecting enumerated values of “TemperatureUnit” to convert from one type of temperature to the another. For example, going from Celsius to Fahrenheit would be done by using the enumerated values “degreeCelsius” and “degreeFahrenheit’.
  6. In the Projectstree, click to expand the operation ConvertTemp:
  7. Double-click Request1to open a window containing the XML request that this web service is expecting:
  8. Copy the XML. We will paste this into our Iguana channel in the next step.

2 Comments

Leave A Comment?