客户服务业务流程的内联版本(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
);