posts - 52, comments - 14, trackbacks - 438748

Cached @ 1/5/2009 10:14:51 AM

Control ASP.skins_anothereon001_controls_blogstats_ascx

My Links

News

Archives

Post Categories

Blogs

Cached @ 1/5/2009 10:14:51 AM

Control ASP.skins_anothereon001_controls_singlecolumn_ascx

VSLive! Day Two - Implementing SOA Design Patterns with WCF

Presenter: Rob Daigneau (Chief Architect, SynXis)
Blog: http://www.designpatternsfor.net
Author of an upcoming book on SOA Design Patterns published by Addison Wesley.

This was definitely the most interesting talk of the conference so far.  It's pleasing to see an advanced course that really got into some great architectural discussions and provided applicable techniques for solving difficult SOA problems such as maintenance, versioning, forward, and backward compatibility.  This session is geared towards the WCF developer who is looking to improve their service oriented design architecture.  

 

There are two typical types of SOA services:
Domain Services
These are the elemental building blocks upon which everthing else is built.

Enterprise Services
Enterprise services are composities of domain services that are pulled together in order to provide more comprehensive, enterprise-level solutions.

Domain Services
Domain services are designed primarily to address a business problem within a particular domain.  They encapsulate business logic and data management to abstract the details of the service from consumers of that service.  The roles of domain services are also to encapsulate and leverage existing business logic components and classes to allow for re-use of existing components that would be too expensive to re-write.  When encapsulating business logic it is performing the role of a mediator.  When simplifying the interface to re-used or abstracted objects, it is acting in the role of a facade.  A domain service can be thought of as an additional (fourth) layer that exists between the UI and business layers in the application.  This does not mean that every application that wishes to communicate with the business tier needs to go through the service.  The service layer itself can introduce a performance hit as it may be abstracting the fact that the business logic components are executing on a different machine than the caller.  Certain applications may still want to access the business tier directly and this is perfectly acceptable even with an available domain service.

Message Exchange Patterns
Request-Response Pattern
The most basic message exchange pattern is for a request to be issued to the service by the client which then waits for a response from that service.  The disadvantage of this pattern is that the client is sitting in an idle state until a response is received from the service.  There is no guarantee of how long it might take for the service to respond and hence no way to know how long the client will be locked in the waiting state.

In Only
An example of the "In Only" pattern, also known as Fire and Forget, is a service such as a booking system that takes a request for information and then indicates that a response will be delivered once some process has completed.  This might be in the form of an email will be sent to a customer once their original request has been processed.  The disadvantage with this system is that the client has to wait an indeterminate amount of time for a response and has to check for that response periodically, i.e. a user checking their Inbox for a confirmation message.  This pattern does not work well when both client and service and software programs.  Client software polling for a response is a sub-optimal architecture.

Duplex
This message exchange pattern uses asynchronous methods with callbacks to allow a client to continue working after it sends the request.  A callback method is sent as part of the request such that the service can invoke that callback method with a response once the work of the service has been complete.  However, this requires that the client is still alive and hence able to receive the response once the service is ready to make the callback.

The Duplex (callback) Pattern in Practice
How callback works from the Client
Configuration of the message exchange pattern that will be used can be handled via attributes upon the service definitions.  The channel description for the contract is specified in the ServiceContract attribute on the client.  In this way, the client can issue a message and continue processing, knowing that the callback will be received once the service has completed its work.

How Callback works from the Service
The implementation of the service can use OperationContext.Current.GetCallbackChannel<> to get a callback channel to the client that issued the request.  This gets a specific callback channel that can be used to callback the client with the response.  This same mechanism can also be used to implement a publisher subscriber pattern by building a registry of subscribers to callback with the response.  In this way, a single request from the Publisher of information can be called back to multiple Subscribers.

Data Transfer Objects
Very similar in definition to the application objects that we use (you DO use objects that are free from business logic to transfer data right?), data transfer objects are used in messages sent to and from the service in order to abstract the definition of an object and avoid having parameters listed in any service contract.  This loosens the coupling of the service and client and reduces the service area exposed by the client by reducing all operations involving a particular logical entity to using collections (one item collections for single objects) for all transactions involving a particular entity.

Service Message and Contract Amendments
Better even than passing data transfer objects in service operations, consider using a service message object instead.  What is the justification for this?  Consider that some additional metadata needs to be transmitted for a particular operation that does not logically fit within the definition of a particular data transfer object.  This metadata would classically (in an RPC mindset) be appended to the signature of the operations in the service contract.  However, this tightens the coupling and increases the surface area of the service contract.  If the service operation simply took a service message as the single parameter, this message could be extended with the metadata without affecting the contract.  Even better, consider that a message contains a data transfer object specific extension object that will always contain the additional message metadata and can itself be extended over time.  This keeps the definition of the message object itself from changing as new metadata is introduced.  This extension object is known as a collection of contract amendments as it literally encapsulates the amendments that have been made to the service contract over time.  The amendments property should be declared within the message when it is first developed, despite the fact that it will start it's life as an empty and essentially redundant collection.  This allows for the addition of amendments over time without having to modify the message object at any point in its life.  This is an extremely desirable stability in the only parameter passed to the operations in a service contract.  The final consideration here is that amendment properties must be marked as not required, otherwise existing clients that are unaware of the new amendment will break.

Forward and Backward Compatability
The service should check for the presence of the amendment properties, in the case that the properties are null, it can be determined that an older client is accessing the service.  In order to provide appropriate compatability, the service should continue to work even if this extension data is not provided.  

The MessageContract Attribute
There is little information out there about the MessageContract attribute for use in classes that define transport-level messages.  It gives much greater control that the oft-touted DataContract class.

Print | posted on Wednesday, October 17, 2007 5:02 PM | Filed Under [ Software Architecture ]

Feedback

Gravatar

# gexrefor

gexrefor
1/24/2008 10:15 PM | gexrefor
Gravatar

# lexapro

lexapro
2/17/2008 1:12 PM | lexapro
Gravatar

# neurontin

neurontin
2/17/2008 2:48 PM | neurontin
Gravatar

# purchase soma online

purchase soma online
2/17/2008 2:49 PM | purchase soma online
Gravatar

# diazepam

diazepam
2/17/2008 2:50 PM | diazepam
Gravatar

# keflex

keflex
2/17/2008 4:00 PM | keflex
Gravatar

# trazodone

trazodone
2/17/2008 4:01 PM | trazodone
Gravatar

# losec

losec
2/17/2008 5:12 PM | losec
Gravatar

# cheap phentermine

cheap phentermine
2/17/2008 6:27 PM | cheap phentermine
Gravatar

# buy adipex

buy adipex
2/17/2008 7:39 PM | buy adipex
Gravatar

# vicodin

vicodin
2/17/2008 8:53 PM | vicodin
Gravatar

# zovirax

zovirax
2/17/2008 10:08 PM | zovirax
Gravatar

# tramadol online

tramadol online
2/17/2008 11:11 PM | tramadol online
Gravatar

# allegra

allegra
2/17/2008 11:12 PM | allegra
Gravatar

# buy alprazolam

buy alprazolam
2/18/2008 12:50 AM | buy alprazolam
Gravatar

# wymmural

wymmural
2/18/2008 7:25 PM | wymmural
Gravatar

# ibuprofen

ibuprofen
2/19/2008 2:12 AM | ibuprofen
Gravatar

# buy soma online

buy soma online
2/19/2008 2:12 AM | buy soma online
Gravatar

# celebrex

celebrex
2/19/2008 4:19 AM | celebrex
Gravatar

# lasix

lasix
2/19/2008 4:19 AM | lasix
Gravatar

# generic plavix

generic plavix
2/19/2008 6:32 AM | generic plavix
Gravatar

# buy amoxicillin

buy amoxicillin
2/19/2008 8:53 AM | buy amoxicillin
Gravatar

# buy vicodin online

buy vicodin online
2/19/2008 8:53 AM | buy vicodin online
Gravatar

# zopiclone

zopiclone
2/19/2008 10:59 AM | zopiclone
Gravatar

# odckxqnf

odckxqnf
2/19/2008 7:08 PM | odckxqnf
Gravatar

# generic valium

generic valium
2/20/2008 5:12 AM | generic valium
Gravatar

# cheap valium

cheap valium
2/20/2008 6:21 AM | cheap valium
Gravatar

# order ambien

order ambien
2/20/2008 6:22 AM | order ambien
Gravatar

# viagra online

viagra online
2/20/2008 7:59 AM | viagra online
Gravatar

# metformin

metformin
2/20/2008 8:00 AM | metformin
Gravatar

# viagra

viagra
2/20/2008 8:00 AM | viagra
Gravatar

# cheap fioricet

cheap fioricet
2/20/2008 10:26 AM | cheap fioricet
Gravatar

# meridia

meridia
2/20/2008 10:26 AM | meridia
Gravatar

# generic lipitor

generic lipitor
2/20/2008 10:27 AM | generic lipitor
Gravatar

# cipro

cipro
2/20/2008 10:27 AM | cipro
Gravatar

# generic wellbutrin

generic wellbutrin
2/20/2008 10:27 AM | generic wellbutrin
Gravatar

# generic prilosec

generic prilosec
2/20/2008 10:27 AM | generic prilosec
Gravatar

# buy xanax online

buy xanax online
2/20/2008 11:36 AM | buy xanax online
Gravatar

# buy levitra online

buy levitra online
2/20/2008 11:38 AM | buy levitra online
Gravatar

# cheap adipex

cheap adipex
2/20/2008 12:52 PM | cheap adipex
Gravatar

# fioricet online

fioricet online
2/20/2008 2:04 PM | fioricet online
Gravatar

# adipex

adipex
2/20/2008 3:17 PM | adipex
Gravatar

# buy carisoprodol

buy carisoprodol
2/20/2008 3:17 PM | buy carisoprodol
Gravatar

# buy phentermine

buy phentermine
2/20/2008 4:38 PM | buy phentermine
Gravatar

# generic hydrocodone

generic hydrocodone
2/20/2008 4:38 PM | generic hydrocodone
Gravatar

# juxihiop

juxihiop
2/20/2008 11:23 PM | juxihiop
Gravatar

# xoxdpgdx

xoxdpgdx
2/20/2008 11:23 PM | xoxdpgdx
Gravatar

# generic nexium

generic nexium
2/21/2008 5:28 AM | generic nexium
Gravatar

# bupropion

bupropion
2/21/2008 6:54 AM | bupropion
Gravatar

# order valium online

order valium online
2/21/2008 8:33 AM | order valium online
Gravatar

# tretinoin

tretinoin
2/21/2008 8:44 AM | tretinoin
Gravatar

# atenolol

atenolol
2/21/2008 8:46 AM | atenolol
Gravatar

# purchase tramadol

purchase tramadol
2/21/2008 9:49 AM | purchase tramadol
Gravatar

# cheap viagra

cheap viagra
2/21/2008 11:22 AM | cheap viagra
Gravatar

# order carisoprodol

order carisoprodol
2/21/2008 11:23 AM | order carisoprodol
Gravatar

# ativan

ativan
2/21/2008 11:23 AM | ativan
Gravatar

# aotqwpeu

aotqwpeu
2/21/2008 6:16 PM | aotqwpeu
Gravatar

# cheap hydrocodone

cheap hydrocodone
2/21/2008 11:49 PM | cheap hydrocodone
Gravatar

# phentermine online

phentermine online
2/21/2008 11:51 PM | phentermine online
Gravatar

# buspirone

buspirone
2/21/2008 11:51 PM | buspirone
Gravatar

# buspar

buspar
2/22/2008 1:15 AM | buspar
Gravatar

# generic prevacid

generic prevacid
2/22/2008 3:23 AM | generic prevacid
Gravatar

# order soma online

order soma online
2/22/2008 3:24 AM | order soma online
Gravatar

# cheap cialis

cheap cialis
2/22/2008 3:24 AM | cheap cialis
Gravatar

# alprazolam online

alprazolam online
2/22/2008 3:25 AM | alprazolam online
Gravatar

# buy soma

buy soma
2/22/2008 5:45 AM | buy soma
Gravatar

# order diazepam

order diazepam
2/22/2008 7:14 AM | order diazepam
Gravatar

# aleve

aleve
2/22/2008 8:22 AM | aleve
Gravatar

# escitalopram

escitalopram
2/22/2008 10:10 AM | escitalopram
Gravatar

# diazepam online

diazepam online
2/22/2008 12:41 PM | diazepam online
Gravatar

# tshcilmd

tshcilmd
2/23/2008 3:04 AM | tshcilmd
Gravatar

# order xenical

order xenical
3/3/2008 2:14 AM | order xenical
Gravatar

# amlodipine

amlodipine
3/3/2008 2:21 PM | amlodipine
Gravatar

# purchase hydrocodone

purchase hydrocodone
3/3/2008 8:52 PM | purchase hydrocodone
Gravatar

# order xanax

order xanax
3/3/2008 10:00 PM | order xanax
Gravatar

# effexor

effexor
3/4/2008 12:03 AM | effexor
Gravatar

# cephalexin

cephalexin
3/4/2008 12:04 AM | cephalexin
Gravatar

# cialis

cialis
3/4/2008 12:04 AM | cialis
Gravatar

# venlafaxine

venlafaxine
3/4/2008 12:04 AM | venlafaxine
Gravatar

# buy phentermine online

buy phentermine online
3/4/2008 1:08 AM | buy phentermine online
Gravatar

# vybeojgw

vybeojgw
3/4/2008 8:51 AM | vybeojgw
Gravatar

# Cialis generic.

Cialis.
4/16/2008 6:32 PM | Cialis forum.
Gravatar

# Porn.

Asian porn. Gay porn. Japanese porn. Free porn videos. Porn. Lesbian porn.
6/19/2008 8:32 AM | Free lesbian porn.
Gravatar

# Black teens plus black girls ebony girls.

Black betty ebony sex big black tits black teens. Teens in black stockings. Black teens naked. Black teens.
6/20/2008 2:43 AM | Exploited black teens.
Comments have been closed on this topic.

Powered by: