ecmascript reading xml from a remote server

Posted on 2004-08-04
Last Modified: 2006-11-17

For a voice-xml application I need to check the validity of user input. The voice system runs on a third party server and uses ECMAscript 262. I want to do a get/post to my own server (e.g. http://myserver/vxmlservice?input="1") which then checks the input and replies with true or false or a list of possible options (in xml format). How can I send the request and read the reply (in xml) with ECMAscript?

Many thanks in advance,

Question by:adje_
  • 5
  • 3
LVL 63

Expert Comment

ID: 11714220
With a hidden IFRAME you can call that server and read the response in the iframe onLoad event.
LVL 63

Expert Comment

ID: 11714242
But the biggest problem in that approach is that both servers, the one who provides the parent page and the other whith the iframe url, both need to be in the same internet domain.
Otherwise there is a security restriuction to acces foreign domains.
That security restriction is removed when the main page is loaded localy with a file name extensio .hta


Author Comment

ID: 11714694
The application is not a webbrowser. Is there an iframe object or some other object to instantiate, so I can make the request in ecmascript.

For instance,

myXml = new XML();
myXml.url = "http://myServer/..";
myXml.onLoad = function;
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

LVL 63

Expert Comment

ID: 11714758
Do you know HTA?
It stands for HyperTextApplication.

And for XML you use:
    var zipcode = "20166";
    var theURL = "" + zipcode;
    var httpReq = new ActiveXObject("Microsoft.XMLHTTP");
    var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");

Author Comment

ID: 11715610
Unfortunately, HTA as well as those nice ActiveX objects are not supported by the voice interpreter. Is there no crude old fashioned way. Like reading Http streams and put them in an object??
LVL 63

Expert Comment

ID: 11715799
If your voice interpreter can execute JavaScript, then where is the problem to create ActiveX objects?

Author Comment

ID: 11715875
Well, they say they support ecmascript and they do not run on a windows platform
LVL 63

Accepted Solution

Zvonko earned 125 total points
ID: 11716377
Ahh, ok see.
Buth then you need some other script engines. First idea would be Perl. They have packages for opening html streams.
Also php, but I do not know wether Perl nor PHP is ecma conform.

Featured Post

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
In my daily work (mainly using, I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question