Windows Communication Foundation Adapters in

Download Report

Transcript Windows Communication Foundation Adapters in

SOA307
Windows Communication
Foundation Adapters in
BizTalk Server 2006 R2
Ulrich Roxburgh
Services2 Ltd.
1
BizTalk Server + Services
BTS 2004/2006 supports Web services
But the support has been limited to date
SOAP/WSE adapters only go so far
Modern SOA’s need more flexibility
Around transport, encodings, WS-* protocols
Such as what’s provided by WCF
WCF Adapters in R2
R2 comes with a new set of WCF adapters
Offers full integration with WCF runtime
Brings WCF channels into BTS messaging
Now possible to leverage WS-* in BizTalk
We’ll cover these new adapters in-depth
With focus on scenarios + underlying design
WCF Fundamentals
A few key WCF fundamentals to understand
Programming model
Hosting model
Configuration system
Demo
WCF Runtime Architecture
Service Layer
Client
Method
Service
Method
Method
objects
objects
Proxy
Message
Dispatcher
Messaging Layer
encoder
transport
Channel Stack
Message
protocol
protocol
protocol
Method
protocol
raw message bytes
0101101
encoder
transport
Channel Stack
WCF Bindings
Binding Class Name
Transport
Message Message Security
Encoding Version Mode
RM
Tx Flow*
BasicHttpBinding
HTTP
Text
SOAP 1.1
None
X
X
WSHttpBinding
HTTP
Text
SOAP 1.2
WS-A 1.0
Message
Disabled
WS-AT
NetTcpBinding
TCP
Binary
SOAP 1.2
Transport
Disabled
OleTx
NetNamedPipesBinding
NetMsmqBinding
Named
Pipes
MSMQ
Binary
SOAP 1.2
Transport
X
OleTx
Binary
SOAP 1.2
Message
X
X
CustomBinding
You decide
You decide You decide You decide You decide You decide
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
Introducing the WCF Adapters
The WCF adapters complete the bridge
between BTS and .NET 3.0
Usage similar to any other BTS adapter
Create send ports / receive locations
Select a WCF adapter as the transport
Configure adapter to control WCF settings
Configuration stored in SSO as usual
Demo
WCF Adapter Suite
Adapter Name WCF Binding
When to use?
WCF-BasicHttp
BasicHttpBinding
WCF-WSHttp
WSHttpBinding
WCF-NetTcp
NetTcpBinding
WCFNetNamedPipe
WCF-NetMsmq
NetNamedPipeBinding
NetMsmqBinding
WCF-Custom
Any
WCFCustomIsolated
Any
When you need interoperability with WS-I Basic
Profile 1.1 services
When you need interoperability with more
advanced services that leverage WS-* protocols
When you need efficient inter-machine
communication with other WCF applications
When you need efficient intra-machine
communication with other WCF applications
When you need durable, asynchronous
communication with other WCF applications
When you need to define a custom binding
configuration for an “in-process” host
When you need to define a custom binding
configuration for an “isolated” host
WCF Adapter Architecture
Key areas to understand
WCF adapter generic contracts
Send adapter architecture (consuming)
Receive adapter architecture (hosting)
Exposing service metadata
Security and transaction options
Custom adapter configurations
Integration with orchestrations
Generic Service Contracts
The WCF adapters use generic contracts
IOneWayAsync, ITwoWayAsync, ...
Allows ports to process any message shape
Operations 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 adapter
One of the generic contracts is used
You specify the “action” value
Only compatible with two-way operations (unless
you’re using NetMsmqBinding)
Send Adapter “Action” Mapping
<BtsActionMapping>
<Operation Name="SubmitInvoice"
Action="http://example.org/SubmitInvoice"/>
<Operation Name="CancelInvoice"
Action="http://example.org/CancelInvoice"/>
</BtsActionMapping>
14
Send Adapter msg Templates
<SubmitInvoice xmlns="http://example.org/billing">
<bts-msg-body
xmlns="http://www.microsoft.com/schemas/bts2007"
encoding="xml"/>
</SubmitInvoice>
15
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 adapter
One of the generic contracts is used
Service implementation publishes incoming
message to MessageBox
Only supports two-way operations
(except when using NetMsmqBinding)
BizTalkServiceInstance in Action
Receive Port
Receive Location
WCF Receive Adapter
Pipeline
Maps
decode
map
BizTalkServiceInstance
Channel Stack
transport
encoder
WCF
Message
protocol
disassemble
validate
SOAP
Body
map
resolve party
map
BizTalk Message
BizTalk Message
Element
protocol
Message
Dispatcher
SOAP
Body
Element
decide which part of the
message to submit
publish
Message Box
Message Publishing Options
Envelope
Publish entire SOAP envelope element
Careful w/XmlDisassembler or you’ll get Body
Body (default)
Publish first child of SOAP body element
Path
Identify the precise element to publish using a
forward-only XPath expression
Hosting the WCF Adapters
In-process hosting
Non-HTTP adapters easily supported via tools
HTTP adapters possible via WCF-Custom
Isolated hosting
All HTTP adapters and WCF-CustomIsolated
Service lifecycle controlled via admin tools
Exposing Service Metadata
Receive locations are inherently untyped
Hence, exposing metadata doesn’t help
You can provide metadata explicitly via tool
Using the WCF Service Publishing Wizard
WCF Service Publishing Wizard
Generate metadata-only endpoints
For services hosted in-proc
Generate service endpoints
For services hosted in IIS
Produces all WCF/IIS artifacts
Command-line version also available
http://go.microsoft.com/fwlink/?LinkId=101820
Security Options
WCF provides numerous security options
Primarily controlled via security “mode”
WCF adapters only surface security settings
consistent with underlying binding
See Security tab for available options
Security “mode” is a required setting
Client credentials may also be necessary
Most WCF adapters also support SSO
Transaction Options
Some WCF bindings support flowing tx’s
Flowing a tx into a receive location
Joins the transaction for publishing the message to
the MessageBox
If client aborts, message isn’t published
Not possible on two-way receive location
Send ports can also flow tx’s to services
The MessageBox tx for deleting the outgoing
message is flowed to external service
Using the “Custom” Adapters
WCF-Custom and WCF-CustomIsolated
Allow you to customize WCF bindings
You’re “taking the gloves off”, possible to break
Select WCF binding and configure
Select “customBinding” to start from scratch
Specify/configure binding elements
Import/export WCF configuration
Customizing WCF Behaviors
Custom adapters allow you to customize
service/endpoint behaviors
Exposed on the “Behavior” tab
Allows you to introduce custom behaviors
Such as the BamEndpointBehavior
WCF Adapters in Orchestrations
WCF adapters integrate with orchestrations
Consume WCF services
See the WCF Service Consuming Wizard
Launch via “Add Generated Items”
Publish orchestrations as WCF services
Use the WCF Service Publishing Wizard
WCF Property Schema
WCF adapters define a suite of properties
Provide access to WCF headers/configuration
Accessible in pipelines & orchestrations
Name
Description
Promoted
Action
To
ReplyToAddress
Operation name
WS-Addressing To header
WS-Addressing ReplyTo header
Yes
Yes
Yes
FromAddress
InboundHeaders
WS-Addressing From header
All of the incoming headers
(decrypted)
All outgoing headers
Yes
No
OutboundCustomHeaders
No
WCF BAM Interceptor
R2 also ships with a WCF BAM interceptor
Allows WCF apps to capture BAM data
Implemented as a WCF behavior
(BamEndpointBehavior)
Injects message/parameter inspectors
Data 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 scenarios
Use custom adapters for everything else
Flexible hosting/metadata options/tool support
Brings increased transport/encoding flexibility
Adds support for standard WS-* protocols
References
See Windows Communication Foundation
Adapters in BizTalk Server 2006 R2 (whitepaper)
by Aaron Skonnard
Resources for Developers
www.microsoft.com/teched
Tech·Talks
Live Simulcasts
Tech·Ed Bloggers
Virtual Labs
http://microsoft.com/msdn
Developer’s Kit, Licenses, and MORE!
© 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.
33