Download presentation
Presentation is loading. Please wait.
Published byEverett Osborne Modified over 9 years ago
1
1 Windows Communication Foundation: Integrating COM+ and MSMQ Applications Andy Milligan COM305 Program Manager Microsoft Corporation
2
2 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 SummaryQuestions
3
3 Degrees Of Integration Wire-level interoperability WCF services and clients interoperate with ASMX, WSE and WebSphere services and clients using WS-* protocols Product level integration WCF includes feature level support for integrating COM and COM+ applications with other WCF applications WCF includes feature level support for MSMQ to integrate with existing MSMQ applications Company X may implement WCF channels to enable integration between WCF and a technology Y Code Migration Migrating COM+ components to WCF enables most effective integration with new WCF applications
4
4 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
5
5 Application Scenario
6
6 COM+ App As A WCF Service Scenario: You need to access COM+ business logic from web service clients Solution: Use WCF’s COM+ Integration to expose endpoints for your COM+ component interfaces Provides: An interoperable, secure, reliable, transacted web service access over a choice of transports
7
7 COM+ App As a WCF Service Approach Run ComSvcConfig specifying the application interface Metadata examination: type library & catalog Creates a default.config and host Modify generated.config file as required Start application and WCF service starts Contract reflected from type library Behavior driven from config ComSvcConfig.exe /install /application:BookSample /application:BookSample /contract:BookLogic.Finance,IFinance /contract:BookLogic.Finance,IFinance /hosting:complus /hosting:complus /mex /mex
8
8 COM+ App As A WCF Service
9
9 A WCF Service [ServiceContract] public interface IFinance { [OperationContract] [OperationContract] [TransactionFlow(TransactionFlowOption.Allowed)] [TransactionFlow(TransactionFlowOption.Allowed)] bool ValidateCardNumber(string CCNumber); bool ValidateCardNumber(string CCNumber); [OperationContract] [OperationContract] [TransactionFlow(TransactionFlowOption.Allowed)] [TransactionFlow(TransactionFlowOption.Allowed)] int ChargeCard(string Name, string Number, float Amount); int ChargeCard(string Name, string Number, float Amount);} WCF source <service type="Lucerne.FinanceService" <endpoint address="“ binding="wsHttpBinding“ bindingConfiguration="Binding1“ contract="Lucerne.IFinance" /> WCF.config ServiceDescription Address:http://myservice/IFinance.svc Address:http://myservice/IFinance.svc Binding Binding Name:WSHttpBinding Name:WSHttpBinding Contract Contract Operation[0] Operation[0] Name:ValidateCardNumber Name:ValidateCardNumber SyncMethod:params SyncMethod:params Behaviors:TransactionFlowAttribute:Allowed Behaviors:TransactionFlowAttribute:Allowed Operation [1] Operation [1] Name:ChargeCard Name:ChargeCard SyncMethod:params SyncMethod:params Behaviors:TransactionFlowAttribute:Allowed Behaviors:TransactionFlowAttribute:AllowedServiceDescription Address:http://myservice/IFinance.svc Address:http://myservice/IFinance.svc Binding Binding Name:WSHttpBinding Name:WSHttpBinding Contract Contract Operation[0] Operation[0] Name:ValidateCardNumber Name:ValidateCardNumber SyncMethod:params SyncMethod:params Behaviors:TransactionFlowAttribute:Allowed Behaviors:TransactionFlowAttribute:Allowed Operation [1] Operation [1] Name:ChargeCard Name:ChargeCard SyncMethod:params SyncMethod:params Behaviors:TransactionFlowAttribute:Allowed Behaviors:TransactionFlowAttribute:Allowed ServiceHost
10
10 A COM+ Integration WCF Service [ uuid(5D9A0467-AFFE-3250-988D-24B439686656), uuid(5D9A0467-AFFE-3250-988D-24B439686656),] interface IFinance : IDispatch { HRESULT ValidateCardNumber( HRESULT ValidateCardNumber( [in] BSTR CCNumber, [in] BSTR CCNumber, [out, retval] VARIANT_BOOL* pRetVal); [out, retval] VARIANT_BOOL* pRetVal); HRESULT ChargeCard( HRESULT ChargeCard( [in] BSTR Name, [in] BSTR Name, [in] BSTR Number, [in] BSTR Number, [in] single Amount, [in] single Amount, [out, retval] long* pRetVal); [out, retval] long* pRetVal);}; COM contract [typelib + catalog] <service type="Lucerne.FinanceService" <endpoint address="“ binding="wsHttpBinding“ bindingConfiguration="Binding1“ contract="Lucerne.IFinance" /> WCF.config ServiceDescription Address:http://myservice/IFinance.svc Address:http://myservice/IFinance.svc Binding Binding Name:WSHttpBinding Name:WSHttpBinding Contract Contract Operation[0] Operation[0] Name:ValidateCardNumber Name:ValidateCardNumber SyncMethod:params SyncMethod:params Behaviors:TransactionFlowAttribute:Allowed Behaviors:TransactionFlowAttribute:Allowed Operation [1] Operation [1] Name:ChargeCard Name:ChargeCard SyncMethod:params SyncMethod:params Behaviors:TransactionFlowAttribute:Allowed Behaviors:TransactionFlowAttribute:AllowedServiceDescription Address:http://myservice/IFinance.svc Address:http://myservice/IFinance.svc Binding Binding Name:WSHttpBinding Name:WSHttpBinding Contract Contract Operation[0] Operation[0] Name:ValidateCardNumber Name:ValidateCardNumber SyncMethod:params SyncMethod:params Behaviors:TransactionFlowAttribute:Allowed Behaviors:TransactionFlowAttribute:Allowed Operation [1] Operation [1] Name:ChargeCard Name:ChargeCard SyncMethod:params SyncMethod:params Behaviors:TransactionFlowAttribute:Allowed Behaviors:TransactionFlowAttribute:Allowed ServiceHost
11
11 COM+ App As A WCF Service The provided service Canonical mapping COM class service COM interface service contract COM interface methods operation contract Service configuration: NetNamedPipeBinding or WSHttpBinding WS-Security – think up to “PacketPrivacy” WS-RM for session lifetime OLE-Tx, with WS-AT as required
12
12 Server: COM+ Catalog App C App B App A Component Y Component X Interface 1 Interface 2 DCOM Client WS-* messages Client ServiceModel Initializer App.config COM+ hosted: Remains accessible from DCOM No message based activation EndpointEndpoint COM+ App As A WCF Service
13
13 Server: COM+ Catalog App C App B App A Component Y Component X Interface 1 Interface 2 DCOM Client Client IIS / WAS Endpoint Endpoint WS-* messages web.config Web hosted: Remains accessible from DCOM Message based activation, cross-process COM+ App As A WCF Service
14
14 Server: COM+ Catalog App C App B App A Client IIS / WAS WS-* messages web.config Endpoint Endpoint Component Y Component X Interface 1 Interface 2 Web hosted in-proc: Message based activation All in process COM+ App As A WCF Service
15
15 COM+ App As A WCF Service Considerations WCF integration versus COM+ 1.5 “Uses SOAP” Integration is done on a per interface basis. No overhead for apps which don’t opt in Object reference passing not supported COM+ context does not flow Wizard view
16
16 Consuming Services In COM Scenario: Services are proliferating and you still have COM based clients Solution: Use WCF’s COM “service” moniker to communicate with service endpoints Provides: An approachable COM specific syntax for accessing web services with WS-* support over multiple transports
17
17 Consuming Services In COM Approach SvcUtil can compile a COM-visible proxy assembly.NET Framework 2.0 and WinFX / WCF runtime required Optimized for managed clients with COM-Interop limitations Use “service” moniker syntax to specify service address, binding and contract Typed contract WSDL contract Metadata Exchange contract IChannelCredentials for SSPI, username / password, x509
18
18 COM Client Integration Service moniker: Typed Scenario: You want to extend a Visual Basic 6.0 application to retrieve current stock levels You have full control over deployment 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")
19
19 COM Client Integration Service moniker: WSDL Scenario: You want to distribute a document including current web service results Registering app specific proxies can be tough 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/, GetObject("service:address=http://myServer/TestService/, wsdl='" & wsdlStr & "', wsdl='" & wsdlStr & "', binding=wsProfileBinding, binding=wsProfileBinding, contract=IWarehouse") contract=IWarehouse") currStock = monikerProxy.GetStockLevel("ID:223")
20
20 COM Client Integration Service moniker: Metadata Exchange Scenario: You want to distribute a document including current web service results Registering app specific proxies can be tough 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, GetObject("service:mexAddress=http://myServer/myService.svc/mex, mexBindingSectionName=customBinding, mexBindingSectionName=customBinding, mexBindingConfiguration=myCustomBinding, mexBindingConfiguration=myCustomBinding, contractName=IFinance, contractName=IFinance, contractNamespace=http://contoso.com/fooServices, contractNamespace=http://contoso.com/fooServices, bindingName=Binding1, bindingName=Binding1, bindingNamespace=http://contoso.com/Bindings") bindingNamespace=http://contoso.com/Bindings") currStock = monikerProxy.GetStockLevel("ID:223")
21
21 Consuming Services In COM
22
22 Transport channel Intended for exchanging queued messages between WCF applications SOAP within MSMQ message Supports new WCF queue addressing scheme Integration channel Intended for exchanging queued messages between legacy MSMQ and WCF applications Classic MSMQ message Supports all legacy MSMQ addressing and protocol schemes WCF Queuing Channels Overview
23
23 WCF Client To MSMQ Receiver Scenario Key business processes are at the other end of an MSMQ queue. WCF clients need to send message to the queue to be processed by deployed MSMQ receiver Solution: Use WCF’s 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
24
24 WCF Client To MSMQ Receiver Store WCF Client Store Queue Manager MSMQ Receiver Queue Manager Integration Channel WCF MSMQ QM to QM transfer MSMQ MSMQ App.config
25
25 Integrating WCF With An MSMQ Application
26
26 MSMQ Client To WCF Receiver Scenario: Services are proliferating and you wish to call from deployed MSMQ clients Solution: Use WCF’s 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
27
27 MSMQ Client To WCF Receiver Store WCF Receiver Store Queue Manager MSMQ Client Queue Manager Integration Channel WCF QM to QM transfer MSMQ MSMQ MSMQ App.config
28
28 WCF MSMQ Integration Considerations Caveats to consider MSMQ channels don’t support peek Sending COM objects in message body to Indigo apps will not be supported MSMQ Vista enhancements Poison message handling for MSMQ Per application error queue WCF services can receive messages transactionally across the network
29
29 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
30
30 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: I’ll 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 MSDN dev center: http://msdn.microsoft.com/webservices/ http://msdn.microsoft.com/webservices/ Channel 9 tag: http://channel9.msdn.com/tags/Indigo Contact us Andy.Milligan @ microsoft.com Blog: http://blogs.msdn.com/distilled http://blogs.msdn.com/distilled AnandRaj @ microsoft.com Blog: http://blogs.msdn.com/solutions http://blogs.msdn.com/solutions
31
© 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.