客戶服務協調流程 (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
);