使用面向服务的解决方案中的管道
客户服务业务流程的内联版本 (CustomerService) 直接调用付款跟踪系统。 为准备发送的消息和处理接收的消息,业务流程将通过代码调用管道。 这将允许重用其他方案版本中的管道。 还可保持业务流程与管道阶段的分离状态。
调用管道
若要通过代码使用管道,则必须创建消息集合,向该集合添加要处理的消息,创建用于接收结果消息的空消息,然后调用管道。
CustomerService 业务流程中的以下代码位于 ConstructRequestMessageAfterSendPipeline 形状中:
// Create the collection of messages to be sent to the send pipeline...
sendPipelineInputMessages =
new Microsoft.XLANGs.Pipeline.SendPipelineInputMessages();
sendPipelineInputMessages.Add(LastPaymentRequest);
// Create an empty message for the output from the pipeline...
LastPaymentRequestAfterSendPipeline = null;
// Execute the send pipeline and get the message output from
// the send pipeline.
Microsoft.XLANGs.Pipeline.XLANGPipelineManager.
ExecuteSendPipeline(
typeof(
Microsoft.Samples.BizTalk.
WoodgroveBank.PaymentTrackerPipelines.
PaymentTrackerSendPipeline
),
sendPipelineInputMessages,
LastPaymentRequestAfterSendPipeline
);
GetLastPaymentResponse 形状从上述代码获取消息,将其发送到付款跟踪系统,并通过接收管道处理返回的消息:
// Execute the inline method to send the message to the
// Payment Tracking System and get the response.
// The response message received should be passed through the
// receive pipeline.
LastPaymentResponseBeforeReceivePipeline =
Microsoft.Samples.BizTalk.
WoodgroveBank.
PaymentTrackerCall.
PaymentTrackerCaller.
GetPaymeTrackerResponse
(
LastPaymentRequestAfterSendPipeline
);
// Execute the receive pipeline using the helper class so that we don't
// need to declare the non-serializable types involved.
// Set the documentspec name so the xml disassembler in the
// pipeline can resolve the schemas for the received message
// without ambiguity.
LastPaymentResponseBeforeReceivePipeline(XMLNORM.DocumentSpecName) =
"Microsoft.Samples.BizTalk.WoodgroveBank.Schemas.LastPaymentResponse, Microsoft.Samples.BizTalk.WoodgroveBank.Schemas, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5f57a322d27bc5fb";
// Create an empty response message and fill it in with the
// real response from the Payment Tracking System
LastPaymentResponse = null;
Microsoft.Samples.BizTalk.WoodgroveBank.Utilities.
ReceivePipelineHelper.CallReceivePipeLine (
typeof(
Microsoft.Samples.BizTalk.WoodgroveBank.
PaymentTrackerPipelines.PaymentTrackerReceivePipeline
),
LastPaymentResponseBeforeReceivePipeline,
LastPaymentResponse
);