Hi
I imported several webservice vi, according to webservice document, there is one service, which has a parameter is stream bytes. customer demonstrated the way of using C# to read/convert a file to bytes stream.
byte[] FileToStream(string fileName)
{
// Open file
using (FileStreamfileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read))
{
// read file byte[]
byte[] bytes = new byte[fileStream.Length];
fileStream.Read(bytes, 0, bytes.Length);
fileStream.Close();
// convert byte[] to Stream
Stream stream = new MemoryStream(bytes);
byte[] bytes = new byte[stream.Length];
stream.Read(bytes, 0, bytes.Length);
// set position
stream.Seek(0, SeekOrigin.Begin);
return bytes;
}
}
My question is how can convert a file (in fact it is a pdf file) to that kind of byte stream which is expected by that webservice?
thanks
WD