Upload
everett-osborne
View
225
Download
2
Tags:
Embed Size (px)
Citation preview
1
Windows Communication Windows Communication Foundation:Foundation:Integrating COM+ and MSMQ ApplicationsIntegrating COM+ and MSMQ Applications
Andy MilliganAndy MilliganCOM305 COM305 Program ManagerProgram ManagerMicrosoft CorporationMicrosoft Corporation
2
AgendaAgenda
Integration degrees and motivationsIntegration degrees and motivations
Illustrated scenariosIllustrated scenariosExposing COM+ applications as WCF Exposing COM+ applications as WCF servicesservices
Consuming services in COMConsuming services in COM
WCF client using an MSMQ receiverWCF client using an MSMQ receiver
MSMQ client sending to WCF servicesMSMQ client sending to WCF services
SummarySummary
QuestionsQuestions
3
Degrees Of IntegrationDegrees Of Integration
Wire-level interoperabilityWire-level interoperabilityWCF services and clients interoperate with ASMX, WSE WCF services and clients interoperate with ASMX, WSE and WebSphere services and clients using WS-* protocolsand WebSphere services and clients using WS-* protocols
Product level integrationProduct level integrationWCF includes feature level support for integrating WCF includes feature level support for integrating COM and COM+ applications with other WCF applications COM and COM+ applications with other WCF applications
WCF includes feature level support for MSMQ to integrate WCF includes feature level support for MSMQ to integrate with existing MSMQ applicationswith existing MSMQ applications
Company X may implement WCF channels to enable Company X may implement WCF channels to enable integration between WCF and a technology Yintegration between WCF and a technology Y
Code MigrationCode MigrationMigrating COM+ components to WCF enables most Migrating COM+ components to WCF enables most effective integration with new WCF applicationseffective integration with new WCF applications
4
Integration MotivationsIntegration Motivations
Deployed LOB logicDeployed LOB logicCore asset of the businessCore asset of the business
Duplication is often unacceptableDuplication is often unacceptable
Lengthy application lifecycleLengthy application lifecycle
Stability is keyStability is key
Utility throttled by proprietary accessUtility throttled by proprietary access
Goal of integration:Goal of integration:provide the benefits of SO without provide the benefits of SO without outweighing the cost of adoptionoutweighing the cost of adoption
5
Application ScenarioApplication Scenario
6
COM+ App As A WCF COM+ App As A WCF ServiceService
Scenario:Scenario:You need to access COM+ business logic You need to access COM+ business logic from web service clientsfrom web service clients
Solution:Solution:Use WCF’s COM+ Integration to expose Use WCF’s COM+ Integration to expose endpoints for your COM+ component endpoints for your COM+ component interfacesinterfaces
Provides:Provides:An interoperable, secure, reliable, An interoperable, secure, reliable, transacted web service access over a transacted web service access over a choice of transportschoice of transports
7
COM+ App As a WCF COM+ App As a WCF ServiceServiceApproachApproach
Run ComSvcConfig specifying the application Run ComSvcConfig specifying the application interfaceinterface
Metadata examination: type library & catalogMetadata examination: type library & catalog
Creates a default .config and hostCreates a default .config and host
Modify generated .config file as requiredModify generated .config file as required
Start application and WCF service startsStart application and WCF service startsContract reflected from type libraryContract reflected from type library
Behavior driven from configBehavior driven from config
ComSvcConfig.exe /installComSvcConfig.exe /install /application:BookSample/application:BookSample /contract:BookLogic.Finance,IFinance/contract:BookLogic.Finance,IFinance /hosting:complus/hosting:complus /mex/mex
8
COM+ App As A WCF COM+ App As A WCF ServiceService
9
A WCF ServiceA WCF Service
[ServiceContract][ServiceContract]public interface IFinancepublic 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 sourceWCF source
<configuration xmlns="…"> <system.serviceModel> <services> <service type="Lucerne.FinanceService" <endpoint address="“ binding="wsHttpBinding“ bindingConfiguration="Binding1“ contract="Lucerne.IFinance" /> </service> </services> </system.serviceModel></configuration>
WCF .configWCF .config
ServiceDescriptionServiceDescription Address:Address:http://myservice/IFinance.svchttp://myservice/IFinance.svc BindingBinding Name:Name:WSHttpBindingWSHttpBinding ContractContract Operation[0]Operation[0] Name:Name:ValidateCardNumberValidateCardNumber SyncMethod:SyncMethod:paramsparams Behaviors:Behaviors:TransactionFlowAttribute:AllowedTransactionFlowAttribute:Allowed Operation [1]Operation [1] Name:Name:ChargeCardChargeCard SyncMethod:SyncMethod:paramsparams Behaviors:Behaviors:TransactionFlowAttribute:AllowedTransactionFlowAttribute:Allowed
ServiceDescriptionServiceDescription Address:Address:http://myservice/IFinance.svchttp://myservice/IFinance.svc BindingBinding Name:Name:WSHttpBindingWSHttpBinding ContractContract Operation[0]Operation[0] Name:Name:ValidateCardNumberValidateCardNumber SyncMethod:SyncMethod:paramsparams Behaviors:Behaviors:TransactionFlowAttribute:AllowedTransactionFlowAttribute:Allowed Operation [1]Operation [1] Name:Name:ChargeCardChargeCard SyncMethod:SyncMethod:paramsparams Behaviors:Behaviors:TransactionFlowAttribute:AllowedTransactionFlowAttribute:Allowed
ServiceHoServiceHostst
10
A COM+ Integration WCF A COM+ Integration WCF ServiceService[[
uuid(5D9A0467-AFFE-3250-988D-24B439686656),uuid(5D9A0467-AFFE-3250-988D-24B439686656),]]interface IFinance : IDispatch {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 COM contract [typelib + [typelib +
catalog]catalog]
<configuration xmlns="…"> <system.serviceModel> <services> <service type="Lucerne.FinanceService" <endpoint address="“ binding="wsHttpBinding“ bindingConfiguration="Binding1“ contract="Lucerne.IFinance" /> </service> </services> </system.serviceModel></configuration>
WCF .configWCF .config
ServiceDescriptionServiceDescription Address:Address:http://myservice/IFinance.svchttp://myservice/IFinance.svc BindingBinding Name:Name:WSHttpBindingWSHttpBinding ContractContract Operation[0]Operation[0] Name:Name:ValidateCardNumberValidateCardNumber SyncMethod:SyncMethod:paramsparams Behaviors:Behaviors:TransactionFlowAttribute:AllowedTransactionFlowAttribute:Allowed Operation [1]Operation [1] Name:Name:ChargeCardChargeCard SyncMethod:SyncMethod:paramsparams Behaviors:Behaviors:TransactionFlowAttribute:AllowedTransactionFlowAttribute:Allowed
ServiceDescriptionServiceDescription Address:Address:http://myservice/IFinance.svchttp://myservice/IFinance.svc BindingBinding Name:Name:WSHttpBindingWSHttpBinding ContractContract Operation[0]Operation[0] Name:Name:ValidateCardNumberValidateCardNumber SyncMethod:SyncMethod:paramsparams Behaviors:Behaviors:TransactionFlowAttribute:AllowedTransactionFlowAttribute:Allowed Operation [1]Operation [1] Name:Name:ChargeCardChargeCard SyncMethod:SyncMethod:paramsparams Behaviors:Behaviors:TransactionFlowAttribute:AllowedTransactionFlowAttribute:Allowed
ServiceHoServiceHostst
11
COM+ App As A WCF COM+ App As A WCF ServiceServiceThe provided serviceThe provided serviceCanonical mappingCanonical mapping
COM class COM class service service
COM interface COM interface service contract service contract
COM interface methods COM interface methods operation operation contractcontract
Service configuration:Service configuration:NetNamedPipeBinding or WSHttpBindingNetNamedPipeBinding or WSHttpBinding
WS-Security – think up to WS-Security – think up to “PacketPrivacy” “PacketPrivacy”
WS-RM for session lifetimeWS-RM for session lifetime
OLE-Tx, with WS-AT as requiredOLE-Tx, with WS-AT as required
12
Server: COM+Server: COM+
CatalogCatalog
App CApp C
App BApp B
App AApp A
Component Component YY
Component Component XX
Interface 1Interface 1Interface 2Interface 2
DCOMDCOM
ClientClient
WS-* messagesWS-* messagesClientClient
ServiceModServiceModel el
InitializerInitializer
AppApp.config.config
COM+ hosted:COM+ hosted:Remains accessible from Remains accessible from DCOMDCOMNo message based activationNo message based activation
EndpointEndpoint
EndpointEndpoint
COM+ App As A WCF COM+ App As A WCF ServiceService
13
Server: COM+Server: COM+
CatalogCatalog
App CApp C
App BApp B
App AApp A
Component Component YY
Component Component XX
Interface 1Interface 1Interface 2Interface 2
DCOMDCOM
ClientClient
ClientClient
IIS / IIS / WASWAS
EndpointEndpoint
EndpointEndpoint
WS-* messagesWS-* messages
webweb.config.config
Web hosted:Web hosted:Remains accessible from DCOMRemains accessible from DCOMMessage based activation, cross-Message based activation, cross-processprocess
COM+ App As A WCF COM+ App As A WCF ServiceService
14
Server: COM+Server: COM+
CatalogCatalog
App CApp C
App BApp B
App AApp A
ClientClient
IIS / WASIIS / WAS
WS-* messagesWS-* messages
webweb.config.config
EndpointEndpoint
EndpointEndpointComponent YComponent Y
Component XComponent XInterface 1Interface 1Interface 2Interface 2
Web hosted in-proc:Web hosted in-proc:Message based activationMessage based activationAll in processAll in process
COM+ App As A WCF COM+ App As A WCF ServiceService
15
COM+ App As A WCF COM+ App As A WCF Service Service ConsiderationsConsiderations
WCF integration versus COM+ 1.5 “Uses WCF integration versus COM+ 1.5 “Uses SOAP”SOAP”
Integration is done on a per interface Integration is done on a per interface basis. basis.
No overhead for apps which don’t opt inNo overhead for apps which don’t opt in
Object reference passing not supportedObject reference passing not supported
COM+ context does not flowCOM+ context does not flow
Wizard viewWizard view
16
Consuming Services In COMConsuming Services In COM
Scenario:Scenario:Services are proliferating and you still Services are proliferating and you still have COM based clientshave COM based clients
Solution:Solution:Use WCF’s COM “service” moniker to Use WCF’s COM “service” moniker to communicate with service endpointscommunicate with service endpoints
Provides:Provides:An approachable COM specific syntax for An approachable COM specific syntax for accessing web services with WS-* accessing web services with WS-* support over multiple transportssupport over multiple transports
17
Consuming Services In COMConsuming Services In COMApproachApproach
SvcUtil can compile a COM-visible proxy assemblySvcUtil can compile a COM-visible proxy assembly.NET Framework 2.0 and WinFX / WCF runtime required.NET Framework 2.0 and WinFX / WCF runtime requiredOptimized for managed clients with COM-Interop Optimized for managed clients with COM-Interop limitationslimitations
Use “service” moniker syntax to specify service Use “service” moniker syntax to specify service address, binding and contractaddress, binding and contract
Typed contractTyped contractWSDL contractWSDL contractMetadata Exchange contractMetadata Exchange contract
IChannelCredentials for SSPI, username / password, IChannelCredentials for SSPI, username / password, x509x509
18
COM Client IntegrationCOM Client IntegrationService moniker: TypedService moniker: Typed
Scenario:Scenario:You want to extend a Visual Basic 6.0 application to You want to extend a Visual Basic 6.0 application to retrieve current stock levelsretrieve current stock levels
You have full control over deploymentYou have full control over deployment
Solution:Solution:Typed moniker for IntelliSenseTyped moniker for IntelliSense
Address & binding name in moniker stringAddress & binding name in moniker string
Build local assembly for contract (SvcUtil) Build local assembly for contract (SvcUtil)
Binding defined in app.configBinding defined in app.config
Dim monikerProxy as IRetailProxyDim monikerProxy as IRetailProxyset monikerProxy = GetObject("service:address=http://myServer/TestService/,set monikerProxy = GetObject("service:address=http://myServer/TestService/,
binding=wsProfileBinding")binding=wsProfileBinding")currStock = monikerProxy.GetStockLevel("ID:223")currStock = monikerProxy.GetStockLevel("ID:223")
19
COM Client IntegrationCOM Client IntegrationService moniker: WSDLService moniker: WSDL
Scenario:Scenario:You want to distribute a document including current web You want to distribute a document including current web service resultsservice results
Registering app specific proxies can be toughRegistering app specific proxies can be tough
Solution:Solution:WSDL Service monikerWSDL Service moniker
Entirely self contained with no app-specific registrationEntirely self contained with no app-specific registration
Address, binding and contract are in the codeAddress, binding and contract are in the code
wsdlStr = "<xml ... "wsdlStr = "<xml ... "Set monikerProxy =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")currStock = monikerProxy.GetStockLevel("ID:223")
20
COM Client IntegrationCOM Client IntegrationService moniker: Metadata Service moniker: Metadata ExchangeExchangeScenario:Scenario:
You want to distribute a document including current web You want to distribute a document including current web service resultsservice results
Registering app specific proxies can be toughRegistering app specific proxies can be tough
Solution:Solution:MEX monikerMEX moniker
Address, binding and contract are retrieved at runtimeAddress, binding and contract are retrieved at runtime
Optional overrides for address & bindingOptional overrides for address & bindingSet monikerProxy =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") currStock = monikerProxy.GetStockLevel("ID:223")
21
Consuming Services In COMConsuming Services In COM
22
Transport channelTransport channelIntended for exchanging queued Intended for exchanging queued messages between WCF applicationsmessages between WCF applicationsSOAP within MSMQ messageSOAP within MSMQ messageSupports new WCF queue addressing Supports new WCF queue addressing schemescheme
Integration channelIntegration channelIntended for exchanging queued Intended for exchanging queued messages between legacy MSMQ and messages between legacy MSMQ and WCF applicationsWCF applicationsClassic MSMQ messageClassic MSMQ messageSupports all legacy MSMQ addressing Supports all legacy MSMQ addressing and protocol schemesand protocol schemes
WCF Queuing ChannelsWCF Queuing ChannelsOverviewOverview
23
WCF Client To MSMQ WCF Client To MSMQ ReceiverReceiver
ScenarioScenarioKey business processes are at the other end of Key business processes are at the other end of an MSMQ queue. WCF clients need to send an MSMQ queue. WCF clients need to send message to the queue to be processed by message to the queue to be processed by deployed MSMQ receiverdeployed MSMQ receiver
Solution:Solution:Use WCF’s MSMQ integration channelUse WCF’s MSMQ integration channel
Provides:Provides:Integrates WCF clients with existing MSMQ Integrates WCF clients with existing MSMQ applications without modificationapplications without modification
Places classic MSMQ message on the wirePlaces classic MSMQ message on the wireSame infrastructure, same management, same Same infrastructure, same management, same receiver codereceiver code
24
WCF Client To MSMQ ReceiverWCF Client To MSMQ Receiver
StoreStore
WCF ClientWCF Client
StoreStore
Queue Queue ManagerManager
MSMQ ReceiverMSMQ Receiver
Queue Queue ManagerManager
Integration ChannelIntegration Channel
WCFWCF
MSMQMSMQ
QM to QM transferQM to QM transfer
MSMQMSMQ
MSMQMSMQ
App.config
25
Integrating WCF With AnIntegrating WCF With AnMSMQ ApplicationMSMQ Application
26
MSMQ Client To WCF MSMQ Client To WCF ReceiverReceiverScenario:Scenario:
Services are proliferating and you wish to call Services are proliferating and you wish to call from deployed MSMQ clientsfrom deployed MSMQ clients
Solution:Solution:Use WCF’s MSMQ integration channel to Use WCF’s MSMQ integration channel to communicate with service endpointscommunicate with service endpoints
Provides:Provides:Integrates existing MSMQ clients with WCF Integrates existing MSMQ clients with WCF servicesservices
Sender sends message same as it always didSender sends message same as it always did
WCF service can consume classic MSMQ WCF service can consume classic MSMQ messages from the wiremessages from the wire
Messages arriving in the queue are converted to SOAP Messages arriving in the queue are converted to SOAP messages and dispatched to the operationcontract by messages and dispatched to the operationcontract by the channelthe channel
27
MSMQ Client To WCF MSMQ Client To WCF ReceiverReceiver
StoreStore
WCF ReceiverWCF Receiver
StoreStore
Queue Queue ManagerManager
MSMQ ClientMSMQ Client
Queue Queue ManagerManager
Integration ChannelIntegration Channel
WCFWCF
QM to QM transferQM to QM transfer
MSMQMSMQ
MSMQMSMQ
MSMMSMQQ
App.config
28
WCF MSMQ IntegrationWCF MSMQ IntegrationConsiderationsConsiderations
Caveats to considerCaveats to considerMSMQ channels don’t support peekMSMQ channels don’t support peekSending COM objects in message body to Sending COM objects in message body to Indigo apps will not be supportedIndigo apps will not be supported
MSMQ Vista enhancementsMSMQ Vista enhancementsPoison message handling for MSMQPoison message handling for MSMQPer application error queuePer application error queueWCF services can receive messages WCF services can receive messages transactionally across the networktransactionally across the network
29
SummarySummary
Microsoft is committed to leveraging Microsoft is committed to leveraging existing investmentsexisting investments
Integration is baked into the WCF runtimeIntegration is baked into the WCF runtime
ComSvcConfig for COM+ComSvcConfig for COM+
Service moniker for COMService moniker for COM
Continued use of MSMQ transport Continued use of MSMQ transport
With existing apps you are off to a With existing apps you are off to a fine startfine start
Adopting WCF can be low impact, Adopting WCF can be low impact, incremental and alongside migrationincremental and alongside migration
30
Community ResourcesCommunity ResourcesAt PDCAt PDC
For more information, go seeFor more information, go seeCOM312 - WCF: Writing Secure Distributed Applications (Wed 1:45pm)COM312 - WCF: Writing Secure Distributed Applications (Wed 1:45pm)
COM307 - WCF: Writing Reliable and Transacted Distributed Applications (Wed COM307 - WCF: Writing Reliable and Transacted Distributed Applications (Wed 3:15pm)3:15pm)
COM308 - WCF: Developing Manageable Web Services (Wed 5:00pm)COM308 - WCF: Developing Manageable Web Services (Wed 5:00pm)
Labs: COMHOL26: Legacy IntegrationLabs: COMHOL26: Legacy Integration
Ask The Experts table: WCFAsk The Experts table: WCF
COM Track lounge: I’ll be there Wed 2-5pmCOM Track lounge: I’ll be there Wed 2-5pm
After PDCAfter PDCIf you missed this related session, watch it on the DVDIf you missed this related session, watch it on the DVD
COM200 - Applications and Communications RoadmapCOM200 - Applications and Communications Roadmap
COM202 - A Lap around the Windows Communications FoundationCOM202 - A Lap around the Windows Communications Foundation
MSDN dev center: MSDN dev center: http://msdn.microsoft.com/webservices/http://msdn.microsoft.com/webservices/
Channel 9 tag: http://channel9.msdn.com/tags/IndigoChannel 9 tag: http://channel9.msdn.com/tags/Indigo
Contact usContact usAndy.Milligan @ microsoft.comAndy.Milligan @ microsoft.com
Blog: Blog: http://blogs.msdn.com/distilledhttp://blogs.msdn.com/distilled
AnandRaj @ microsoft.comAnandRaj @ microsoft.com
Blog: Blog: http://http://blogs.msdn.comblogs.msdn.com/solutions/solutions
© 2005 Microsoft Corporation. All rights reserved.This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.