1 / 23

Building Workflow Services in .NET 3.5

Building Workflow Services in .NET 3.5. CLAEYS Kurt, ORDINA. www.devitect.net. Agenda. Windows Communication Foundation Overview. Client. Service. A. B. C. A. B. C. C. B. A. A. B. C. Address Where?. Binding How?. Contract What?. WCF Contracts. [ ServiceContract ]

fritzi
Download Presentation

Building Workflow Services in .NET 3.5

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Building Workflow Services in .NET 3.5 CLAEYS Kurt, ORDINA • www.devitect.net

  2. Agenda

  3. Windows Communication Foundation Overview Client Service A B C A B C C B A A B C Address Where? Binding How? Contract What?

  4. WCF Contracts [ServiceContract] public interface IKBO { [OperationContract] void RegisterCompany(CompanyFile data); } [DataContract] public class CompanyFile { [DataMember] public string companyName { get; set; } [DataMember] public string VATID { get; set; } }

  5. Windows Workflow Foundation Overview Workflow Activities Activity Library Workflow Runtime Persistence Service

  6. WorkflowServiceHost - Workflow ServiceHost Client WCF WCF WCF Endpoint WorkflowServiceHost Service WCF Endpoint Workflow A A B B C C

  7. Start – More Input – Action ! WorfklowService Start Client 1 Client 2 Service Wait More Input Action

  8. ReceiveActivity • Activity that implements an operation defined by a Windows Communication Foundation (WCF) service contract. • To implement service behavior : add child activities to the ReceiveActivity Client

  9. Binding an operation contract to a ReceiveActivity • ServiceOperationInfo property • Add Contract = Workflow First • Import = Contract First

  10. Contract First vs Workflow First approach • Contract First • You have a WCF contract (=interface) • You map receiveActivities in workflows to the operations in the contract • SOA • Workflow First Approach • No WCF contract present • Create contract as you model the workflow • More agile

  11. ContextExhange Protocol some data Start “creates” instance Client 1 Client 2 some data + instanceID WorkflowPersistenceDB EC969B-4239-427E-BB0A-9F7E5610A1F0 instanceID some data + instanceID More Input “follows” instance EC969B-4239-427E-BB0A-9F7E5610A1F0

  12. CanCreateInstance • CanCreateInstance (true/false) • Gets or sets whether the operation on a ReceiveActivity causes a new workflow service instance to be created or to participate in an already instantiated workflow.

  13. Persisting the instance Start CanCreateInstance = true • Creates an InstanceID-Sends it to the Client • Allows to persists WF instance EC969B-4239-427E-BB0A-9F7E5610A1F0 CanCreateInstance = false More Input • Expects an InstanceID • Load persisted WF instance

  14. SendActivity • Activity that models the synchronous invocation of a service operation. • Use ChannelToken as reference to client endpoint Service

  15. ChannelToken - Endpoint <client> <endpoint address="http://localhost:4321/Foo" binding="basicHttpBinding" bindingConfiguration="" contract=“IFOO" name=“TheEndpointForTheService" /> </client>

  16. WorkflowServiceHost WorkflowServiceHost host; host = new WorkflowServiceHost(typeof(TheWorkflow)); host.Open();

  17. Participating Client DossierInterface.IDossier proxy; System.ServiceModel.Channels.Binding b; b = new NetTcpContextBinding(); EndpointAddress ea; ea = new EndpointAddress("net.tcp://localhost:9876/TheWorkflow"); proxy = ChannelFactory<DossierInterface.IDossier>. CreateChannel(b, ea); System.ServiceModel.Channels.IContextManager cm; cm = ((System.ServiceModel.IContextChannel)proxy). GetProperty<System.ServiceModel.Channels.IContextManager>(); var d = cm.GetContext(); d["instanceId"] = textBox1.Text; cm.SetContext(d); proxy.PaymentReceived();

  18. DEMO

  19. Demo Scenario Step 1 User starts the process by filling in data in a webapplication Step 2 Process StartedGenerate paymentreference Step 3 User gets paymentreference Step 4 Process waits for payment for amount of time Step 5 User pays Step 6 Process receives payments and continues Step 7 Process data is send to external service

  20. Wrap-up • What to remember about workflow services • Workflows Services is an easy technology to build processes that integrate WCF Services • Start with creating interfaces (= contract first approach) • Share interface to all participants • Importance of the instanceId • Database for persisting workflows makes the process long running ! • Have a delay activity for every ‘waiting for input’ scenario • Have a look at WCF 4.0 and Dublin !

  21. Links • Some links to get you started ... • This Example • http://www.devitect.net/techdays09 • Workflow Services (Foundation) • http://msdn.microsoft.com/en-us/magazine/cc164251.aspx • Context Exhange Protocol • http://msdn.microsoft.com/en-us/library/bb924468.aspx • WF and WCF integration in .NET 3.5 • http://channel9.msdn.com/shows/The+EndPoint/WF-and-WCF-integration-in-NET-35/ • Workflow Services Samples (WF) • http://msdn.microsoft.com/nl-be/library/bb943473(en-us).aspx • Workflows, Services, and Models, A First Look at WF 4.0, “Dublin”, and “Oslo” • http://msdn.microsoft.com/en-us/library/dd200919.aspx

  22. Q/A

  23. Thanks kurt.claeys@ordina.be

More Related