サービス指向ソリューションからのパイプラインの使用
カスタマー サービス オーケストレーション (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
);