VLT-Website-Heading

How to test an xml WSDL endpoint using SOAP UI

Oct 14, 2019 2:51:15 AM / by Vu Long Tran

This is a brief guide if you are keen to learn how to test your WSDL endpoint using SOAP UI.

To start off with, what is WSDL?

What is WSDL?

WSDL is a "Web Service Definition Language" is an XML language for describing Web services. Specifically, it is defined by the industry body W3 - World Wide Web Consortium (W3C) organisation as the following:

Web Service Definition Language (WSDL) is an XML format for describing network services as a set of endpoints operating on messages containing either document-oriented or procedure-oriented information. The operations and messages are described abstractly, and then bound to a concrete network protocol and message format to define an endpoint.

W3.org
Source: https://www.w3.org/TR/wsdl.html#_wsdl

Okay, you may be thinking, that's great. So how do I test it?

Well I will show you how to test this WSDL using a free online web services endpoint that has been made available for testing. The WSDL and endpoint will be testing with is called the Holiday Web Service WSDL and I will be using a free version of an API endpoint testing software called, "SOAP UI" to show you how to test and engage with an WSDL endpoint.

About Holiday Web Service WSDL

The Holiday Web Service WSDL (HolidayService2 Web Service) is a free service that calculates holiday dates. Offered via their website at http://www.holidaywebservice.com/

HolidayService2 Web Service

Specifically, “HolidayService2” will be the version we will be using today. They have kindly created a bunch of operations or functions where you can to retrieve holiday dates based on a provided country code and date ranges.

We will also focus on the GetCountriesAvailable API call and will be notinng the following countries which are currently supported by their WSDL. (please note that you will need to have the exact text exact wording to generate a result). That is:

  • United States - UnitedStates
  • Great Britain & Wales - GreatBritain
  • Northern Ireland - IrelandNorthern
  • Republic of Ireland - IrelandRepublicOf
  • Canada - Canada

From a system perspective, this is what is set in their WSDL.

<countryCode>Canada or GreatBritain or IrelandNorthern or IrelandRepublicOf or Scotland or UnitedStates</countryCode>

Manually check if the output is correct

At any time, you can also confirm output using this page, where you can check the public holidays - http://www.holidaywebservice.com/ServicesAvailable_HolidayService2_HolidayCode-Object.aspx

HolidayService2 Web Service operations

The team that created Holiday Web Services also offer other operations, these include: 

  • GetCountriesAvailable - Get the available countries
  • GetHolidayDate - Get the date of a specific holiday
  • GetHolidaysAvailable - Get the available holidays for a specified country
  • GetHolidaysForDateRange - Get the holidays for a date range
  • GetHolidaysForMonth - Get the holidays for a specific month
  • GetHolidaysForYear - Get the holidays for an entire year

Testing the HolidayService2 Web Service operations using SOAP UI

Step 0 - Install Soap UI Open Source

Download and install SoapUI Open Source software on your computer soapui.org/downloads/soapui.html.

Step 1 - Create New SOAP Project in SOAP UI

  • Project name: Holiday Web Service Testing
  • Initial WSDL endpoint link: http://www.holidaywebservice.com//HolidayService_v2/HolidayService2.asmx?wsdl
  • Create Requests: Create sample requests for all operations: Yes
  • Create Test Suite: Creates a Test Suite for the imported WSDL: Yes

Step 2 - Generate testsuite (Optional)

Step 3 - select Getholidaysavailable endpoint

Select the "GetHolidayAvailable" endpoint, add in the following as the body payload and send the request through.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:hs="http://www.holidaywebservice.com/HolidayService_v2/">
 <soapenv:Body>
 <hs:GetHolidaysAvailable>
 <hs:countryCode>IrelandRepublicOf</hs:countryCode>
 </hs:GetHolidaysAvailable>
 </soapenv:Body>
</soapenv:Envelope>

Step 4 - Change country Change the country to see different results.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:hs="http://www.holidaywebservice.com/HolidayService_v2/">
 <soapenv:Body>
 <hs:GetHolidaysAvailable>
 <hs:countryCode>UnitedStates</hs:countryCode>
 </hs:GetHolidaysAvailable>
 </soapenv:Body>
</soapenv:Envelope>
You can use the "Clone Request" function within SOAP UI if you would like to speed things up and save the different requests you want to test.

You can also try with Canada.

References:

  • Web Services Description Language (WSDL) Version 2.0 Part 1: Core Language, https://www.w3.org/TR/wsdl20/
  • You will also find a summary of these additional operations supported by this Web service available here - http://holidaywebservice.com/HolidayService_v2/HolidayService2.asmx and http://www.holidaywebservice.com/ServicesAvailable_HolidayService2.aspx.
  • https://www.w3.org/TR/wsdl.html#_wsdl

Topics: tech, web services, apis

Vu Long Tran

Written by Vu Long Tran

Solutions Engineer APAC. ex-@Forrester consultant. Writing on #cloud #howto guides and #tech tinkering!