Building WCFbased Services with WFenabled Business Logic - PowerPoint PPT Presentation

1 / 30
About This Presentation
Title:

Building WCFbased Services with WFenabled Business Logic

Description:

Building WCF-based Services with WF-enabled Business Logic. Christian Weyer. thinktecture. Co-Founder & Solution Architect. http://www.thinktecture.com/staff/christian ... – PowerPoint PPT presentation

Number of Views:31
Avg rating:3.0/5.0
Slides: 31
Provided by: downloadM
Category:

less

Transcript and Presenter's Notes

Title: Building WCFbased Services with WFenabled Business Logic


1
Building WCF-based Services with WF-enabled
Business Logic
  • Christian Weyer
  • thinktecture
  • Co-Founder Solution Architect
  • http//www.thinktecture.com/staff/christian
  • christian.weyer_at_thinktecture.com

2
Building WCF-based Services with WF-enabled
Business Logic
  • Christian Weyer
  • thinktecture
  • Co-Founder Solution Architect
  • http//www.thinktecture.com/staff/christian
  • christian.weyer_at_thinktecture.com

3
What To Expect
  • WCF ABC 101
  • WF 101
  • WCF Internals 101
  • Hosting WF
  • Manually hosting WF in WCF operations
  • Custom WCF behaviors for hosting WF
  • Custom WCF ServiceHost and WF activities
  • Orcas WF Activities for WF
  • Orcas WCF ServiceHost for WF

4
WCF WF
  • Twins separated at birth?

5
WCF ABC 101
6
WCF Birds Eye View
Client
Service
Endpoint
Endpoint
Endpoint
Endpoint
7
WCF Address, Binding, Contract
Service
Client
C
B
A
C
B
A
A
B
C
C
B
A
Address Where?
Contract What?
Binding How?
Endpoint
8
WCF Internals 101
9
WSDL Importer
Service Model Layer
Contract
Contract
WSDL Exporter
Client Code parameters
Service Type parameters
Operation Invoker
Dispatcher Runtime
Parameter Inspector
Parameter Inspector
Client Runtime
Message Formatter
Message Formatter
Operation Selector
Message Inspector
Message Inspector
Channel
Channel Layer
Custom Channel
Channel
Custom Channel
Channel
Custom Channel
Channel
Custom Channel
Transport Channel byte
Transport Channel byte
Encoder
Encoder
Custom Encoder
Custom Encoder
Custom Transport
Custom Transport
Added by configuring the runtime with behaviors
Added by adding binding elements to the binding
10
Layered Extensibility
Service Model Extensibility (local only)
Channel Extensibility (affects the wire)
11
WF 101
12
WF Overview
13
WF Runtime
14
Integrate WCF and WF
  • Why?
  • WCF is a programming model for building services
    using the CLR
  • WF is a programming model for building
    application logic for CLR based application logic
  • No OOB integration layer in .NET 3.0
  • WF ships with simple ASMX integration layer
  • WCF integration layer is targeted for .NET 3.5

15
Integration Models
16
Inevitable Facts
  • Determine how to maintain necessary WF state
  • Workflow Intstance ID
  • Necessary for multi-operation only
  • Instance management
  • What messages are creation messages
  • What instance to route non-creation messages
  • Data management
  • Choose a pattern for retrieving response data
    from WF

17
Integration Levels
  • Build a WF Type and a WCF Service Type
  • Pros
  • Simple programming model
  • Doesnt couple service to only workflow for
    implementation
  • Cons
  • Extra work for each workflow type

18
Custom ServiceHost
  • WCF ServiceHost/ServiceHostBase can be derived
    from
  • Do not need .NET type implementation of the
    ServiceContract type
  • Build a ServiceHost that uses a WF for its
    implementation
  • Pros
  • Extensible for multiple types with no extra code
  • Cons
  • Extra upfront work

19
Managing Correlation
  • Message-managed
  • Pass InstanceID as response to creation message
  • Make client pass it back as part of each
    non-creation message
  • SOAP Header-managed
  • Use MessageContract and make SOAP Header for
    InstanceID value on response of creation message
  • Client passes value back for each non-creation
    message
  • Correlate with data in the message or header
  • Must maintain list of data to InstanceID mapping

20
WF Communication
  • The WF runtime has a predefined communication
    mechanism
  • Host to activity communication is done via named
    persistable queues
  • Activity to host communication id done via any
    well-known service
  • Generally host specific queue and service based
    Activities are used inside each workflow

21
WF Communication Illustrated
22
ExternalDataService Communication
  • Many WF projects have already invested
  • Retrofit options
  • Build custom WCF service type
  • Build custom ServiceHost mapping
  • Pros
  • More portable workflow
  • May already have investment
  • Cons
  • May not be portable to future OOB integration

23
WCF Extensions and Behaviors
  • Leverage EDS feature (CEM and HEE activities)
  • Correlation ID travels in MessageContract
    header
  • Custom WCF behaviors for initiating new workflow
    or setting up workflow context
  • Needed improvements
  • Custom messaging activities
  • Custom ServiceHost / ServiceHostFactory
  • Move implementation details for correlation into
    custom WCF channel

24
Data Synchronization
  • Another main WF hosting integration issue
  • Along with instance management
  • What constitutes a return from a workflow
  • Output parameters (simple cases)
  • Service-based activity call (activity to host
    communication)
  • Depending on scheduler call might be happening on
    a different thread than the application request
    thread

25
Custom Activities
  • An option for managing communication
  • Receive activity that maps to WCF
    OperationContract
  • Send activity that correlates to Receive
    activity instance for request-reply MEP
  • Pros
  • More natural mapping for WCF service layer
  • Closer to future OOB integration
  • Cons
  • Overhead of custom activity development
  • Potential of WCF tie-in

26
Orcas - .NET 3.5
  • Finally an OOB WF WCF integration story
  • New WCF Send and Receive activities for WF
  • Enhanced Workflow and Service hosting with custom
    WCF ServiceHost

27
Sample Application YAPOS ?
  • Yet Another Purchase Order Scenario?No, dont
    fear.
  • Lets bring some coolness into our dev life
    talk about developer videos and media
  • Every good developer these days needs to deal
    with online resources and multimedia content
  • MSDN.TV
  • Channel 9
  • Dotnetpro.tv (German)

28
Sample Application Scenario
Reviewer
Media Service
Web Server
User
New Media Service
Message Queue
Message Queue
Upload Service
Web Server
29
(No Transcript)
30
Resources
  • Email Christian Weyer
  • christian.weyer_at_thinktecture.com
  • Weblog Christian Weyer
  • http//blogs.thinktecture.com/cweyer
  • thinktecture
  • http//www.thinktecture.com
  • Weblog Jon Flanders
  • http//www.masteringbiztalk.com/blogs/jon
Write a Comment
User Comments (0)
About PowerShow.com