05-20-2016 06:15 AM
Hi,
I am trying to use addCss with AXL 10.5.2 but jeep getting error. Could someone take a look at my function and soap header, please? I was able to run addCSS against 8.6.2 with schema 7.1 but cannot get it working for 10.5.2 with adCss.
Any help appreciated.
soaprequest = '''
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<axl:addCss xmlns:axl="http://www.cisco.com/AXL/API/10.5" xsi:schemaLocation="http://www.cisco.com/AXL/API/10.5 http://ccmserver/schema/axlsoap.xsd" sequence="1234">
<name>css1</name>
<description>css1</description>
<members>
<member>
<index>1</index>
<routePartitionName>PT-1</routePartitionName>
</member>
<member>
<index>2</index>
<routePartitionName>PT-2</routePartitionName>
</member>
<member>
<index>3</index>
<routePartitionName>PT-3</routePartitionName>
</member></members>
</axl:addCss>
</SOAP-ENV:Body>
soapheaders = {'SOAPAction':'CUCM:DB ver=10.5 addCss' }
AXL debug
2016-05-20 12:50:06,984 WARN [http-bio-443-exec-21] wrappers.RequestHeaderWrapper - Client sent an unsupported header, SOAPAction= [CUCM:DB ver=10.5], attempting to auto correct.
2016-05-20 12:50:06,984 WARN [http-bio-443-exec-21] wrappers.RequestHeaderWrapper - SOAPAction header correction needed: Api is malformed or missing
2016-05-20 12:50:07,066 DEBUG [http-bio-443-exec-21] filters.ThrottlingFilter - DBLCNQueue Count: 0
2016-05-20 12:50:07,066 DEBUG [http-bio-443-exec-21] filters.ThrottlingFilter - Successfully set the value of counter: 4 value: 0
2016-05-20 12:50:07,066 DEBUG [http-bio-443-exec-21] servletRouters.AXLAlpha - Checking request version [10.5]
2016-05-20 12:50:07,067 DEBUG [http-bio-443-exec-21] servletRouters.AXLAlpha - Checking if requested api [addCss] the implementedHandlers list
2016-05-20 12:50:07,067 DEBUG [http-bio-443-exec-21] servletRouters.AXLAlpha - [addCss] is not in the implementedHandlers list
2016-05-20 12:50:07,067 INFO [http-bio-443-exec-21] servletRouters.AXLAlpha - Going to axis--->
2016-05-20 12:50:07,067 DEBUG [http-bio-443-exec-21] wrappers.RequestNamespaceWrapper - Inside Request Wrapper
2016-05-20 12:50:07,068 INFO [http-bio-443-exec-21] servletRouters.AXLAlpha - AXL REQUEST :
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<axl:addCss xmlns:axl="http://www.cisco.com/AXL/API/10.5" xsi:schemaLocation="http://www.cisco.com/AXL/API/10.5 http://ccmserver/schema/axlsoap.xsd" sequence="1234">
<name>css1</name>
<description>css1</description>
<members>
<member>
<index>1</index>
<routePartitionName>PT-1</routePartitionName>
</member>
<member>
<index>2</index>
<routePartitionName>PT-2</routePartitionName>
</member>
<member>
<index>3</index>
<routePartitionName>PT-3</routePartitionName>
</member></members>
</axl:addCss>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
2016-05-20 12:50:07,068 DEBUG [http-bio-443-exec-21] servletRouters.AXLAlpha - Request processed by AXIS
2016-05-20 12:50:07,261 DEBUG [http-bio-443-exec-21] axlapiservice.Handler - dbConnector Initialization in handler.java
2016-05-20 12:50:07,262 DEBUG [http-bio-443-exec-21] axlapiservice.Axl - Connection given to current thread
2016-05-20 12:50:07,285 DEBUG [http-bio-443-exec-21] axlapiservice.Axl - Thread is same so connection is reused, name of thread : http-bio-443-exec-21
2016-05-20 12:50:07,287 DEBUG [http-bio-443-exec-21] axlapiservice.AXLCallFlow - In begin transaction of AXLCallflow and created pub connector
2016-05-20 12:50:07,287 DEBUG [http-bio-443-exec-21] axlapiservice.AddCssHandler - In AddCss
2016-05-20 12:50:07,309 ERROR [http-bio-443-exec-21] axlapiservice.AXLAPIServiceSkeleton - com.cisco.www.axlapiservice.AXLAPIServiceSkeleton@1e40ff1
java.lang.NullPointerException
016-05-20 12:50:07,314 DEBUG [http-bio-443-exec-21] servletRouters.AXLAlpha - <?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><soapenv:Fault><faultcode>soapenv:Server</faultcode><faultstring></faultstring><detail><axlError><axlcode>-1</axlcode><axlmessage></axlmessage><request>addCss</request></axlError></detail></soapenv:Fault></soapenv:Body></soapenv:Envelope>
Thanks!
Solved! Go to Solution.
05-20-2016 11:59 AM
That was painful to troubleshoot but I think the problem is that there is whitespace in the beginning part of the HTTP body before the actual XML begins, due to the way the triple-quote block is laid out. XML and its parsers are very insistent that there should be no whitespace or extraneous characters at the start of an XML document, and unfortunately tend to give unhelpful errors. Worked when I changed this line of code:
soaprequest = '''
<?xml version='1.0' encoding='utf-8'?>
to:
soaprequest = '''<?xml version='1.0' encoding='utf-8'?>
If this worked in the older snippet and CUCM version, I'm not sure why it did...perhaps the parser became more strict in later versions.
05-20-2016 09:24 AM
From the debug log snippet, it looks like AXL doesn't like the SOAPAction header, even though it looks mostly good to me:
soapheaders = {'SOAPAction':'CUCM:DB ver=10.5 addCss' }
This is the raw request generated by soapUI, running against my CUCM 10.5:
POST https://ds-ucm105.cisco.com:8443/axl/ HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: "CUCM:DB ver=10.5 addCss"
Content-Length: 346
Host: ds-ucm105.cisco.com:8443
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
Authorization: Basic QWRtaW5pc3RyYXRvcjpjaXNjb3BzZHQ=
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.cisco.com/AXL/API/10.5">
<soapenv:Header/>
<soapenv:Body>
<ns:addCss>
<css>
<members>
</members>
<name>testCSSa</name>
</css>
</ns:addCss>
</soapenv:Body>
</soapenv:Envelope>
I do notice that there are double quotes around the value part of the SOAPAction header...perhaps you could try that, e.g. something like:
soapheaders = {'SOAPAction':'"CUCM:DB ver=10.5 addCss"' }
If that doesn't help, it would be interesting to see the code working with 8.5...
05-20-2016 09:56 AM
still no joy. i tried to add " " in the soapheader. I also added <css>....</css> tags but still getting error 500
this is code which works for me on 8.6.2 it uses old syntax addCSS .
soaprequest = '''
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<axl:addCSS xmlns:axl="http://www.cisco.com/AXL/API/7.1" xsi:schemaLocation="http://www.cisco.com/AXL/API/7.1 http://ccmserver/schema/axlsoap.xsd" sequence="1234">
<name>{0}</name>
<description>{1}</description>
<members>
<member>
<index>1</index>
<routePartitionName>{2}</routePartitionName>
</member>
<member>
<index>2</index>
<routePartitionName>{3}</routePartitionName>
</member>
<member>
<index>3</index>
<routePartitionName>{4}</routePartitionName>
</member></members>
</axl:addCSS>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>'''.format(name,desc,PT1,PT2,PT3)
global AXLRequest
soapheaders = {'SOAPAction':'CUCM:DB ver=7.1' }
05-20-2016 10:10 AM
Ah, it looks like there was a significant schema change between 7.x and 8.x, where the new <addCSS> schema looks like this:
<Envelope>
<addCss>
<css>
<name>
<description>
<members>
Your 10.5 code snippet looks like it's missing the <css> element level, i.e.:
<Envelope>
<addCss>
<name>
<description>
<members>
See https://developer.cisco.com/media/axl-schema-11-0/Files/AXLSoap_addCss.html#LinkCD
05-20-2016 10:13 AM
I have noticed that as well and still does not work. This is my exact function.
def SOAPRequest(name,desc,PT1,PT2,PT3,host,usrnm,pw):
#Set call forward to destination
soaprequest = '''
<?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/10.5">
<soapenv:Header/>
<soapenv:Body>
<ns:addCss>
<css>
<name>{0}</name>
<description>{1}</description>
<members>
<member>
<index>1</index>
<routePartitionName>{2}</routePartitionName>
</member>
<member>
<index>2</index>
<routePartitionName>{3}</routePartitionName>
</member>
<member>
<index>3</index>
<routePartitionName>{4}</routePartitionName>
</member>
</members>
</css>
</ns:addCss>
</soapenv:Body>
</soapenv:Envelope>'''.format(name,desc,PT1,PT2,PT3)
global AXLRequest
soapheaders = {'SOAPAction':'"CUCM:DB ver=10.5 addCss"' }
05-20-2016 10:18 AM
What is the AXL log saying for this test?
Could you create a small sample app based on this code and attach? I may be able to try it out here...
05-20-2016 10:36 AM
Sure.
edit css-test.txt with your new css and existing partitions
and execute it:python3 addcss-css-10.5-test2.py css-test.txt
05-20-2016 11:59 AM
That was painful to troubleshoot but I think the problem is that there is whitespace in the beginning part of the HTTP body before the actual XML begins, due to the way the triple-quote block is laid out. XML and its parsers are very insistent that there should be no whitespace or extraneous characters at the start of an XML document, and unfortunately tend to give unhelpful errors. Worked when I changed this line of code:
soaprequest = '''
<?xml version='1.0' encoding='utf-8'?>
to:
soaprequest = '''<?xml version='1.0' encoding='utf-8'?>
If this worked in the older snippet and CUCM version, I'm not sure why it did...perhaps the parser became more strict in later versions.
05-20-2016 12:08 PM
Oh man!!! You are my hero. I would never think of that. The funny part is that XML version was added during the troubleshooting process. Initial version of code did not include it. It works now. I can now proceed with building the rest of the script components.
Thank you!
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