3 Replies Latest reply on Aug 20, 2014 6:52 PM by Adrienne Moherek

    <CiscoIPPhoneExecute> error

    dglanton1

      Im wanting to send a <CiscoIPPhoneExecute> xml command to a 7921G phone. When i send the command, the phone shows "Host Not Found" and the response from my stream say "The remote server returned an error: (500) Internal Server Error." I want to write this in c# but could do it in Java also. This used to work for me a while back but it is not anymore. Any help would be appreciated!

       

      My Code:

       

      WebResponse resp = null;

      string ErrorCode = "";

      string ResponseXML = "";

      string pushXML = "<CiscoIPPhoneExecute>";

      pushXML += "<ExecuteItem Priority=\"0\" URL=\"Play:Vibe.raw\"/>";

      pushXML += "</CiscoIPPhoneExecute>";

      pushXML = "XML=" + HttpUtility.UrlEncode(pushXML);

      string PhoneURL = string.Format("http://{0}/CGI/Execute", "MyIPAddress");

      HttpWebRequest req = (HttpWebRequest)WebRequest.Create(PhoneURL);

      req.Method = "POST";

      req.AllowAutoRedirect = false;

      req.ContentType = "application/x-www-form-urlencoded";

      req.Credentials = GetCredentials("MyUsername", "MyPassword");

      byte[] bytes = null;

      bytes = System.Text.Encoding.UTF8.GetBytes(pushXML);

      Stream outputStream = req.GetRequestStream();

      outputStream.Write(bytes, 0, bytes.Length);

      outputStream.Close();

       

       

      resp = req.GetResponse();

      Stream s = resp.GetResponseStream();

      StreamReader stm = new StreamReader(s);

       

      if (stm == null)

      {

           "Timed out or no response!";

      }

      else

      {

                ResponseXML = stm.ReadToEnd();

                stm.Close();

      }

       

      s.Close();

      resp.Close();