May 14, 2008

Call External Method

In a workflow, to call the external method, you need the following ready.

  • The workflow need a interface marked with ExternalDataExchange. In the callExternalMethodActivity node, you need to configure the InterfaceType, MethodName, MethodInvoking, and what value to be used as passed-in parameter.
  • In workflow host, you need to config the workflow runtime to service the ExternalService. When a workflow instance execute an callExternalMethodActivity, it will ask the workflow runtime to supply a service.
            //workflow definition
            public interface ICustomerService
            void SendCustomerData(string customerName);

            //host enviroment code
            public class CustomerService : ICustomerService

            public void SendCustomerData(string customerName)

            ExternalDataExchangeService xchangeSvc = new ExternalDataExchangeService();
            CustomerService custSvc = new CustomerService();