Compartir a través de


Uso de canalizaciones desde la solución orientada a servicios

La versión en línea de la orquestación de servicio al cliente (CustomerService) llama directamente al sistema de seguimiento de pagos. Para preparar el mensaje enviado y procesar el mensaje recibido, la orquestación llama a las canalizaciones desde el código. Esto permite la reutilización de las canalizaciones de las otras versiones de escenarios. También mantiene el desacoplamiento de la orquestación de las etapas de la canalización.

Llamada a las canalizaciones

Para usar las canalizaciones desde el código, debe crear una colección de mensajes, agregar el mensaje a procesar a la colección, crear un mensaje vacío para recibir el mensaje de resultado e invocar la canalización.

El código siguiente de la orquestación CustomerService está en la forma 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  
    );  

La forma GetLastPaymentResponse toma el mensaje del código anterior, lo envía al sistema de seguimiento de pagos y procesa el mensaje devuelto a través de la canalización de recepción:

// 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  
        );  

Véase también

Aspectos destacados de la implementación de la solución orientada a servicios