Re: Stream handling in custom pipeline component
From: Peter Timkˇ (ptimko_at_online.com)
Date: Tue, 15 Jun 2021 08:23:16 +0200
Thanks for your help,
That code part is the following:
Stream s = pInMsg.BodyPart.Data;
StreamReader sr = new StreamReader(s);
MessageBox.Show("Message Body:\r\n" + sr.ReadToEnd(), "Pipeline Tracer -
Message Data - " + pContext.PipelineName, MessageBoxButtons.OK,
"John Plummer [MSFT]" <firstname.lastname@example.org> wrote in message
> It might be easier if you attach a code sample
> are you setting the stream to Pos=0;
> "Peter Timkˇ" <email@example.com> wrote in message
> > Dear All,
> > I've created a simple general pipeline which purpose would be to trace
> > the message and the message context. This component is allowed to be in
> > decode, validate, resolve party, encode stages.
> > I'm using the Stream s = pInMsg.BodyPart.Data; statement to get the data
> > stream (according to the documentation the data property clones the
> > stream). After it I use a StreamReader class and the ReadToEnd method to
> > read from the stream. When it is finished I close the stream (i think it
> > ok because it is not the original stream).
> > If this pipeline component is in the decode stage it works just fine.
> > it is in the Validate stage it can read out the message data from the
> > stream, but BizTalk doesn't get message, and throw an error to the
> > If it is in the encode stage in the send side the components can read
> > message but the output message is empty.
> > The last statement in my IComponent.Execute method is return pInMsg to
> > always return the original message and context.
> > What am I doing wrong?
> > Regards:
> > Peter