%--
Document : index
Created on : Feb 22, 2009, 1:34:02 PM
Author : dstaudt
--%>
<%@ page contentType="text/html" pageEncoding="UTF-8" %>
<%@ page import="com.cisco.schemas.ast.soap.*,org.apache.axis.client.*" %>
Serviceability AXL - RisPort: All Devices
<%
// CHANGE the following three strings for your UCM environment
String risURL = "https:///realtimeservice/services/RisPort";
String axlUser = "Administrator";
String axlPassword = "cisco!123";
RISService service = new RISServiceLocator(); // Instantiate the Axis Service object
RisPortType rport = service.getRisPort(new java.net.URL(risURL)); // get the binding for RisPort
((Stub) rport)._setProperty(Call.USERNAME_PROPERTY, axlUser); // If we cast rport as an Axis Stub class
((Stub) rport)._setProperty(Call.PASSWORD_PROPERTY, axlPassword); // we can set the HTTP basic auth credentials
//The following single element array of SelectItem '*' matches all devices
//To search for specific devices, fill this array with device names
//Note selectCmDevice will only return max 200 devices. In a real deployment
//an app might use Admin AXL to get a list of device names
//then execute selectCmDevice multiple times querying up to 200 devices at a time.
//Additional note, unique devicenames can be returned more than once if they have registered
//to more than one node in the past
SelectItem[] items = {new SelectItem("*")};
//The general selection criteria goes in a CmSelectionCriteria object
CmSelectionCriteria cmSelectionCriteria = new CmSelectionCriteria(
new org.apache.axis.types.UnsignedInt(200), //Max returned devices
"Any", //Class of device e.g. "Phone"
new org.apache.axis.types.UnsignedInt(255), //Model 255=Unknown, see typemodel in the AXL DataDict
"Any", //Status, e.g. "Registered"
"", //UCM node server name
"Name", //CmSelectionCriteria items are device names
items);
SelectCmDeviceResult cmselectresult = null;
try {
// Make the AXL request
cmselectresult = rport.selectCmDevice(new javax.xml.rpc.holders.StringHolder(""), cmSelectionCriteria);
} catch (Exception e) {
out.println("Error: " + e.getMessage());
}
if (cmselectresult != null) {
int devicesFound = cmselectresult.getTotalDevicesFound().intValue(); //Find out how many devices found
%>
Total Devices Found: <%= devicesFound%>
| Name |
IP Address |
Model |
E/M User |
Status |
<%
if (devicesFound > 0) {
//If some devices are found, output them in an HTML table
CmNode[] nodes = cmselectresult.getCmNodes(); // Get the array of UCM nodes
for (int i = 0; i < nodes.length; i++) {
CmDevice[] devices = nodes[i].getCmDevices(); //Get the array of devices for this node
for (int j = 0; j < devices.length; j++) {%>
| <%= devices[j].getName()%> |
<%= devices[j].getIpAddress()%> |
<%= devices[j].getModel()%> |
<%= devices[j].getLoginUserId()%> |
<%= devices[j].getStatus()%> |
<%
}
}
}%>
<% }%>