Difference between htp.p and simply retrieving a file
pashtoJul 22 2008 — edited Oct 8 2008Hi All,
I've been tearing my hair out with this and have finally given up.
I've been playing with some charting alternatives and have been looking at FusionCharts (Free). Without going into too much detail regarding how you configure these charts in essence you reference a URL that contains the location of an XML data source for the content of the chart. I've configured a simple HTML region that references the FusionChart object and if I configure the dataURL as the location of an actual XML file on the webserver it works no problem, however if I reference an application process or standalone procedure it does not work. I suspect the problem has something to do with the difference between how a file is delivered over HTTP and how its being presented via the application process/stored procedure but that's just a guess.
To try and take as much Apex out of the loop as possible I created a stored procedure that I reference via a URL (e.g. http://127.0.0.1:8080/apex/myTestProc) which returns exactly the same text content as http://127.0.0.1:8080/data.xml (I switched to a procedure just in case it had something to do with session state/security).
I define the HTTP header in the stored procedure as
owa_util.mime_header('text/xml', FALSE );
htp.p('Content-length: ' || LENGTH(l_xml));
htp.p('Content-Disposition: filename="data.xml"');
owa_util.http_header_close;
as I thought it probably relates to the HTTP header. Once the header is set I simply htp.p the 10 or so lines of XML. 'Fiddler' says the two requests return the same data in the same format. Everything looks right but clearly something is amiss.
I've had a look at Scotts ODTUG presentation in which he covered some of this but I cannot get enough from the presentation document to help - it does suggest that what I've done should work though.
Any ideas? I suspect this is a more general question regarding how I'm returning the data using htp.p than specifically an issue with FusionCharts. I'm running this on XE using the embedded PL/SQL gateway presently and Apex 3.1. I haven't had chance yet to try it on using OHS but I'm guessing I'll have the same problem (I will try it though). I'm hoping its not some weird 'flash' security issue or something like that but I cannot see why as in essence both requests seem to return the same content.
Any help gladly appreciated.
Cheers,
Paul.