Re: Excel pipeline component decode or disassemble?

Home Page Forums BizTalk 2004 – BizTalk 2010 Excel pipeline component decode or disassemble? Re: Excel pipeline component decode or disassemble?

#25618

In the Execute method you do not have to create a new message. You can just modify the data stream:

public IBaseMessage Execute(IPipelineContext Context, IBaseMessage inMsg)
{
   Stream originalStream = inMsg.BodyPart.GetOriginalDataStream();
   Customers customers = GetCustomers(fileName, originalStream);
    MemoryStream memoryStream = new MemoryStream();
    XmlSerializer xs = new XmlSerializer(typeof(Customers));
    XmlTextWriter xmlTextWriter = new XmlTextWriter(memoryStream, Encoding.UTF8);
    xs.Serialize(xmlTextWriter, customers);
    memoryStream.Seek(0, SeekOrigin.Begin);     return InMsg;
}