05-25-2015 12:28 AM
I'm a newbe with axl programming.
I have problem to create a addphone I get a error 500.
Everthing that I try don't work
I have CUCM version 8.6
All in in c#
Casn any one help me or point me in the write direction.
Thanks.
My code is:
private void ADDPHONE()
{
//string version = Properties.Settings.Default.CUCMVersion;
string version = "8.5";
string soap = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns=\"http://www.cisco.com/AXL/API/8.5\">\n";
soap += "<soapenv:Header/>\n";
soap += "<soapenv:Body>\n";
soap += "<ns:addPhone sequence=\"?\">\n";
soap += "<phone >\n";
soap += "<name>SEP000000123456/name>\n";
soap += "<description>IP Phone Test</description>\n";
soap += "<product>Cisco 7961G-GE</product>\n";
soap += "<class>Phone</class>\n";
soap += "<protocol>SCCP</protocol>\n";
soap += "<protocolSide>User</protocolSide>\n";
soap += "<callingSearchSpaceName uuid=\"?\">DN_Global</callingSearchSpaceName>\n";
soap += "<devicePoolName uuid=\"?\">Default</devicePoolName>\n";
soap += "<lines>\n";
soap += "<line ctiid=\"?\">\n";
soap += "<index>1</index>\n";
soap += "<label>?</label>\n";
soap += "<display>?</display>\n";
soap += "<dirn uuid=\"?\">\n";
soap += "</dirn>\n";
soap += "<ringSetting>Ring</ringSetting>\n";
soap += "<consecutiveRingSetting>Use System Default</consecutiveRingSetting>\n";
soap += "<e164Mask></e164Mask>\n";
soap += "<mwlPolicy>Use System Policy</mwlPolicy>\n";
soap += "</line>\n";
soap += "</lines>\n";
soap += "<phoneTemplateName uuid=\"?\">Standard 7961G-GE SCCP</phoneTemplateName>\n";
soap += "<speeddials>\n";
soap += "<speeddial>\n";
soap += "<label>Jan Test</label>\n";
soap += "<index>1</index>\n";
soap += "</speeddial>\n";
soap += "</speeddials>\n";
soap += "<services>\n";
soap += "<service>\n";
soap += "<telecasterServiceName uuid=\"?\">Mobility</telecasterServiceName>\n";
soap += "<name>Mobility</name>\n";
soap += "</service>\n";
soap += "</services>\n";
soap += "<softkeyTemplateName uuid=\"?\">Standard User</softkeyTemplateName>\n";
soap += "<enableExtensionMobility>false</enableExtensionMobility>\n";
soap += "</phone>\n";
soap += "</ns:addPhone>\n";
soap += "</soapenv:Body>\n";
soap += "</soapenv:Envelope>\n";
Logging.Text += "---------|AXL Request|---------\n\n";
Logging.Text += soap + "\n\n";
#region AXL SOAP
try
{
byte[] soapBytes = Encoding.UTF8.GetBytes(soap);
ServicePointManager.ServerCertificateValidationCallback += delegate { return true; };
HttpWebRequest httpRQ = (HttpWebRequest)HttpWebRequest.Create(string.Format(@"https://xxx.xxx.xxx.xxx:8443/axl/"));
httpRQ.ProtocolVersion = System.Net.HttpVersion.Version10;
httpRQ.Credentials = new NetworkCredential("AXLAdmin", "AXLPassword");//Callmanager gebruikersnaam / password
httpRQ.Method = "POST";
httpRQ.ContentType = "text/xml; charset=utf-8";
httpRQ.Accept = "text/xml";
httpRQ.Headers.Add("SOAPAction: 'CUCM:DB ver=" + version + "'");
httpRQ.ContentLength = soapBytes.Length;
//Send the xml soap to cucm
Stream stm = httpRQ.GetRequestStream();
stm.Write(soapBytes, 0, soapBytes.Length);
stm.Close();
//Build the xml response
XDocument responcedoc = new XDocument();
HttpWebResponse responce = httpRQ.GetResponse() as HttpWebResponse;
Stream responcedata = responce.GetResponseStream();
StreamReader responsereader = new StreamReader(responcedata);
Logging.Text += "\n---------|AXL Response|---------\n\n";
XDocument respdoc = XDocument.Load(responsereader);
Logging.Text += respdoc + "\n";
soap = null;
}
catch (Exception ex)
{
Logging.Text += "\n";
Logging.Text += "\n---------|AXL Error|---------\n\n";
Logging.Text += string.Format("\n" + DateTime.Now + ":: ERROR :: Message: {0}\n", ex.Message);
}
#endregion
}
Jan Meeling
05-25-2015 05:04 PM
Hi,
Please go to this website to have a look at. There are some samples as adding phone, line, user...
Administrative XML (AXL) Developer Cookbook
Regards
Thuy Doan
05-26-2015 01:43 AM
Hi Thuy,
I have testen some examples of it but it don’t work.
Thanks for your quick response
Regards,
Jan Meeling
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: