300-835 · Question #19
Drag and drop the code to create a valid AXL API script to create a new Route Partition, using the Python Zeep library. Not all options are used.
AXL API Script: Creating a Route Partition with Python Zeep Overall Goal The AXL (Administrative XML) API is Cisco CUCM's SOAP-based web service for programmatic administration. The Zeep library is Python's modern SOAP client - it reads a WSDL file and auto-generates the methods
Question
Explanation
AXL API Script: Creating a Route Partition with Python Zeep
Overall Goal
The AXL (Administrative XML) API is Cisco CUCM's SOAP-based web service for programmatic administration. The Zeep library is Python's modern SOAP client - it reads a WSDL file and auto-generates the methods you need. The goal is to authenticate to CUCM over HTTPS and call addRoutePartition to create a partition without using the CUCM GUI.
Typical Script Structure & Step-by-Step Reasoning
Step 1 - Import Libraries
from zeep import Client
from zeep.transports import Transport
from requests import Session
from requests.auth import HTTPBasicAuth
import urllib3
Why: Zeep handles the SOAP layer; requests manages the HTTP session; HTTPBasicAuth sends credentials; urllib3 is needed to suppress SSL warnings when using self-signed CUCM certs.
Skipping this: Nothing works - Python has no SOAP capability built-in.
Step 2 - Disable SSL Warnings (optional but common)
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
Why: CUCM typically uses a self-signed certificate. Without this, your output is flooded with warning noise. In production, you'd supply a valid cert instead.
Step 3 - Create an Authenticated Session
session = Session()
session.verify = False
session.auth = HTTPBasicAuth('admin', 'password')
Why: AXL requires HTTP Basic Auth over HTTPS. Setting verify=False skips certificate validation. The Session object persists these settings across all requests.
Skipping this: Zeep would send unauthenticated requests → CUCM returns 401 Unauthorized.
Order matters: The session must exist before the Transport is created, because Transport wraps it.
Step 4 - Create the Transport
transport = Transport(session=session)
Why: Zeep's Transport layer is what actually sends HTTP requests. By passing in your pre-configured session, Zeep inherits your auth and SSL settings.
Skipping this: Zeep creates its own default transport - losing your credentials and SSL bypass.
Step 5 - Point to the WSDL and Create the Client
wsdl = 'https://<CUCM_IP>:8443/axl/schema/current/AXLAPI.wsdl'
client = Client(wsdl, transport=transport)
Why: The WSDL describes every AXL method, its inputs, and its outputs. Zeep reads it and dynamically builds Python method stubs. Without the WSDL, Zeep has no idea addRoutePartition exists.
Skipping this: No client = no API calls. Wrong WSDL path = Zeep can't parse it and raises an error.
Step 6 - Call addRoutePartition
response = client.service.addRoutePartition(
routePartition={
'name': 'MyPartition',
'description': 'Created via AXL'
}
)
Why: This sends the actual SOAP request. client.service exposes all AXL operations. The routePartition dict maps to the AXL XML schema's fields. CUCM returns the UUID of the newly created partition on success.
Skipping name: AXL will reject the request - name is a required field.
Wrong dict key: Zeep validates against the WSDL schema and raises a ValidationError.
What Would Go Wrong Out of Order
| Mistake | Result |
|---|---|
Create Client before Session | Client uses default (unauthenticated) transport |
Skip session.auth | 401 Unauthorized from CUCM |
| Wrong WSDL URL | Fault or connection error at client creation |
Missing name in dict | AXL schema validation error |
Memory Tip
Think of it as "SATCC":
Session → Auth → Transport → Client → Call
Each layer wraps the one before it, funneling your credentials down to the actual SOAP call.
Topics
Community Discussion
No community discussion yet for this question.