Digital Leisure

I'm sending an HTTP_POST to our server and receiving a text string in response (using an Xbox). When I direct the response to a file in persistent storage everything works perfectly. When I direct the response to filecache the response comes back as garbage characters and is about half as long which leads me to believe that maybe there are some unicode issues.

When running on PowerDVD the response comes back correctly in both persistent storage and filecache.

I'm using the following as my header type:
sendHTTPClient.requestHeaders.setHeader("content-type", "application/x-www-form-urlencoded");

Is this the correct setting




Re: HD DVD Interactivity Authoring HTTP download to filecache

Amy Dullard - MSFT

The header you are setting affects what you are sending TO the server. What is the charset on the content coming FROM your server When you receive the string, how are you writing it to p-storage or the filecache






Re: HD DVD Interactivity Authoring HTTP download to filecache

Digital Leisure

I believe the server is sending plain text but not sure how to confirm this.

I'm directing the file with:
sendHTTPClient.downloadFileLocation = ResponseFile;

ResponseFile is either:

var PERSISTENT_PREFIX = "file:///required/";
var FILECACHE_PREFIX = "file:///filecache/";

phpResponseFile=FILECACHE_PREFIX+"response"+uniqueNumber+".txt";
or
phpResponseFile=PERSISTENT_PREFIX+"response"+uniqueNumber+".txt";

Conceivably the problem could also be with my reading of the file once it has been received but again I use the same code to read it whether in persistent or filecache:

var cbfnRead = function(pTextStream,pErrorInfo){
if(pErrorInfo == FileIO.SUCCEEDED){
//Reads all the content of the file
var responseVar = pTextStream.readAll();

}

};
FileIO.openTextFile(
phpResponseFile, //File URI
FileIO.FILE_IOMODE_READ, //Open in this mode
false, //Not overwrite
false, //Not create new one
cbfnRead //Callback function
);

Is there any way to direct the response directly into a variable rather than a file





Re: HD DVD Interactivity Authoring HTTP download to filecache

Digital Leisure

Sorry, treat phpResponseFile and ResponseFile as the same -- typo.




Re: HD DVD Interactivity Authoring HTTP download to filecache

Amy Dullard - MSFT

If you just need the file saved, don't set downloadFileLocation and instead when the status is complete, look at sendHTTPClient.getResponseString() (note, you can only call this function once)






Re: HD DVD Interactivity Authoring HTTP download to filecache

Digital Leisure

Works Great! Thanks Amy.