« Back to Serviceability XML Questions

Sending multiple items in request to Risport

Combination View Flat View Tree View
Threads [ Previous | Next ]
I am trying to build a request to the Risport that includes multiple phones for which I need info on.  The goal is to minimize the number of requests I need to do so that I don't hit the 15 req/minute throttle.
 
The request I have built only sends back one response - the thing is I don't know if that is because my request is not set correctly or if I have an error in my code handling the response.
 
Here is the request:
 
<?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><ns1:SelectCmDevice
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://schemas.cisco.com/ast/soap/"><StateInfo
xsi:type="xsd:string"/>
<CmSelectionCriteria href="#id0"/>
</ns1:SelectCmDevice>
<multiRef id="id0" soapenc:root="0"

soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:CmSelectionCriteria"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="http://schemas.cisco.com/ast/soap/">
<MaxReturnedDevices xsi:type="xsd:unsignedInt">200</MaxReturnedDevices>
<Class xsi:type="xsd:string">Phone</Class><Model xsi:type="xsd:unsignedInt">255</Model><Status xsi:type="xsd:string">Registered</Status><NodeName xsi:type="xsd:string" xsi:nil="true"/>
<SelectBy xsi:type="xsd:string">Name</SelectBy>
<SelectItems soapenc:arrayType="ns2:SelectItem[1]" xsi:type="soapenc:Array"><item href="#id1"/>
</SelectItems></multiRef>
<multiRef id="id1" soapenc:root="0" soapenv:encodingStyle="
http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns3:SelectItem"
xmlns:ns3="http://schemas.cisco.com/ast/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<Item xsi:type="xsd:string">SEP0021BBBBBBBB</Item>
<Item xsi:type="xsd:string">SEP0015AAAAAAAA</Item>
<Item xsi:type="xsd:string">SEP002199999999</Item
<Item xsi:type="xsd:string">SEP002144444444</Item>
<Item xsi:type="xsd:string">SEP002333333333</Item>
<Item xsi:type="xsd:string">SEP0021A2222222</Item>
<Item xsi:type="xsd:string">SEP0021A1111111</Item>
<Item xsi:type="xsd:string">SEP0021A7777777</Item>
<Item xsi:type="xsd:string">SEP0021A6666666</Item>
<Item xsi:type="xsd:string">SEP0021A5555555</Item>
</multiRef></soapenv:Body></soapenv:Envelope>

 
And the 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><ns1:SelectCmDeviceResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://schemas.cisco.com/ast/soap/"><SelectCmDeviceResult xsi:type="ns1:SelectCmDeviceResult"><TotalDevicesFound xsi:type="xsd:unsignedInt">1</TotalDevicesFound><CmNodes soapenc:arrayType="ns1:CmNode[4]" xsi:type="soapenc:Array" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"><item xsi:type="ns1:CmNode"><ReturnCode xsi:type="ns1:RisReturnCode">NotFound</ReturnCode><Name xsi:type="xsd:string">10.10.72.5</Name><NoChange xsi:type="xsd:boolean">false</NoChange><CmDevices soapenc:arrayType="ns1:CmDevice[0]" xsi:type="soapenc:Array"/></item><item xsi:type="ns1:CmNode"><ReturnCode xsi:type="ns1:RisReturnCode">NotFound</ReturnCode><Name xsi:type="xsd:string">10.10.72.5</Name><NoChange xsi:type="xsd:boolean">false</NoChange><CmDevices soapenc:arrayType="ns1:CmDevice[0]" xsi:type="soapenc:Array"/></item><item xsi:type="ns1:CmNode"><ReturnCode xsi:type="ns1:RisReturnCode">NotFound</ReturnCode><Name xsi:type="xsd:string">10.10.249.5</Name><NoChange xsi:type="xsd:boolean">true</NoChange><CmDevices soapenc:arrayType="ns1:CmDevice[0]" xsi:type="soapenc:Array"/></item><item xsi:type="ns1:CmNode"><ReturnCode xsi:type="ns1:RisReturnCode">Ok</ReturnCode><Name xsi:type="xsd:string">10.10.249.6</Name><NoChange xsi:type="xsd:boolean">false</NoChange><CmDevices soapenc:arrayType="ns1:CmDevice[1]" xsi:type="soapenc:Array"><item xsi:type="ns1:CmDevice"><Name xsi:type="xsd:string">SEP0021A5555555</Name><IpAddress xsi:type="xsd:string">10.212.23.103</IpAddress><DirNumber xsi:type="xsd:string">11173709-Registered</DirNumber><Class xsi:type="ns1emoticoneviceClass">Phone</Class><Model xsi:type="xsd:unsignedInt">115</Model><Product xsi:type="xsd:unsignedInt">115</Product><BoxProduct xsi:type="xsd:unsignedInt">0</BoxProduct><Httpd xsi:type="ns1:CmDevHttpd">Yes</Httpd><RegistrationAttempts xsi:type="xsd:unsignedInt">0</RegistrationAttempts><IsCtiControllable xsi:type="xsd:boolean">true</IsCtiControllable><LoginUserId xsi:type="xsd:string">smith</LoginUserId><Status xsi:type="ns1:CmDevRegStat">Registered</Status><StatusReason xsi:type="xsd:unsignedInt">0</StatusReason><PerfMonObject xsi:type="xsd:unsignedInt">2</PerfMonObject><DChannel xsi:type="xsd:unsignedInt">0</DChannel><Description xsi:type="xsd:string">John Smith</Description><H323Trunk xsi:type="ns1:H323Trunk"><ConfigName xsi:type="xsd:string" xsi:nil="true"/><TechPrefix xsi:type="xsd:string" xsi:nil="true"/><Zone xsi:type="xsd:string" xsi:nil="true"/><RemoteCmServer1 xsi:type="xsd:string" xsi:nil="true"/><RemoteCmServer2 xsi:type="xsd:string" xsi:nil="true"/><RemoteCmServer3 xsi:type="xsd:string" xsi:nil="true"/><AltGkList xsi:type="xsd:string" xsi:nil="true"/><ActiveGk xsi:type="xsd:string" xsi:nil="true"/><CallSignalAddr xsi:type="xsd:string" xsi:nil="true"/><RasAddr xsi:type="xsd:string" xsi:nil="true"/></H323Trunk><TimeStamp xsi:type="xsd:unsignedInt">1248226572</TimeStamp></item></CmDevices></item></CmNodes></SelectCmDeviceResult><StateInfo xsi:type="xsd:string">&lt;StateInfo&gt;&lt;Node Name=&quot;10.10.72.5&quot; SubsystemStartTime=&quot;1243547706&quot; StateId=&quot;4875&quot; TotalItemsFound=&quot;0&quot; TotalItemsReturned=&quot;0&quot;/&gt;&lt;Node Name=&quot;10.10.72.5&quot; SubsystemStartTime=&quot;1243556092&quot; StateId=&quot;11867&quot; TotalItemsFound=&quot;0&quot; TotalItemsReturned=&quot;0&quot;/&gt;&lt;Node Name=&quot;10.10.249.5&quot; SubsystemStartTime=&quot;0&quot; StateId=&quot;0&quot; TotalItemsFound=&quot;0&quot; TotalItemsReturned=&quot;0&quot;/&gt;&lt;Node Name=&quot;10.10.249.6&quot; SubsystemStartTime=&quot;1248226531&quot; StateId=&quot;336&quot; TotalItemsFound=&quot;1&quot; TotalItemsReturned=&quot;1&quot;/&gt;&lt;/StateInfo&gt;</StateInfo></ns1:SelectCmDeviceResponse>
 
Any insight would be much appreciated !
 
 

Hi Jean,
 
Please give the names separated by commas to get the information of all the devices for now...
<Item xsi:type="xsd:string"> SEP0021BBBBBBBB, SEP0015AAAAAAAA, SEP002199999999 </Item>
 
I think your query should work fine. We have seen issues with older versions of CallManager... Could you please let me know the CUCM version in which you are facing this issue?
 
Thanks and Regards,
Bhuvana
Developer Services

Hi Bhuvana,
 
Your suggestion worked great - I am having this issue with CUCM 7.02.10000-18.   I was basing my code on the 7.0(1) guides where it is stated that each name should be wrapped in the appropriate <item> tag.
 
Thanks for your help !

One observation, in your original request, the array was only indicating one row:
 
<SelectItems soapenc:arrayType="ns2:SelectItem[1]" xsi:type="soapenc:Array"><item href="#id1"/>
 
I believe this needs to reflect the # of select items.
 
Interesting that the comma separated list works...I'd be wary of that since it's not specified in the docs/schema that way AFAIK, and therefore may be susceptible to being changed without warning.

My latest successful attempt has SelectItem[200].  I've just tried it again with SelectItem[1]  and it still works fine.  My query gets the info for 1400+ devices via 200 item increments.
 
As for the comma seperated list, it's the only way I can get it working.  If I use the documented structure I only get the info for the last <item> in the request no matter how many there are.
 
But in both cases I will keep your suggestions in the back of my mind if things go broke after an upgrade.
 
 

Are you requesting 200 devices info at a time?  That is are you sending 200 device names in your request?
 
If so be careful you can get bad results:  With NodeName=nil you can get responses for each device from up to three CUCM (seems to happen most on newer systems and then settle out), so if you ask for info on 200 unique device names you could get 66 unique device items returned by each of three CUCM for a total of 198 infos in the response.  So thats ~134 devices you didnt get info returned for since the response can contain a maximum of 200 device info items.
 
Also, when getting multiple items returned for the same device the timestamps become very important.  Some of the CUCM will report the device as UnRegistered while one will report it as Registered (the one that it is actually registered to) and this one generally has the latest timestamp.  Finally, I've seen the timestamps match with one CUCM reporting UnRegistered and another reporting Registered, in this case I mark the phone as registered.
 
Maybe you figured this out already and only request a max of 66 devices; or i suppose if you knew the NodeName that all the phones were registered to you could request all 200 devices from it but that is going to blow away fail-over, there could be a more appropriate solution but I'm not sure what it is. 
 
Here is my request incase it helps you with the SAOP array, i remember this as a major pain:
 

[<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' xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/' xmlns:tns='http://schemas.cisco.com/ast/soap/' xmlns:types='http://schemas.cisco.com/ast/soap/encodedTypes'>
  <SOAP-ENV:Header>
    <tns:AstHeader id='id1'>
      <SessionId xsi:type='xsd:string'>00000000-0000-0000-0000-000000000000</SessionId>
    </tns:AstHeader>
  </SOAP-ENV:Header>
  <SOAP-ENV:Body SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'><tns:SelectCmDevice>
  <StateInfo xsi:type='xsd:string' />
  <CmSelectionCriteria xsi:type='tns:CmSelectionCriteria'>
    <MaxReturnedDevices xsi:type='xsd:unsignedInt'>200</MaxReturnedDevices>
    <Class xsi:type='xsd:string'>Phone</Class>
    <Model xsi:type='xsd:unsignedInt'>255</Model>
    <Status xsi:type='xsd:string'>Any</Status>
    <NodeName xsi:type='xsd:string' />
    <SelectBy xsi:type='xsd:string'>Name</SelectBy>
    <SelectItems soapenc:arrayType='tns:SelectItem[66]' xsi:type='soapenc:Array' xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/'>
      <item xsi:type='tns:SelectItem'>
        <Item xsi:type='xsd:string'>SEP000C858D1830</Item>
      </item>
      <item xsi:type='tns:SelectItem'>
        <Item xsi:type='xsd:string'>CTIP_570</Item>
      </item>
      <item xsi:type='tns:SelectItem'>
        <Item xsi:type='xsd:string'>SEP000C2968DF20</Item>
      </item>
      <item xsi:type='tns:SelectItem'>
        <Item xsi:type='xsd:string'>SEP0015626A4800</Item>
      </item>
       ............ more items ...........
   </SelectItems>
  </CmSelectionCriteria>
</tns:SelectCmDevice></SOAP-ENV:Body>
</SOAP-ENV:Envelope>]

 
Also, here is the code for the SOAP array portion (c#):
 
xml.WriteStartElement( "soapenc:Array");
xml.WriteAttributeString( "id", "id2" );
xml.WriteAttributeString( "soapenc:arrayType", selectItems );  //selectItems = tns:SelectItem

for(int i =0; i<names_.Length; i++)
{
xml.WriteStartElement( "Item");
xml.WriteAttributeString( "xsi:type", "tns:SelectItem");
xml.WriteStartElement( "Item" );
xml.WriteAttributeString( "xsi:type", "xsd:string" );
xml.WriteRaw ( names_ );
xml.WriteEndElement();
xml.WriteEndElement();
}
xml.WriteStartElement( "Item");
xml.WriteAttributeString( "xsi:null", "1" );

Regards,
 
Eric Conway

Hey, that is great info! works fine on my 3 phone test bench, will see how it will go on a 10,000+ phone system ;-)
 
I was wondering, if you query status=Registered you should only get those entries, thus WILL have 200 (or less) per request
 
has anyone tried this?

Restricting the query to only Registered devices should eliminate the issue with getting multiple results for the same device name, since the device can only be actively registered to one node.