Hi Guys,
I am new to CUCM AXL API and I was referring the Cisco Dev guide for creating/automating the IP phone/softphone configuration.
In the initial steps I used GET to interact with AXL API and the response code was [200]. While accessing the AXL code via POST with an XML payload it shows [401] error. The creds are correct, I am unable to figure out the error. One additional info is the site is not secure as the creds are not configured for this test server.
import requests
from requests.auth import HTTPBasicAuth
import base64
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
import xml.etree.ElementTree as ET
import xmltodict
# SOAP request URL
#url = "http://doamin-Name/axl"
url1 = "https://doamin-Name:8443/axl/"
# structured XML
payload ="""<?xml version ="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.cisco.com/AXL/API/12.5">
<soapenv:Header/>
<soapenv:Body>
<ns:getCCMVersion>
</ns:getCCMVersion>
</soapenv:Body>
</soapenv:Envelope>"""
# headers
headers1 = {
'Content-Type': 'text/xml;charset=utf-8',
'SOAPAction': 'CUCM:DB ver=12.5 getCCMVersion',
'Authorization': 'Basic passw'
}
resp = requests.post(url1, verify=False,auth = ('user','passws'), headers=headers1, data = payload, stream = True,timeout=50)
print(resp.content)
events = ET.iterparse(resp.raw)
#for event, elem in events:
# print(event, elem)
print(resp.content)
print(resp.headers)
print(resp.request.headers)
c= resp.cookies
print("Cookies : ",c)