PDA

Click to See Complete Forum and Search --> : XML data seen through File System but not through Web Server



Paulo Parola
06-20-2001, 05:38 PM
Hi,

The following code returns me some news I get from my server using XML. All the news are shown with no problems when accessing an HTML file with the Flash Movie embedded within an OBJECT / EMBED tag through my file system (I directly load the HTML into my browser). When I try to access the same HTML file, this time not directly in my browser, but through some HTTP server, nothing is printed on the screen. Being more clear:

D:\usr\my_news.html -> HTML with embedded SWF which works great to return the news got via XML from the Internet

http://localhost/my_news.html -> the same HTML with embedded SWF, but it shows nothing

http://some_domain/my_news.html -> the same HTML with embedded SWF, but it shows nothing

I get the XML data from the Internet with the following commands:

resultXML = new XML();
resultXML.onLoad = onReply;
resultXML.load("http://internet_domain/my_news.xml");

And the function called when the XML loading process is finished is:

function onReply () {
headlineNode = this.firstChild;
infoNode = headlineNode.firstChild;
news = new Array();
links = new Array();
i = 0;
already_read = true;

do {
infoIDNode = infoNode.firstChild;
infoID = infoIDNode.firstChild.nodeValue;
editionSectionIDNode = infoIDNode.nextSibling;
editionSectionID = editionSectionIDNode.firstChild.nodeValue;
infoTitleTextNode = editionSectionIDNode.nextSibling;
infoTitleText = infoTitleTextNode.firstChild.nodeValue;
links[i] = 'http://some.domain/my_news.asp?infoid='+infoID+'&editionsectionid='+editionSectionID;
news[i] = unescape(infoTitleText);
infoNode = infoNode.nextSibling;
i++;
} while (infoNode != null);

/tickers:ticker1 = news[0];
/tickers:ticker2 = news[1];
/tickers:ticker3 = news[2];
/tickers:url1 = links[0];
/tickers:url2 = links[1];
/tickers:url3 = links[2];
}

The above code is known to function all right for the XML structure returned. It really only does not show anything when the HTML is accessed through a HTTP server.

FIY, the XML accessed is like:

<?xml version="1.0" standalone="yes" ?>
<headlines>
<info>
<infoID>39</infoID>
<editionSectionID>4</editionSectionID>
<infoTitleText>Here comes the headline</infoTitleText>
</info>
</headlines>

And the HTML has the following code (we tried to generate it automatically from within Dreamweaver Ultradev and then also from within Flash):

<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0"
WIDTH=120 HEIGHT=160>
<PARAM NAME=movie VALUE="my_news.swf">
<PARAM NAME=menu VALUE=false>
<PARAM NAME=quality VALUE=high>
<PARAM NAME=bgcolor VALUE=#AAAAAA>
<EMBED src="my_news.swf" menu=false quality=high bgcolor=#AAAAAA WIDTH=120 HEIGHT=160 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED>
</OBJECT>

Any ideas?

TIA,
Paulo

tupps
06-20-2001, 10:30 PM
I think (not 100%) sure you are fitting flash security, which is similar to the sandboxing that Java receives when running from a web server.

Have a look at page 128 of the ActionScript reference guide for information about the way the security is set up with in flash when making a request to a external web server.

Thanks

Luke

VAYKENT
06-21-2001, 07:31 PM
Or... check out the 'Bible' - "ActionScript: The Definitive Guide" on page 490 table R-8. I haven't seen a more concise explanation of the security restrictions yet.

jonath
06-27-2001, 06:11 PM
I've read the reference about and security and at least now i know the reason why it doesn't work. This is valuable step 1. But now how do i solve this problem.
What should i do? are there anyway around it? I'm using moreover.com news.

tupps
06-27-2001, 08:46 PM
One possibility is to use a server side script that gets the news from moreover.com.

You either get it every time there is a request and spit it out, or if you have access to the web server (and it was unix based) you could setup a cron job with wget to download the XML every hour or so.

Or you could even use a external machine to download the XML and ftp it onto the web server.

Thanks

Luke