cancel
Showing results for 
Search instead for 
Did you mean: 

SaveFileBytesToUserTempFolder returning an error message

Sergey
Contributor

Hi,

I am trying to use the Business Rule API "SaveFileBytesToUserTempFolder" in order to open a file stored as a byte in a datatable.

This is exactly like in the "Reporting Compliance" dashboard, where the file is stored as bytes in a datatable. I am actually using the exact same business rule !

 

However, there is an issue in my case. My business rule that is used to view the document works fine until the very last step... this is the one causing the error ( I have tested FileName and FileBytes fields and these exist) :

BRApi.Utilities.SaveFileBytesToUserTempFolder(si, si.UserName, dt(0)("FileName"), dt(0)("FileBytes"))

Error message :

An error occurred while receiving the HTTP response to http://localhost:50002/OneStreamApp/SVC/XFFileSystem.svc. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details.
The underlying connection was closed: An unexpected error occurred on a receive.
Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
An existing connection was forcibly closed by the remote host (Socket Error Number 10054).
 

 

The exact same file is used in Reporting Compliance and I can view it. Am I missing something ?

I don't find any documentation on this function ...

 

Regards,

1 REPLY 1

NicolasArgente
Contributor III

Hi Sergey!
Have you tried browsing to http://localhost:50002/OneStreamApp/SVC/XFFileSystem.svc you might find more info.

Also did you check that the extension is on the filename? My understanding is that the fileBytes is already good on your side? Have you tested it? for example using https://base64.guru/converter/decode/file

Or Have you tried with the exact same base64 (byte) than with the other file or see if there is a difference? Have you hard coded the fileName instead to "test.csv" or "test.xls" depending on the filetype?

 

'Export Register
Dim fileName As String = "Register.csv"

'Export CSV to User Temp Folder
Dim csv As String = Me.CreateRegisterTableCSVText(si, profileName, scenarioName, timeName).ToString
Dim fileBytes As Byte() = Encoding.UTF8.GetBytes(csv)
BRApi.Utilities.SaveFileBytesToUserTempFolder(si, si.UserName, fileName, fileBytes)