cancel
Showing results for 
Search instead for 
Did you mean: 
cancel

Search devices based on multiple directory numbers

nasiramerw
Beginner
Beginner

I want to search phones based on the multiple directory numbers but it does not work for me. It always returns a single phone. Just wondering if I have constructed the soap request correctly. CUCM version is 10.5.1.10000-7

<?xml version="1.0" encoding="utf-8"?>

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/

" xmlns:soap="http://schemas.cisco.com/ast/soap

">

<soapenv:Header/>

<soapenv:Body>

<soap:selectCmDevice>

<soap:StateInfo/>

<soap:CmSelectionCriteria>

<soap:MaxReturnedDevices>200</soap:MaxReturnedDevices>

<soap:Status>Registered</soap:Status>

<soap:SelectBy>DirNumber</soap:SelectBy>

<soap:SelectItems>

<soap:Item>8661</soap:Item>

<soap:Item>8663</soap:Item>

</soap:SelectItems>

</soap:CmSelectionCriteria>

</soap:selectCmDevice>

</soapenv:Body>

</soapenv:Envelope>

8 REPLIES 8

npetrele
Cisco Employee
Cisco Employee

Hi -- try this, instead (insert into the appropriate spot):

<soap:SelectItems>

     <soap:item>

          <soap:Item>8661</soap:Item>

     </soap:item>

     <soap:item>

          <soap:Item>8663</soap:Item>

     </soap:item>

</soap:SelectItems>

By running the following soap request it gives me error:

******************

Soap Request:

******************

<?xml version="1.0" encoding="utf-8"?>

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://schemas.cisco.com/ast/soap">

<soapenv:Header/>

<soapenv:Body>

<soap:selectCmDevice>

<soap:StateInfo/>

<soap:CmSelectionCriteria>

<soap:MaxReturnedDevices>200</soap:MaxReturnedDevices>

<soap:SelectBy>DirNumber</soap:SelectBy>

<soap:SelectItems>

<soap:item>

<soap:Item>8661</soap:Item>

</soap:item> 

<soap:item>

<soap:Item>8663</soap:Item>

</soap:item>  

</soap:SelectItems>

</soap:CmSelectionCriteria>

</soap:selectCmDevice>

</soapenv:Body>

</soapenv:Envelope>

********************

Soap Response:

********************

<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><soapenv:Fault><faultcode>soapenv:Server.userException</faultcode><faultstring>org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.</faultstring><detail><ns1:stackTrace xmlns:ns1="http://xml.apache.org/axis/">org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.

at org.apache.axis.encoding.ser.SimpleDeserializer.onStartChild(SimpleDeserializer.java:145)

at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)

at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)

at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)

at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236)

at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)

at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:81)

at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)

at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)

at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)

at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)

at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:454)

at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)

at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)

at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

at com.cisco.vos.platform.tomcat.valves.CiscoResponseHeaderFilter.doFilter(Unknown Source)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:581)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)

at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)

at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:314)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)

at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)

at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)

at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

at java.lang.Thread.run(Thread.java:744)

</ns1:stackTrace><ns2:hostname xmlns:ns2="http://xml.apache.org/axis/">mrdcucm105</ns2:hostname></detail></soapenv:Fault></soapenv:Body></soapenv:Envelope>

That error message isn't very helpful, is it? 

Here's a more complete version that should work.  Try it and let us know!

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://schemas.cisco.com/ast/soap">

    <soapenv:Header/>

    <soapenv:Body>

        <soap:selectCmDevice>

            <soap:StateInfo></soap:StateInfo>

            <soap:CmSelectionCriteria>

                <soap:MaxReturnedDevices>200</soap:MaxReturnedDevices>

                <soap:DeviceClass>Any</soap:DeviceClass>

                <soap:Model>255</soap:Model>

                <soap:Status>Any</soap:Status>

                <soap:NodeName></soap:NodeName>

                <soap:SelectBy>DirNumber</soap:SelectBy>

                <soap:SelectItems>

                    <soap:item>

                        <soap:Item>8661</soap:Item>

                    </soap:item>

                    <soap:item>

                        <soap:Item>8663</soap:Item>

                    </soap:item>

                </soap:SelectItems>

                <soap:Protocol>Any</soap:Protocol>

                <soap:DownloadStatus>Any</soap:DownloadStatus>

            </soap:CmSelectionCriteria>

        </soap:selectCmDevice>

    </soapenv:Body>

</soapenv:Envelope>

It is failing with different reason now:

<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><soapenv:Fault><faultcode>soapenv:Server.userException</faultcode><faultstring>org.xml.sax.SAXException: Invalid element in com.cisco.ccm.serviceability.soap.risport.CmSelectionCriteria - DeviceClass</faultstring><detail><ns1:stackTrace xmlns:ns1="http://xml.apache.org/axis/">org.xml.sax.SAXException: Invalid element in com.cisco.ccm.serviceability.soap.risport.CmSelectionCriteria - DeviceClass

at org.apache.axis.encoding.ser.BeanDeserializer.onStartChild(BeanDeserializer.java:258)

at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)

at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)

at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)

at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236)

at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)

at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:81)

at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)

at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)

at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)

at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)

at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:454)

at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)

at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)

at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

at com.cisco.vos.platform.tomcat.valves.CiscoResponseHeaderFilter.doFilter(Unknown Source)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:581)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)

at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)

at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:341)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)

at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)

at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)

at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

at java.lang.Thread.run(Thread.java:744)

</ns1:stackTrace><ns2:hostname xmlns:ns2="http://xml.apache.org/axis/">mrdcucm105</ns2:hostname></detail></soapenv:Fault></soapenv:Body></soapenv:Envelope>

It's saying there's something wrong with your DeviceClass element or data.  Can you post the exact XML you are using?

<?xml version="1.0" encoding="utf-8"?>

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://schemas.cisco.com/ast/soap">

    <soapenv:Header/>

    <soapenv:Body>

        <soap:selectCmDevice>

            <soap:StateInfo></soap:StateInfo>

            <soap:CmSelectionCriteria>

                <soap:MaxReturnedDevices>200</soap:MaxReturnedDevices>               

                <soap:DeviceClass>Any</soap:DeviceClass>

                <soap:Model>255</soap:Model>

                <soap:Status>Any</soap:Status>                                

                <soap:NodeName></soap:NodeName>

                <soap:SelectBy>DirNumber</soap:SelectBy>

                   <soap:SelectItems>

                    <soap:item>

                        <soap:Item>8661</soap:Item>

                    </soap:item>

                    <soap:item>

                        <soap:Item>8663</soap:Item>

                    </soap:item>

                   </soap:SelectItems>                  

                   <soap:Protocol>Any</soap:Protocol>

                   <soap:DownloadStatus>Any</soap:DownloadStatus>     

            </soap:CmSelectionCriteria>

        </soap:selectCmDevice>

    </soapenv:Body>

</soapenv:Envelope>

I'm stumped now.  That exact request (with our directory number) is working perfectly for me.  I don't have the <?xml version="1.0" encoding="utf-8"?> part, though, because I'm using SoapUI.  Have you tried this in SoapUI?  That's a good way to debug your Soap requests. 

Hi,

just wondering if you got it to work?

I'm getting same error.

Thanks

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: