For starter, why would you want to call a Receive Pipeline from within an Orchestration?  I had to struggle for a bit to come up with a good reason… I can find it useful in debatching Scenarios that require mapping prior to debatching or for debatching into smaller batches using a map.  I could also find it useful when working with flat file.

Limitations: Calling a Receive Pipeline inside the Orchestration does not support recoverable interchanges (more on this later) and it must be run inside an Atomic Scope.

Super Cool: Supports receiving multiple messages returned from the pipeline and can use enumeration to process each message.
The sample shown below receives a message of type XmlDocument into the Orchestration.  A Receive Pipeline is called to Debatch the message using an Envelope Schema.  A loop shape is used to enumerate over the resulting messages and send each single message.  In addition, references are needed to Microsoft.XLANGs.Pipeline and
The CallPipeline Expression Shape contains the following line of code:

InputPipeline = Microsoft.XLANGs.Pipeline.XLANGPipelineManager.ExecuteReceivePipeline


With InputPipeline defined as an Orchestration Variable of type Microsoft.XLANGs.Pipeline.ReceivePipelineOutputMessages
GetEachMessage will loop the collection using MoveNext like this:


Finally, the single messages are assigned inside the Message Assignment shape like this:

msgSingle = new System.Xml.XmlDocument(); 

With msgSingle defined as an Orchestration Message of a specific schema type.
It is that simple!  In about 5 lines of code the Receive Pipeline can be executed inside on Orchestration in BizTalk 2006!