You must not close the incoming data stream object.
Additionally, you must make sure that you read from the incoming data stream
until the end of the stream is reached. For example, if the custom code makes a
read request for 300 KB of data and the code only receives 34 KB of data, do
not assume that the end of the stream has been reached. The custom code must
always read from the incoming stream until 0 bytes is returned.
At
the end of a custom pipeline component, make sure that you "rewind" the data
stream pointer back to the start of the stream. Typically, you do this just
before returning the data stream near the end of the custom component logic.
For example, use the following code.
myDataStream.Seek(0, SeekOrigin.Begin);
return myDataStream;
If you do not do this and the stream is read to the end in the current
component, the next component receives what appears to be an empty stream
because the data stream pointer was not rewound. This can cause unexpected
parsing and validation errors in follow-on pipeline components.
For
more information about how to handle incoming data streams in BizTalk Server
2006, visit the following Microsoft Developer Network (MSDN) Web site:
For more information about BizTalk Server 2004, visit the
following Microsoft Web site:
For more information about how to create seekable streams in the
Microsoft .NET Framework, visit the following Microsoft Developer Network
(MSDN) Web site:
For more information about custom pipeline processing in BizTalk
Server 2004, visit the following MSDN Web site: