1 Windows Communication Foundation Adapters in BizTalk Server 2006 R2 Ulrich Roxburgh Services2 Ltd....

34
1 Windows Communication Foundation Adapters in BizTalk Server 2006 R2 Ulrich Roxburgh Services2 Ltd. SOA307

Transcript of 1 Windows Communication Foundation Adapters in BizTalk Server 2006 R2 Ulrich Roxburgh Services2 Ltd....

Page 1: 1 Windows Communication Foundation Adapters in BizTalk Server 2006 R2 Ulrich Roxburgh Services2 Ltd. SOA307.

1

Windows Communication Foundation Adapters in BizTalk Server 2006 R2

Ulrich RoxburghServices2 Ltd.

SOA307

Page 2: 1 Windows Communication Foundation Adapters in BizTalk Server 2006 R2 Ulrich Roxburgh Services2 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

Page 3: 1 Windows Communication Foundation Adapters in BizTalk Server 2006 R2 Ulrich Roxburgh Services2 Ltd. SOA307.

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

Page 4: 1 Windows Communication Foundation Adapters in BizTalk Server 2006 R2 Ulrich Roxburgh Services2 Ltd. SOA307.

WCF Fundamentals

A few key WCF fundamentals to understandProgramming modelHosting modelConfiguration system

Page 5: 1 Windows Communication Foundation Adapters in BizTalk Server 2006 R2 Ulrich Roxburgh Services2 Ltd. SOA307.

Demo

Page 6: 1 Windows Communication Foundation Adapters in BizTalk Server 2006 R2 Ulrich Roxburgh Services2 Ltd. SOA307.

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

Page 7: 1 Windows Communication Foundation Adapters in BizTalk Server 2006 R2 Ulrich Roxburgh Services2 Ltd. SOA307.

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

Page 8: 1 Windows Communication Foundation Adapters in BizTalk Server 2006 R2 Ulrich Roxburgh Services2 Ltd. SOA307.

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

Page 9: 1 Windows Communication Foundation Adapters in BizTalk Server 2006 R2 Ulrich Roxburgh Services2 Ltd. SOA307.

Demo

Page 10: 1 Windows Communication Foundation Adapters in BizTalk Server 2006 R2 Ulrich Roxburgh Services2 Ltd. SOA307.

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

Page 11: 1 Windows Communication Foundation Adapters in BizTalk Server 2006 R2 Ulrich Roxburgh Services2 Ltd. SOA307.

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

Page 12: 1 Windows Communication Foundation Adapters in BizTalk Server 2006 R2 Ulrich Roxburgh Services2 Ltd. SOA307.

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)

Page 13: 1 Windows Communication Foundation Adapters in BizTalk Server 2006 R2 Ulrich Roxburgh Services2 Ltd. SOA307.

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)

Page 14: 1 Windows Communication Foundation Adapters in BizTalk Server 2006 R2 Ulrich Roxburgh Services2 Ltd. SOA307.

14

Send Adapter “Action” Mapping

<BtsActionMapping> <Operation Name="SubmitInvoice" Action="http://example.org/SubmitInvoice"/> <Operation Name="CancelInvoice" Action="http://example.org/CancelInvoice"/></BtsActionMapping>

Page 15: 1 Windows Communication Foundation Adapters in BizTalk Server 2006 R2 Ulrich Roxburgh Services2 Ltd. SOA307.

15

Send Adapter msg Templates

<SubmitInvoice xmlns="http://example.org/billing"> <bts-msg-body xmlns="http://www.microsoft.com/schemas/bts2007" encoding="xml"/></SubmitInvoice>

Page 16: 1 Windows Communication Foundation Adapters in BizTalk Server 2006 R2 Ulrich Roxburgh Services2 Ltd. SOA307.

Demo

Page 17: 1 Windows Communication Foundation Adapters in BizTalk Server 2006 R2 Ulrich Roxburgh Services2 Ltd. SOA307.

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)

Page 18: 1 Windows Communication Foundation Adapters in BizTalk Server 2006 R2 Ulrich Roxburgh Services2 Ltd. SOA307.

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

Page 19: 1 Windows Communication Foundation Adapters in BizTalk Server 2006 R2 Ulrich Roxburgh Services2 Ltd. SOA307.

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

Page 20: 1 Windows Communication Foundation Adapters in BizTalk Server 2006 R2 Ulrich Roxburgh Services2 Ltd. SOA307.

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

Page 21: 1 Windows Communication Foundation Adapters in BizTalk Server 2006 R2 Ulrich Roxburgh Services2 Ltd. SOA307.

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

Page 22: 1 Windows Communication Foundation Adapters in BizTalk Server 2006 R2 Ulrich Roxburgh Services2 Ltd. SOA307.

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

Page 23: 1 Windows Communication Foundation Adapters in BizTalk Server 2006 R2 Ulrich Roxburgh Services2 Ltd. SOA307.

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

Page 24: 1 Windows Communication Foundation Adapters in BizTalk Server 2006 R2 Ulrich Roxburgh Services2 Ltd. SOA307.

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

Page 25: 1 Windows Communication Foundation Adapters in BizTalk Server 2006 R2 Ulrich Roxburgh Services2 Ltd. SOA307.

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

Page 26: 1 Windows Communication Foundation Adapters in BizTalk Server 2006 R2 Ulrich Roxburgh Services2 Ltd. SOA307.

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

Page 27: 1 Windows Communication Foundation Adapters in BizTalk Server 2006 R2 Ulrich Roxburgh Services2 Ltd. SOA307.

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

Page 28: 1 Windows Communication Foundation Adapters in BizTalk Server 2006 R2 Ulrich Roxburgh Services2 Ltd. SOA307.

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

Page 29: 1 Windows Communication Foundation Adapters in BizTalk Server 2006 R2 Ulrich Roxburgh Services2 Ltd. SOA307.

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

Page 30: 1 Windows Communication Foundation Adapters in BizTalk Server 2006 R2 Ulrich Roxburgh Services2 Ltd. SOA307.

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

Page 31: 1 Windows Communication Foundation Adapters in BizTalk Server 2006 R2 Ulrich Roxburgh Services2 Ltd. SOA307.

References

See Windows Communication Foundation Adapters in BizTalk Server 2006 R2 (whitepaper) by Aaron Skonnard

Page 32: 1 Windows Communication Foundation Adapters in BizTalk Server 2006 R2 Ulrich Roxburgh Services2 Ltd. SOA307.

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

Page 33: 1 Windows Communication Foundation Adapters in BizTalk Server 2006 R2 Ulrich Roxburgh Services2 Ltd. SOA307.

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.

Page 34: 1 Windows Communication Foundation Adapters in BizTalk Server 2006 R2 Ulrich Roxburgh Services2 Ltd. SOA307.