AXL API to list ip phones

Version 1
    This document was generated from CDN thread

    Created by: Walid Azab on 04-05-2009 05:30:34 PM
    Hi,


    I am trying to list phone by extension. I am using AXL API from VS 2005 to connect to CUCM 6.0.1. I must be doing something wrong here because every time I run the listbydevicename query I get zero devices. I borrowed the C# code I converted to VB below from another thread in this forum. Here is my code:
     
    Dim oAXL As New AXLAPIService("ccmip", "ccmadministrator", "cisco")

        Try
                Dim phoneByName As New ListDeviceByNameAndClassReq()
                phoneByName.searchString = "SEP%"
                Dim phones As ListDeviceResDevice() = oAXL.listDeviceByNameAndClass(phoneByName).
               

               For Each phone As ListDeviceResDevice In phones
                    lstResult.Items.Add(phone.uuid)
                    lstResult.Items.Add(phone.name)
                Next

            Catch ex As Exception
                Throw ex
            End Try


    I am sure I have two devices (Phones) in my device list on CUCM6 lab server. Their Names are: SEP0019D2C92685 and SEP001DD93E1BE8.

    Is there even a better way to do that?
    PS: I am able to do other tasks using AXL e.g. add rout pattern.

    Thx

    Subject: RE: AXL API to list ip phones
    Replied by: David Staudt on 04-05-2009 06:55:51 PM
    It may be helpful to take a look at the AXL service logs (via RTMT) to check the incoming XML request and response for problems.  Feel free to post/attach here if you see something amiss.

    Subject: RE: AXL API to list ip phones
    Replied by: Walid Azab on 05-05-2009 09:29:25 AM
     


    Hi David,
     
    Good Idea. I can see however that RTRM AXL log is strangely not giving any errors.  Here it is (sorry for the mess but I attahched the log for a easier syntax tracking):
     
    ***This one works fine and I can add the RoutePattern
    2009-05-05 12:04:33,349 INFO  [http-8443-Processor22] axl.AxlListener - Received request 1241278285829 from ccmadministrator at IP 10.152.200.90
    2009-05-05 12:04:33,350 INFO  [http-8443-Processor22] axl.AxlListener - <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="
    http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><addRoutePartition xmlns="http://www.cisco.com/AXL/API/1.0"><newRoutePartition xmlns=""><name>RP1439939604</name><description>Deactivated_p</description></newRoutePartition></addRoutePartition></soap:Body></soap:Envelope>
    2009-05-05 12:04:33,387 INFO  [http-8443-Processor22] axl.Handler - Handler initializing
    2009-05-05 12:04:33,781 INFO  [http-8443-Processor22] axl.AxlListener - <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="
    http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Header/><SOAP-ENV:Body><axl:addRoutePartitionResponse xmlns:axl="http://www.cisco.com/AXL/API/1.0" xmlns:xsi="http://www.cisco.com/AXL/API/1.0"><return>{91261243-22E0-C264-1605-9CFEABE2FA60}</return></axl:addRoutePartitionResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
    2009-05-05 12:04:33,782 INFO  [http-8443-Processor22] axl.AxlListener - Request 1241278285829 was process in 499ms

     
    **This one goes through but no devices are found and no errors are returned in the SOAP response!!
    2009-05-05 12:07:24,339 INFO  [http-8443-Processor23] axl.AxlListener - Received request 1241278285830 from ccmadministrator at IP 10.152.200.90
    2009-05-05 12:07:24,339 INFO  [http-8443-Processor23] axl.AxlListener - <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><listDeviceByNameAndClass xmlns="http://www.cisco.com/AXL/API/1.0"><searchString xmlns="">SEP%</searchString></listDeviceByNameAndClass></soap:Body></soap:Envelope>
    2009-05-05 12:07:24,356 INFO  [http-8443-Processor23] axl.Handler - Handler initializing
    2009-05-05 12:07:24,441 INFO  [http-8443-Processor23] axl.AxlListener - <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Header/><SOAP-ENV:Body><axl:listDeviceByNameAndClassResponse xmlns:axl="http://www.cisco.com/AXL/API/1.0" xmlns:xsi="http://www.cisco.com/AXL/API/1.0"><return/></axl:listDeviceByNameAndClassResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
    2009-05-05 12:07:24,442 INFO  [http-8443-Processor23] axl.AxlListener - Request 1241278285830 was process in 157ms
     
     
     
    Appreciate your help.

    Subject: RE: AXL API to list ip phones
    Replied by: David Staudt on 05-05-2009 02:56:13 PM
    It looks like the <class> element is missing from the XML request.  The following XML worked on my CM6.0(1) system:
     
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.cisco.com/AXL/API/7.0">
       <soapenv:Header/>
       <soapenv:Body>
          <ns:listDeviceByNameAndClass sequence="?">
             <searchString>SEP%</searchString>
             <class>Phone</class>
          </ns:listDeviceByNameAndClass>
       </soapenv:Body>
    </soapenv:Envelope>