06-22-2004 05:45 AM - edited 03-13-2019 05:21 AM
Hello,
we also have new CICSO-technology and want to make XML-Services on 7940/7960. Until now I only made a short TXT-file and it is possible to show the informations on the phones.
But how to make it with XML? Can somebody give me short XML-Example (maybe only to show one line on the phone), to see how it works? Where I can find examples, maybe for download?
Many thanks and regards from Germany
Frank
06-22-2004 06:14 AM
Here is a short example for displaying text:
<%@ Language=JavaScript %>
<%
Response.ContentType = "text/xml";
%>
Copy the above example and save it as a text file, such as test.asp, configure it as a service, subscribe the phone to the new service, and it should display the text.
This is an example in ASP and javascript. It sets the content type to return XML, and uses the XML tag CiscoIPPhoneText to ask the phone to display some text. Other XML tags allow you to display menus, get input from the user, dial the phone, etc.
This link provides more information on the XML tags:
For more information on this, you should get the IP Phone SDK, available from Cisco's Developer Support program. The SDK provides more information on developing applications for the IP Phones, and has example applications in both ASP and JSP.
This page describes the IP Phone SDK:
This page describes the Cisco Developer Support Program:
http://www.cisco.com/pcgi-bin/dev_support/access_level/product_support
06-22-2004 06:34 AM
Hi,
many thanks for it! But my Problem is: My Webserver (where I can put files) is not Windows, so ASP does not work. What can I do? Or maybe without a Window-Server I do not have a chance?
Many thanks an regards.
06-22-2004 06:52 AM
Any web server will work. What web server are you using?
All you need to do to display that example is wrap this text:
In a language of your choice and serve the file as on the web server of your choice. The phone does not care what type of web server you have, and it does not care what language the web page is processed in, as long as it outputs XML. In fact, you can simply save that text as a .xml file and instruct your web server to serve that filetype as XML.
06-22-2004 10:01 PM
Hm, many thanks, but it does not work: If I make like this, the telephone shows only this complete code in display, like in TXT-File.
My server is a Samba/Linux-server. How I must tell the server to work with xml-Files?
If I make xml-files (together with dtd- and css-files) for Internet Explorer, the Browser shows everything correct.
What must I do?
06-22-2004 11:53 PM
Basically, you need a webserver, not a fileserver, as the phones make HTTP requests, not SMB or NFS requests.
Install apache, then put open vi (or emacs or whatever you use as a text editor), type the following:
and save it as example.xml in the root of your webserver (in the httdocs directory), then point your phone to http://ip-address-of-your-apache-server/example.xml and you're all set. Now you'll probably want to use some kind of scripting language, so you need to install either perl or php modules for your apache, or you'll use a jsp application server like Apache/Tomcat. jsp (java server pages) are java based, so if you're familiar with java, this is the obvious choice for you.
06-23-2004 12:32 AM
Of course, a webserver which can open HTTP-Sites...
Our Server is a Suse Linux Enterprise Server (SLES) with Apache 1.3.29
On CCM then I make service http://myserver/test.xml with code you wrote, but the phone always shows complete code (like TXT-file), not only the message.
Sorry, for me it is everything very new, but I do not know whats wrong. Many thanks for your help.
06-23-2004 06:10 AM
Progress!
If the phone displays everything as text, that means the web server treated the test.xml file as text and not XML. That is the reason for the 'Response.ContentType = "text/xml";' line in the example above.
What you need to do is to tell Apache to map the .xml mimetype as text/xml. You can do this by using the AddType directive in the configuration file (ie httpd.conf) by adding a line such as the following with the other AddType directives already in the file:
AddType text/xml .xml .xsl
For information on AddType from the Apache documentation:
http://httpd.apache.org/docs/mod/mod_mime.html#addtype
Here's another page discussing editing the httpd.conf file:
07-09-2004 05:48 AM
Many thanks.
But how it is exactly: Does the phone know, how to show XML-Files, or must the server do this and send the ready result to the phone? Must there a XML-package installed on the server or not?
07-09-2004 06:53 AM
The phone knows how to display XML or plain text content. Therefore the server does not need to know much about XML, except to set the content-type header to indicate to the phone that it is recieving XML rather than plain-text.
When you send content to an IP Phone, if you do not specifically tell the phone that it is in XML format (by setting the content-type header to text/xml), then the phone assumes that the content-type is plain-text, and it just displays whatever you send it as-is on the display.
You would need to configure the .xml mime-type on the server if you wish to serve web pages with the .xml extension as XML, as you were doing through the above posts.
However, the most popular way is to serve web pages to the phones using ASP (in IIS) or JSP (ie Apache). Then you use a programming directive to set the content-type header to text/xml, which essentially does the same thing as setting the mime-type of .xml files to XML.
Sorry if that sounds confusing. The only XML support the server needs is the ability to set the content-type to XML, which should be available on most web servers by default.
02-08-2006 02:25 PM
I am confused between the environment to choose betweek ASP and JSP for developing services for the phones.I have apache tomcat running with xml properly showing on phones only with .xml extension (i setup MIME type in webserver). As I change the page into html format , I see HTML code on phone.
How to get around this problem?
I know content type should be text/xml but where/how to add that statement.I am working in Javascript and Response.Content-type = text/xml is not detected or validate by browser.
Help is appreciated.Thanks.
02-09-2006 12:49 AM
Uh, I think you're mixing things up here. For static XML pages, having the server send the proper mime time is all it takes (and of course the syntax has to be correct). Then even if you access the page via webbrowser on your pc, it will be rendered as xml.
Pages with .html extension will naturally be rendered as HTML on your PC, and plaintext on your phone. But why would you want to use a HTML page for XML anyway? Any page that the IPphone can render must be plain XML, and the only way you get Javascript into a html page is as client side code.. and the IP phone cannot execute javascript. Thus, HTML pages (as in somepage.html.. static content, with or without javascript) make no sense.
I see you're using Apache. Apache on its own has no component for dynamic languages.. any javascript you do is client side (the same applies to tomcat.. tomcat only knows java). You need to install PHP or Perl and generate dynamic XML content via those languages, and also make sure you're adding a statement corresponding to the above Java statement so that the IP Phone will understand that what it gets is XML, not HTML, and thus render it instead of just dumping the plaintext.
In case of jsp pages on Tomcat, the statement to be added before the first return of any information has to be response.setContentType("text/xml"); (as you can see.. once again we're talking about dynamically generated pages.. javascript is a nogo for server side development unless you're using IIS.
02-09-2006 08:44 AM
Thanks for elobarating on this issue.I really appreciate your help. It took me some hours though to figure out that questions I am aksing are quite mixed up.I'll try to be discrete this time with an example.Hopefully this will help all.
Following is simplified from cisco SDK4.1/Clock
sample application.
test.js
// JavaScript Document
<%@ Language=JavaScript %>
<%
response.setContentType("text/xml");
var font
var greeting
var Length = 132
font= "0000000000000000:0000000000000000:0000000000000000:....(This is CIP image for digit '8'/truncated)";
<% = font %>
%>
When I run this on my apache server, it shows up the actuall code instead of digit 8.If this runs correctly, I'll be sure that nothing is wrong with webserver settings.
Your help is greatly appreciated
02-09-2006 10:15 AM
Hi,
If I put
// JavaScript Document
<%@ Language=JavaScript %>
<%
response.setContent("text/xml");
%>
This one shows the exact code instead of just
Can you help me on that.
Thanks.
02-09-2006 12:03 PM
Try
response.setContentType("text/xml");
instead of
response.setContent("text/xml");
Looks like just a syntax error...
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide