08-10-2023 08:54 AM - edited 08-10-2023 09:06 AM
I am trying to create a Flask app with AXL to manage CUCM 14. I used a simple code:
location = 'https://' + user_env.CUCM_LOCATION + ':8443/axl'
client = Client(user_env.WSDL_PATH, location=location, username=user_env.CUCM_USER, password=user_env.CUCM_PASSWORD)
result = client.service.listPhone({'name':'SEP%'}, {'name':'', 'model':''})
for node in result['result']['phone']:
print(str(node['name']), str(node['model']))
I have all the path, name, and password in user_env.
WSDL_PATH = r"file:\\[DIRECT PATH]\AXLAPI.wsdl"
CUCM_LOCATION = "[CUCM IP ADDRESS]"
CUCM_USER = "USERNAME"
CUCM_PASSWORD = "PASSWORD"
I keep getting an error saying "urllib.error.URLError: <urlopen error [WinError 2] The system cannot find the file specified: '\\AXLSoap.xsd'>" which I pinpointed to the file AXLAPI.wsdl import location. I changed the path to [DIRECT PATH]\AXLSoap.xsd and still throw the same error but different path.
From AXLAPI.wsdl
<?xml version="1.0" encoding="UTF-8"?>
<definitions
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:s0="http://www.cisco.com/AXLAPIService/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:xsd1="http://www.cisco.com/AXL/API/14.0"
targetNamespace="http://www.cisco.com/AXLAPIService/">
<import location="AXLSoap.xsd" namespace="http://www.cisco.com/AXL/API/14.0"/>
and I tried
<?xml version="1.0" encoding="UTF-8"?>
<definitions
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:s0="http://www.cisco.com/AXLAPIService/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:xsd1="http://www.cisco.com/AXL/API/14.0"
targetNamespace="http://www.cisco.com/AXLAPIService/">
<import location="[DIRECT_PATH]\AXLSoap.xsd" namespace="http://www.cisco.com/AXL/API/14.0"/>
Here is my file structure
APP
|
|--axlsqltookit
|
|-- code.py
|
|-- user_env.py
What path should I put so it can work?
08-10-2023 02:54 PM
I put both the .wsdl and .xsd files in the same directory as my python code and leave the import as is
<import location="AXLSoap.xsd" namespace="http://www.cisco.com/AXL/API/14.0"/>
and that works for me.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide