Related: http://geekswithblogs.net/sthomas/archive/2005/06/16/44023.aspx
Link above goes generally through what to do to call a receive pipeline in an orchestration. Of course it doesn't say how to do it if you're not passing an XmlDocument, but I already figured that out. I'll hopefully make a post after all of this is done showing how to call the HL7 DASM receive pipeline from an orchestration. But that depends on solving this last issue.
The Problem: As seen in the snippet below, the results of the pipeline call are assigned by calling the GetCurrent method of an object of type ReceivePipelineOutputMessages after stepping once through MoveNext.
v_PipeOutput = Microsoft.XLANGs.Pipeline.XLANGPipelineManager.ExecuteReceivePipeline(typeof(BTAHL72XPipelines.BTAHL72XReceivePipeline), msg_RawHL7);
v_PipeOutput.MoveNext();
v_PipeOutput.GetCurrent(msg_HL7);
msg_HL7 is a multipart message, first two parts are XmlDocuments and the third part is a string. This conforms to the message type this pipeline will create. This is where the problem comes in.
As you see GetCurrent is a void, so I can't use it in an construct shape to simply assign the result to my message. "Not a biggie" I thought. I constructed my multipart message and passed it to the void. But I forgot you can't modify existing messages, as seen by the error I got.
Event Type: Information Event Source: Switchboard Event Category: None Event ID: 0 Date: 4/5/2011 Time: 9:47:43 AM User: N/A Computer: SERVERX Description: Illegal attempt to update the value of part 'MSHSegment' in XLANG/s message 'msg_HL7' after the message construction was complete. For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
But it fails at design time if I try to pass an uninitialized message. So, next step would be to try doing this from a helper class. I thought perhaps I could pass to a helper the ReceivePipelineOutputMessges instance as a parameter, and initialize an XLANGMessage there to pass to GetCurrent... and that is where I am stuck.
I was looking through this article to see how to construct XLANGMessage instances, but it really isn't much help to me since it requires you have the content available for you to make a stream out of and I need the message instance to get my content:
http://msdn.microsoft.com/en-us/library/aa995576.aspx
When this goes through the FILE adapter for instance, and you have this pipeline plugged in to the receive location, it is constructing the XLANGMessage from something. It isn't like that method ISN'T calling ExecuteReceivePipeline and it ISN'T getting back a ReceivePipelineOutputMessages and that ISN'T requiring fresh XLANGMessage instances to fill with the resulting messages.So how is it doing it at this last stage? How is it preparing the vessel I am to fill with the result? No documentation anywhere seems to provide any clarity on this.