Generally speaking, Cisco collaboration products make use of one of the two most prevelant web services types, REST and SOAP. Each one has its advantages which we will discuss. In this section we will discuss SOAP and cover REST in later sections. Most of the Cisco Unified Communications Manager (CUCM) APIs (Administrative XML (AXL), UC Manager Serviceability (SXML), Platform Administrative Web Services (PAWS), etc) are exposed via SOAP-based XML Web Services, which conform to the Simple Object Access Protocol (SOAP) Specification 1.1 and the Web Services Description Language (WSDL) Specification 1.1. SOAP provides an XML-based communication protocol and encoding format for communication.
If you are not familiar with XML, it stands for eXtensible Markup Language and is a markup language that defines some relatively simple rules for encoding data. It was primarily designed to transmit and receive structured data in a well-defined format both systems can understand. In it's most basic form, XML defines tags which are enclosed in angle brackets (<>) and these tags surround the data described by the tag. Tags can form a hierarchy with tags inside of other tags. For example, to define a basic phone device, you might say that a phone device needs three parameters, a name, a description, and a phone number. To describe such a phone using XML, you would define the following structure:
Notice how for each tag, there is a corresponding end tag that includes a forward slash (/ before the tag name).
The names of the tags can, in theory, be any arbitrary string. In order for two devices using XML to agree upon what tags should be present and what type of data is expected between those tags, an XML schema is defined. An XML schema describes in painstaking detail not only the names of the tags, but also what order they should appear, what kind of data can be enclosed between the tags (for example a string, an integer, or some other sequence of tags), whether specific tags are mandatory, or if a particular tag can repeat more than once. Let's take a look at one of the simpler objects that can be configured on CUCM, a Partition. The following is a piece of the schema definition for a partition (called a RoutePartition in the API):
You can see that the definition of a Partition includes a name, description, timeScheduleIdName, and timeZone. The type field tells you what kind of data is in that field. The values that are a string are self-explanatory, but what is a XFkType or XTimeZone? To determine what these custom types are, you must find them in the schema definition, as they have their own set of rules. You will find that there will be many references to other parts of a schema and those other parts can further reference other parts.
XML schemas define how to describe an object or API call using XML. For example, you can describe a phone or a partition by following an XML schema. In order to perform transactions using these objects, you need something like SOAP which describes how to send requests and receive responses using XML messages.
The following diagram shows you the structure of a SOAP message:
What does this look like when encoded in XML?
The SOAP message above is a very basic request for the CUCM version. You can see that the getCCMVersion request has no parameters. The SOAP standard describes the above structure for a SOAP message. If you are thinking to yourself that this is getting complicated, you can relax. We are showing you what is happening behind the scenes, but as you will see shortly, there are many tools that will abstract this structure from you so that you don't have to deal with it.
If an XML schema describes the messages and objects that can be defined using XML, then how do you know what types of requests you are allowed to make, what types of data those requests require, and what type of response you expect to receive? This is where the Web Services Description Language (WSDL) comes into play. A WSDL file (along with associated XML schema files, that usually have the .xsd extension) can be used to fully describe the capabilities of a SOAP API.
The WSDL, in conjunction with the XML schema, can be thought of as a method signature for the web service. With it, you will know everything the web service can support, including Request and Response data types for all available methods.
A WSDL file defines four pieces of data:
CUCM provides a WSDL file for each of the SOAP-based APIs it supports. When trying to utilize these SOAP based APIs, interpreting the WSDL files can be a daunting task. Fortunately, there are tools to read WSDL files and then make the SOAP API service methods available easily. The eventual goal is to leverage a programing language such as Python to interface with the various SOAP API's, but it helps to manually explore the API using a visual tool that can understand the WSDL file. One of these tools is SoapUI which has been installed on your workstation.
The first API you will explore is the Administrative XML Layer (AXL) API. The AXL API is a provisioning API for CUCM described in much greater detail in the next section. AXL essentially allows you to configure anything that you would be able to configure from the CUCM Admin web page.
The WSDL and XML schema files for the AXL API are published on the CUCM server itself, as part of the Cisco AXL Toolkit plugin. You will need these for SoapUI to be able to interact CUCM's AXL web service.
Now you can load this WSDL into SoapUI, get things configured, and start sending queries. Follow these steps to load the WSDL into SoapUI.
Once the API is loaded, you must set some of the default parameters, specifically the CUCM hostname or IP address and the credentials so that they don't have to be re-entered for every query.
SoapUI is now all set up for issuing queries. When you opened the WSDL file in SoapUI, SoapUI parsed the contents of the file in addition to the XML schema files that are referenced in the WSDL to provide you with a list of all the actions you can take using the AXL API. You will notice that the Navigator pane on the left contains a list of all the AXL API methods available in the API. Just as all these methods are now available to you at the click of a button, you will see later how certain libraries can perform a similar action in Python to read the WSDL file and make all of these methods available to you programmatically. To experience your first AXL SOAP API call, follow the steps below:
You have successfully sent an AXL/SOAP request to CUCM and received a valid response. This request was fairly basic as you did not have to provide any parameters in the request. Even with only one piece of information in the response, the version of CUCM, the response seems fairly complex. Having to manually parse and extract the data from the XML-based response may seem daunting. You will see later when you perform similar actions using Python that the SOAP library you will be using will greatly simplify the process of extracting the data from the response.
In the next section, you will explore the AXL API in more detail and construct some more complex requests.