Академический Документы
Профессиональный Документы
Культура Документы
Agenda
Integration degrees and motivations Illustrated scenarios
Exposing COM+ applications as WCF services Consuming services in COM WCF client using an MSMQ receiver MSMQ client sending to WCF services
Summary Questions
2
Degrees Of Integration
Wire-level interoperability
WCF services and clients interoperate with ASMX, WSE and WebSphere services and clients using WS-* protocols
Code Migration
Migrating COM+ components to WCF enables most effective integration with new WCF applications
Integration Motivations
Deployed LOB logic
Core asset of the business Duplication is often unacceptable Lengthy application lifecycle Stability is key Utility throttled by proprietary access
Goal of integration:
provide the benefits of SO without outweighing the cost of adoption
4
Application Scenario
Solution:
Use WCFs COM+ Integration to expose endpoints for your COM+ component interfaces
Provides:
An interoperable, secure, reliable, transacted web service access over a choice of transports
6
Modify generated .config file as required Start application and WCF service starts
Contract reflected from type library Behavior driven from config
A WCF Service
[ServiceContract] WCF source public interface IFinance { [OperationContract] ServiceHost ServiceDescription [TransactionFlow(TransactionFlowOption.Allowed)] Address:http://myservice/IFinance.svc bool ValidateCardNumber(string CCNumber); Binding Name:WSHttpBinding [OperationContract] Contract [TransactionFlow(TransactionFlowOption.Allowed)] Operation[0] int ChargeCard(string Name, string Number, float Amount); Name:ValidateCardNumber SyncMethod:params Behaviors:TransactionFlowAttribute:Allowed Operation [1] Name:ChargeCard SyncMethod:params Behaviors:TransactionFlowAttribute:Allowed
<configuration xmlns=""> WCF .config <system.serviceModel> <services> <service type="Lucerne.FinanceService" <endpoint address=" binding="wsHttpBinding bindingConfiguration="Binding1 contract="Lucerne.IFinance" /> </service> </services> </system.serviceModel> </configuration>
ServiceHost
Address:http://myservice/IFinance.svc Binding Name:WSHttpBinding Contract Operation[0] Name:ValidateCardNumber SyncMethod:params Behaviors:TransactionFlowAttribute:Allowed Operation [1] Name:ChargeCard SyncMethod:params Behaviors:TransactionFlowAttribute:Allowed
10
Service configuration:
NetNamedPipeBinding or WSHttpBinding WS-Security think up to PacketPrivacy WS-RM for session lifetime OLE-Tx, with WS-AT as required
11
Server: COM+
App C App B
Component Y
DCOM
WS-* messages
Client
Endpoint Endpoint
ServiceModel Initializer
12
Server: COM+
App C App B
Component Y
DCOM
IIS / WAS
WS-* messages
Client
Endpoint Endpoint
web .config
Catalog
Web hosted: Remains accessible from DCOM Message based activation, cross-process
13
Server: COM+
App C App B
IIS / WAS
WS-* messages
Component Y
Client
Endpoint Endpoint
web .config
Catalog
14
Object reference passing not supported COM+ context does not flow Wizard view
15
Solution:
Use WCFs COM service moniker to communicate with service endpoints
Provides:
An approachable COM specific syntax for accessing web services with WS-* support over multiple transports
16
Use service moniker syntax to specify service address, binding and contract
Typed contract WSDL contract Metadata Exchange contract
17
Solution:
Typed moniker for IntelliSense Address & binding name in moniker string Build local assembly for contract (SvcUtil) Binding defined in app.config
Dim monikerProxy as IRetailProxy set monikerProxy = GetObject("service:address=http://myServer/TestService/, binding=wsProfileBinding") currStock = monikerProxy.GetStockLevel("ID:223") 18
Solution:
WSDL Service moniker Entirely self contained with no app-specific registration Address, binding and contract are in the code
wsdlStr = "<xml ... " Set monikerProxy = GetObject("service:address=http://myServer/TestService/, wsdl='" & wsdlStr & "', binding=wsProfileBinding, contract=IWarehouse") currStock = monikerProxy.GetStockLevel("ID:223") 19
Solution:
MEX moniker Address, binding and contract are retrieved at runtime Optional overrides for address & binding
Set monikerProxy = GetObject("service:mexAddress=http://myServer/myService.svc/mex, mexBindingSectionName=customBinding, mexBindingConfiguration=myCustomBinding, contractName=IFinance, contractNamespace=http://contoso.com/fooServices, bindingName=Binding1, bindingNamespace=http://contoso.com/Bindings") currStock = monikerProxy.GetStockLevel("ID:223")
20
21
Integration channel
Intended for exchanging queued messages between legacy MSMQ and WCF applications Classic MSMQ message Supports all legacy MSMQ addressing and protocol schemes
22
Solution:
Use WCFs MSMQ integration channel
Provides:
Integrates WCF clients with existing MSMQ applications without modification Places classic MSMQ message on the wire
Same infrastructure, same management, same receiver code
23
MSMQ Receiver
Integration Channel
MSMQ
QM to QM transfer
MSMQ Queue Manager
Queue Manager
Store
MSMQ 24
Store
25
Solution:
Use WCFs MSMQ integration channel to communicate with service endpoints
Provides:
Integrates existing MSMQ clients with WCF services
Sender sends message same as it always did
WCF service can consume classic MSMQ messages from the wire
Messages arriving in the queue are converted to SOAP messages and dispatched to the operationcontract by the channel
26
WCF Receiver
App .config
Integration Channel
WCF
QM to QM transfer
Queue Manager MSMQ Queue Manager
Store
Store MSMQ
27
28
Summary
Microsoft is committed to leveraging existing investments
Integration is baked into the WCF runtime ComSvcConfig for COM+ Service moniker for COM Continued use of MSMQ transport
With existing apps you are off to a fine start Adopting WCF can be low impact, incremental and alongside migration
29
Community Resources
At PDC
For more information, go see
COM312 - WCF: Writing Secure Distributed Applications (Wed 1:45pm) COM307 - WCF: Writing Reliable and Transacted Distributed Applications (Wed 3:15pm) COM308 - WCF: Developing Manageable Web Services (Wed 5:00pm) Labs: COMHOL26: Legacy Integration Ask The Experts table: WCF COM Track lounge: Ill be there Wed 2-5pm
After PDC
If you missed this related session, watch it on the DVD
COM200 - Applications and Communications Roadmap COM202 - A Lap around the Windows Communications Foundation
Contact us
Andy.Milligan @ microsoft.com Blog: http://blogs.msdn.com/distilled AnandRaj @ microsoft.com Blog: http://blogs.msdn.com/solutions
30