1
Windows Communication Foundation Adapters in BizTalk Server 2006 R2
Ulrich RoxburghServices2 Ltd.
SOA307
BizTalk Server + Services
BTS 2004/2006 supports Web servicesBut the support has been limited to dateSOAP/WSE adapters only go so far
Modern SOA’s need more flexibilityAround transport, encodings, WS-* protocolsSuch as what’s provided by WCF
WCF Adapters in R2
R2 comes with a new set of WCF adaptersOffers full integration with WCF runtimeBrings WCF channels into BTS messagingNow possible to leverage WS-* in BizTalk
We’ll cover these new adapters in-depthWith focus on scenarios + underlying design
WCF Fundamentals
A few key WCF fundamentals to understandProgramming modelHosting modelConfiguration system
Demo
WCF Runtime Architecture
ServiceClient
Method Method Method Method
protocol
protocolencoder
transport
protocol
protocolencoder
transport
Service Layer
Messaging Layer
Proxy Dispatcher
0101101
raw message bytes
objects
Message
Channel Stack Channel Stack
Message
objects
WCF Bindings
Notes: X = Not Supported, WS-A = WS-Addressing, WS-AT = WS-AtomicTransactions, OleTx = OleTransactions* Transaction flow is always disabled by default, but when you enable it, these are the default protocols
Binding Class Name Transport Message Encoding
Message Version
Security Mode
RM Tx Flow*
BasicHttpBinding HTTP Text SOAP 1.1 None X X
WSHttpBinding HTTP Text SOAP 1.2WS-A 1.0
Message Disabled WS-AT
NetTcpBinding TCP Binary SOAP 1.2 Transport Disabled OleTx
NetNamedPipes-Binding
Named Pipes
Binary SOAP 1.2 Transport X OleTx
NetMsmqBinding MSMQ Binary SOAP 1.2 Message X X
CustomBinding You decide You decide You decide You decide You decide You decide
Introducing the WCF Adapters
The WCF adapters complete the bridge between BTS and .NET 3.0
Usage similar to any other BTS adapterCreate send ports / receive locationsSelect a WCF adapter as the transportConfigure adapter to control WCF settingsConfiguration stored in SSO as usual
Demo
WCF Adapter SuiteAdapter Name WCF Binding When to use? WCF-BasicHttp BasicHttpBinding When you need interoperability with WS-I Basic
Profile 1.1 servicesWCF-WSHttp WSHttpBinding When you need interoperability with more
advanced services that leverage WS-* protocolsWCF-NetTcp NetTcpBinding When you need efficient inter-machine
communication with other WCF applicationsWCF-NetNamedPipe
NetNamedPipe-Binding
When you need efficient intra-machine communication with other WCF applications
WCF-NetMsmq NetMsmqBinding When you need durable, asynchronous communication with other WCF applications
WCF-Custom Any When you need to define a custom binding configuration for an “in-process” host
WCF-CustomIsolated
Any When you need to define a custom binding configuration for an “isolated” host
WCF Adapter Architecture
Key areas to understandWCF adapter generic contractsSend adapter architecture (consuming)Receive adapter architecture (hosting)Exposing service metadataSecurity and transaction optionsCustom adapter configurationsIntegration with orchestrations
Generic Service Contracts
The WCF adapters use generic contractsIOneWayAsync, ITwoWayAsync, ...
Allows ports to process any message shapeOperations typed using Message, Action=“*”Operations are always two-way (unless using NetMsmqBinding)
(Use Reflector to view)
Send Adapter Architecture
Sends messages using a WCF channel Channel dynamically created by adapterOne of the generic contracts is usedYou specify the “action” valueOnly compatible with two-way operations (unless you’re using NetMsmqBinding)
14
Send Adapter “Action” Mapping
<BtsActionMapping> <Operation Name="SubmitInvoice" Action="http://example.org/SubmitInvoice"/> <Operation Name="CancelInvoice" Action="http://example.org/CancelInvoice"/></BtsActionMapping>
15
Send Adapter msg Templates
<SubmitInvoice xmlns="http://example.org/billing"> <bts-msg-body xmlns="http://www.microsoft.com/schemas/bts2007" encoding="xml"/></SubmitInvoice>
Demo
Receive Adapter Architecture
Receives messages using a WCF channel A single ServiceHost for each receive location (based on BizTalkServiceInstance)Hosted in-proc (BtsNtSvc.exe) or isolated (IIS)Channel dynamically created by adapterOne of the generic contracts is usedService implementation publishes incoming message to MessageBoxOnly supports two-way operations (except when using NetMsmqBinding)
BizTalkServiceInstance in Action
transport
encoder
protocol
protocol
Dispatcher
Channel Stack map
WCF Receive Adapter
decode
disassemble
validate
resolve party
Pipeline Maps
SOAP
decide which part of the message to submit
Message
WCFMessage
BizTalk Message
map
map
BizTalk Message
Receive Location
Receive Port
publish
BizTalkServiceInstance
SOAPBody
Element
Body Element
Message Box
Message Publishing Options
EnvelopePublish entire SOAP envelope elementCareful w/XmlDisassembler or you’ll get Body
Body (default)Publish first child of SOAP body element
PathIdentify the precise element to publish using a forward-only XPath expression
Hosting the WCF Adapters
In-process hostingNon-HTTP adapters easily supported via toolsHTTP adapters possible via WCF-Custom
Isolated hostingAll HTTP adapters and WCF-CustomIsolated
Service lifecycle controlled via admin tools
Exposing Service Metadata
Receive locations are inherently untypedHence, exposing metadata doesn’t help
You can provide metadata explicitly via toolUsing the WCF Service Publishing Wizard
WCF Service Publishing Wizard
Generate metadata-only endpointsFor services hosted in-proc
Generate service endpointsFor services hosted in IISProduces all WCF/IIS artifacts
Command-line version also availablehttp://go.microsoft.com/fwlink/?LinkId=101820
Security Options
WCF provides numerous security optionsPrimarily controlled via security “mode”
WCF adapters only surface security settings consistent with underlying binding
See Security tab for available optionsSecurity “mode” is a required settingClient credentials may also be necessary
Most WCF adapters also support SSO
Transaction Options
Some WCF bindings support flowing tx’sFlowing a tx into a receive location
Joins the transaction for publishing the message to the MessageBoxIf client aborts, message isn’t publishedNot possible on two-way receive location
Send ports can also flow tx’s to servicesThe MessageBox tx for deleting the outgoing message is flowed to external service
Using the “Custom” Adapters
WCF-Custom and WCF-CustomIsolatedAllow you to customize WCF bindingsYou’re “taking the gloves off”, possible to breakSelect WCF binding and configure
Select “customBinding” to start from scratchSpecify/configure binding elements
Import/export WCF configuration
Customizing WCF Behaviors
Custom adapters allow you to customize service/endpoint behaviors
Exposed on the “Behavior” tabAllows you to introduce custom behaviors
Such as the BamEndpointBehavior
WCF Adapters in Orchestrations
WCF adapters integrate with orchestrationsConsume WCF services
See the WCF Service Consuming WizardLaunch via “Add Generated Items”
Publish orchestrations as WCF servicesUse the WCF Service Publishing Wizard
WCF Property Schema
WCF adapters define a suite of propertiesProvide access to WCF headers/configurationAccessible in pipelines & orchestrations
Name Description Promoted
Action Operation name Yes To WS-Addressing To header Yes ReplyToAddress WS-Addressing ReplyTo header Yes
FromAddress WS-Addressing From header Yes InboundHeaders All of the incoming headers
(decrypted) No
OutboundCustomHeaders All outgoing headers No
WCF BAM Interceptor
R2 also ships with a WCF BAM interceptorAllows WCF apps to capture BAM dataImplemented as a WCF behavior (BamEndpointBehavior)Injects message/parameter inspectorsData capture driven by IC files
Summary
The WCF adapters in R2 bring the flexibility of WCF into the BizTalk messaging layer
Built-in adapters cover common scenariosUse custom adapters for everything elseFlexible hosting/metadata options/tool supportBrings increased transport/encoding flexibilityAdds support for standard WS-* protocols
References
See Windows Communication Foundation Adapters in BizTalk Server 2006 R2 (whitepaper) by Aaron Skonnard
www.microsoft.com/teched Tech·Talks Tech·Ed BloggersLive Simulcasts Virtual Labs
http://microsoft.com/msdn
Developer’s Kit, Licenses, and MORE!
Resources for Developers
33
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after
the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Top Related