Administration XML Developer Forums

« Back to Administration XML Questions

getting list of devices from cucm

Combination View Flat View Tree View
Threads [ Previous | Next ]
Hi,
I am trying to get the list of devices(Phones) from cucm. facing below issue when i run class file can body help.
 
 below is the code snipet
// Form the http header
sAXLSOAPRequest = "POST https://<cucmip>:8443/realtimeservice/services/RisPort HTTP/1.1\r\n";
//sAXLSOAPRequest = "POST /realtimeservice/services/RisPort HTTP/1.1\r\n";
//sAXLSOAPRequest = "POST /axl/ HTTP/1.1\r\n";
sAXLSOAPRequest += "Host:<cucmip>:8443\r\n";
sAXLSOAPRequest += "Authorization: Basic " + authorization + "\r\n";
sAXLSOAPRequest += "Accept: text/*\r\n";
sAXLSOAPRequest += "Content-type: text/xml\r\n";
sAXLSOAPRequest += "SOAPAction: \"http://schemas.cisco.com/ast/soap/action/#RisPort#SelectCmDevice\" ";
sAXLSOAPRequest += "Content-length: ";
// Build the SOAP payload
sAXLRequest = "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" ";
sAXLRequest += "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" > ";
sAXLRequest += "<SOAP-ENV:Body>";
sAXLRequest += "<ns1:SelectCmDevice soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:ns1=\"http://schemas.cisco.com/ast/soap/\">";
sAXLRequest += "<StateInfo xsi:type=\"xsd:string\">";
sAXLRequest += "<CmSelectionCriteria href=\"#id0\"/>";
sAXLRequest += "</ns1:SelectCmDevice>";
sAXLRequest += "<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://cisco.com/ccm/serviceability/soap/\">";
sAXLRequest += "<MaxReturnedDevices xsi:type=\"xsd:unsignedInt\">200</MaxReturnedDevices>";
sAXLRequest += "<Class xsi:type=\"xsd:string\">Any</Class>";
sAXLRequest += "<Model xsi:type=\"xsd:unsignedInt\">255</Model>";
sAXLRequest += "<Status xsi:type=\"xsd:string\">Registered</Status>";
//sAXLRequest += "<NodeName xsi:type=\"xsd:string\">blrl86cucm39</NodeName>";
sAXLRequest += "<NodeName xsi:type=\"xsd:string\" xsi:nil=\"true\">";
sAXLRequest += "<SelectBy xsi:type=\"xsd:string\">Name</SelectBy>";
sAXLRequest += "<SelectItems soapenc:arrayType=\"ns2:SelectItem[1]\" xsi:type=\"soapenc:Array\">";
sAXLRequest += "<item href=\"#id1\"/>";
sAXLRequest += "</SelectItems>";
sAXLRequest += "</multiRef>";
sAXLRequest += "<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/\">";
sAXLRequest += "<Item xsi:type=\"xsd:string\">*</Item>";
sAXLRequest += "</multiRef>";
sAXLRequest += " </SOAP-ENV:Body> </SOAP-ENV:Envelope>";
 
error i get is
HTTP/1.1 500 Internal Server Error
Set-Cookie: JSESSIONIDSSO=D825732FDF671BC292B5E33717AAE18D; Path=/; Secure
Set-Cookie: JSESSIONID=31137345182B4291E0D6908E6B2D7F6A; Path=/realtimeservice; Secure
Set-Cookie: SoapSession.id=8197432947601982528
Content-Type: text/xml;charset=utf-8
Transfer-Encoding: chunked
Date: Sun, 20 Nov 2011 02:55:34 GMT
Connection: close
Server:

209
<?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:Bo
dy><soapenv:Fault><faultcode>soapenv:Server.userException</faultcode><faultstring>org.xml.sax.SAXParseException:
 Premature end of file.</faultstring><detail><ns1:hostname xmlns:ns1="http://xml.apache.org/axis/">blrl86cucm39<
/ns1:hostname></detail></soapenv:Fault></soapenv:Body></soapenv:Envelope>
0

You don't seem to set the content length

You don't seem to set the content length

Hi,
Thanks for your response
I beleive this will take care of content length
sAXLRequest += " </SOAP-ENV:Body> </SOAP-ENV:Envelope>";

sAXLSOAPRequest += sAXLRequest.length();
sAXLSOAPRequest += "\r\n\r\n";
// now add the SOAP payload to the HTTPS header, which completes the AXL
// SOAP request
sAXLSOAPRequest += sAXLRequest;
System.out.println("sAXLSOAPRequest  ************* "+sAXLSOAPRequest);
 
 
or do i need to set manually? if yes what what would be.