I am trying to use the NBR API for my webex site. When I run a downloadNBRStorageFile SOAP request it responds with the webex recording in a stream.
WebResponse response = request.GetResponse();
Stream responseStream = response.GetResponseStream();
When I pull the stream out of the response in C# the stream and write it to a file. The stream and file contain additional header details causing the file to not be able to open in the Network Based Recording Player.
When I inspect the downloaded file from the API in notepad it looks like this:
------=_Part_281_1815085984.1458150816433 Content-Type: text/xml; charset=UTF-8 Content-Transfer-Encoding: binary Content-Id: <0CA08FF0D94F4292B948DF640C1DD4E2>
------=_Part_281_1815085984.1458150816433 Content-Type: application/octet-stream Content-Transfer-Encoding: binary Content-Id:
Bob’s Personal Room-20160108 1435-1.arf 648735 false ------=_Part_281_1815085984.1458150816433 Content-Type: application/octet-stream Content-Transfer-Encoding: binary Content-Id:
[1] èËæV¬æ d ….random characters (.arf file data)
1) How in C# can I save just the file data so that when I save it as file.arf I will be able to open it
WebResponse response = request.GetResponse();
// HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream responseStream = response.GetResponseStream();
MemoryStream memoryStream = new MemoryStream();
String test = responseStream.ToString();
int count = 0;
do
{
count = responseStream.Read(buffer, 0, buffer.Length);
memoryStream.Write(buffer, 0, count);
if (count == 0)
{
break;
}
}
while (true);
result = memoryStream.ToArray();
FileStream fs = new FileStream("c:\\file5.arf", FileMode.OpenOrCreate, FileAccess.ReadWrite);
fs.Write(result, 0, result.Length);
fs.Close();
memoryStream.Close();
responseStream.Close();
Any assistance on this would be much appreciated as I have been stuck on this for a couple days. I'm assuming I have to parse through the multipart stream, to save just the actual file data, but that is where I am stuck at.