Register your product to gain access to bonus material or receive a coupon.
This PDF will be accessible from your Account page after purchase and requires PDF reading software, such as Acrobat® Reader®.
The eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.
The Authoritative Guide to Building Service-Oriented Solutions with Microsoft .NET Technologies and the Windows Azure Cloud Computing Platform
In SOA with .NET and Windows Azure, top Microsoft technology experts team up with Thomas Erl to explore service-oriented computing with Microsoft’s latest .NET service technologies and Windows Azure innovations.
The authors provide comprehensive documentation of on-premise and cloud-based modern service technology advancements within the Microsoft platform and further show how these technologies have increased the potential for applying and realizing service-orientation practices and goals.
Specifically, the book delves into Microsoft enterprise technologies, such as:
...as well as industry service mediums, including WS-* and REST, and many related service industry standards and technologies.
The book steps through common SOA design patterns and service-orientation principles, along with numerous code-level examples that further detail various technology architectures and implementations.
Topic Areas
This book covers the following primary topics:
About the Web Sites
This book series is further supported by a series of resources sites, including:
Foreword by S. Somasegar xxxi
Foreword by David Chappell xxxiii
Acknowledgments xxxv
CHAPTER 1: Introduction 1
1.1 About this Book 2
1.2 Objectives of this Book 3
1.3 Who this Book is For 4
1.4 What this Book Does Not Cover 4
1.5 Prerequisite Reading 4
1.6 How this Book is Organized 6
Part I: Fundamentals 7
Chapter 3: SOA Fundamentals 7
Chapter 4: A Brief History of Legacy .NET Distributed Technologies 7
Chapter 5: WCF Services 7
Chapter 6: WCF Extensions 7
Chapter 7: .NET Enterprise Services Technologies 7
Chapter 8: Cloud Services with Windows Azure 8
Part II: Services and Service Composition 8
Chapter 9: Service-Orientation with .NET Part I: Service Contracts and Interoperability 8
Chapter 10: Service-Orientation with .NET Part II: Coupling, Abstraction, and Discoverability 8
Chapter 11: Service-Orientation with .NET Part III: Reusability and Agnostic Service Models 8
Chapter 12: Service-Orientation with .NET Part IV: Service Composition and Orchestration Basics 9
Chapter 13: Orchestration Patterns with WF 9
Chapter 14: Orchestration Patterns with BizTalk Server 9
Part III: Infrastructure and Architecture 9
Chapter 15: Enterprise Service Bus with BizTalk Server and Windows Azure 9
Chapter 16: Windows Azure Platform AppFabric Service Bus 10
Chapter 17: SOA Security with .NET and Windows Azure 10
Chapter 18: Service-Oriented Presentation Layers with .NET 10
Chapter 19: Service Performance Optimization 10
Chapter 20: SOA Metrics with BAM 10
Part IV: Appendices 10
Appendix A: Case Study Conclusion 10
Appendix B: Industry Standards Reference 11
Appendix C: Service-Orientation Principles Reference 11
Appendix D: SOA Design Patterns Reference 11
Appendix E: The Annotated SOA Manifesto 11
Appendix F: Additional Resources 11
1.7 How Principles and Patterns are Used in this Book 11
Sources 11
Reference Notation 12
1.8 Symbols, Figures, and Style Conventions 13
Symbol Legend 13
How Color is Used 13
Additional Information 13
Updates, Errata, and Resources (www.soabooks.com) 13
Master Glossary (www.soaglossary.com) 13
Referenced Specifications (www.soaspecs.com) 13
SOASchool.com™ SOA Certified Professional (SOACP) 14
The SOA Magazine (www.soamag.com) 14
Notification Service 14
CHAPTER 2: Case Study Background 15
2.1 How Case Studies Are Used 16
2.2 Case Study Background #1: Standard Mold 16
History 16
Technical Infrastructure 16
Business Goals and Obstacles 17
2.3 Case Study Background #2: Superior Stamping 18
History 18
Technical Infrastructure 18
Business Goals and Obstacles 19
PART I: FUNDAMENTALS
CHAPTER 3: SOA Fundamentals 23
3.1 Basic SOA Terminology 24
Service-Oriented Computing 25
Service-Orientation 25
Service-Oriented Architecture (SOA) 27
Services 28
Services as Components 29
Services as Web Services 30
Services as REST Services 31
Service Models 31
Agnostic Logic and Non-Agnostic Logic 32
Service Composition 33
Service Inventory 34
Service-Oriented Analysis 34
Service Candidate 35
Service-Oriented Design 35
Service Contract 36
Service-Related Granularity 37
SOA Design Patterns 38
3.2 Service-Oriented Computing Goals 40
Increased Intrinsic Interoperability 40
Increased Federation 40
Increased Vendor Diversification Options 40
Increased Business and Technology Domain Alignment 41
3.3 Further Reading 41
CHAPTER 4: A Brief History of Legacy .NET Distributed Technologies 43
4.1 Distributed Computing 101 44
Client-Server 44
Distributed Architecture 45
Service-Oriented Architecture 47
4.2 .NET Enterprise Services 48
It All Began with COM (and DCOM) 48
COM+ Services 49
.NET Assemblies 51
Distributed Transaction Coordinator 51
.NET Enterprise Services and Service-Orientation 53
4.3 .NET Remoting 54
.NET Remoting Architecture 54
Serializable Classes 56
Remotable Classes 56
Ordinary Classes 56
Hosting .NET Remoting Components 56
Windows Service 56
IIS Hosting Under ASP.NET 57
Hosting a .NET Remoting Component in a Console Application 57
.NET COM+ Services 57
.NET Remoting Configurations 57
Activation Types 58
Message Formats 60
Communication Protocols 60
Object Lifetime Management 61
.NET Remoting and Service-Orientation 61
4.4 Microsoft Messaging Queue (MSMQ) 63
The Queues 64
Sending and Receiving Messages 65
MSMQ and Service-Orientation 66
4.5 System.Transactions 67
Distributed Resource Transactions 67
Explicit and Implicit Programming Models 68
Ambient Transactions 69
4.6 Web Services (ASMX and WSE) 70
XML Web Services (ASMX) 71
The WebService Attribute 71
The WebMethod Attribute 72
Web Service Enhancements (WSE) 73
4.7 REST Service Processing with IHttpHandler 74
CHAPTER 5: WCF Services 75
5.1 Overview 76
5.2 Service Contracts with WCF 78
WCF Terminology 78
WCF Service Contract 78
Interface Contract 78
Operation Contract 78
Data Contract 78
Message Contract 79
Service Endpoint 79
The ServiceContract and OperationContract Attributes 79
Data Models and the DataContract Attribute 82
Messaging and the MessageContract Attribute 83
Service Endpoints and the endpoint Element 86
Address 88
Bindings 89
Contract 92
REST Service Classes and Attributes 92
The WebGet Attribute 93
The WebInvoke Attribute 95
WCF UriTemplate Attribute 96
Faults and the FaultContract Attribute 98
MEX Endpoints 100
Versioning Considerations 102
5.3 Service Implementation with WCF 104
Behaviors 104
Instancing 105
A Sample Implementation 106
5.4 Service Hosting with WCF 108
Self-Hosted Services 110
Managed Windows Services 112
IIS Process Boundary 113
Windows Activation Services (WAS) 114
Hosting REST Services 115
5.5 Service Consumers with WCF 116
Using the Service Metadata Tool 117
Writing the Proxy Class for a Service 118
Using the ChannelFactory Class 119
CHAPTER 6: WCF Extensions 121
6.1 WCF Security 122
Security Modes 123
Authorization 125
Federated Identity 126
6.2 WCF Transactions 127
Operation Attributes for Transactions 127
TransactionScopeRequired 128
TransactionAutoComplete 128
TransactionFlow 128
Service Attributes for Transactions 129
TransactionIsolationLevel 129
TransactionAutoCompleteOnSessionClose 130
TransactionTimeout 130
Durable Services 131
6.3 WCF Router 132
The RoutingService Class 133
Routing Contracts 134
Routing Configuration 135
Step 1: Define Endpoints 135
Step 2: Configure Service Behavior 136
Step 3: Enumerate Target Endpoints 136
Step 4: Define Message Filters 137
Step 5: Create a Filter Table 138
Fault Tolerance 139
6.4 WCF Discovery 140
Discovery Modes 141
Locating a Service Ad Hoc 143
Sending and Receiving Service Announcements 144
Discovery Proxies for Managed Discovery 146
Discovering from a Discovery Proxy 146
Implicit Service Discovery 147
6.5 WCF Extensibility 148
WCF Layers 149
Layered Extensibility 149
Channel Layer Extensibility 150
6.6 WCF Management Tools 151
Administration 151
Troubleshooting 151
Logging Messages 153
CHAPTER 7: .NET Enterprise Services Technologies 155
7.1 SQL Server 156
Native XML Web Services Support 157
Service Broker (SSB) 160
Query Notification 165
XML Support in SQL Server 165
7.2 Windows Workflow Foundation (WF) 166
WF Architecture 167
Workflows 168
Sequential Workflows 169
State Machine Workflows 169
Workflow Designer 169
Workflow Persistence (with WF) 170
Communicating with the Host Container 171
Activities 172
Workflow Runtime Environment 175
WF Programming Model 176
Passing Parameters into a Workflow Instance 178
Returning Parameters from a Workflow Instance 178
Workflow-Enabled Services 179
Versioning Orchestrations 180
WF Extensibility 180
Business Rules 180
7.3 Application Blocks and Software Factories 181
Application Blocks 182
Software Factories 184
Guidance Toolkits 184
Web Services Software Factory 184
7.4 Windows Server AppFabric 187
Configurable Hosting Environment 188
Workflow Persistence (with AppFabric) 189
In-Memory Application Cache Platform 190
Manageability Extensions 192
Application Server Event Collector 192
7.5 BizTalk Server 193
BizTalk Server Architecture 194
Messaging 196
Pipelines 197
Pipeline Components 198
Ports and Locations 199
Adapters 199
Context Properties 200
Itineraries 201
Unified Exception Management 202
CHAPTER 8: Cloud Services with Windows Azure 205
8.1 Cloud Computing 101 206
Cloud Deployment Models 208
Public Cloud 208
Private Cloud 208
Community Cloud 209
Other Deployment Models 209
The Intercloud (Cloud of Clouds) 209
Deployment Models and Windows Azure 210
Service Delivery Models 210
Infrastructure-as-a-Service (IaaS) 210
Platform-as-a-Service (PaaS) 211
Software-as-a-Service (SaaS) 211
Other Delivery Models 211
IaaS vs. PaaS 211
8.2 Windows Azure Platform Overview 213
Windows Azure (Application Container) 216
SQL Azure 217
Windows Azure Platform AppFabric 218
8.3 Windows Azure Roles 219
Web Roles and Worker Roles 220
Virtual Machines 220
Input Endpoints 221
Inter-Role Communication 222
8.4 Hello World in Windows Azure 223
1. Create a Cloud Service Project 224
2. Choose an ASP.NET Web Role 224
3. Create the Solution 225
4. Instantiate the Service 226
8.5 A Web Service in Windows Azure 227
1. Create a Host Service and Storage Service 233
2. Create and Deploy a Service Package 233
3. Promote the Service to Production 234
8.6 A REST Service in Windows Azure 235
REST Service Addressing 235
Creating a Windows Azure REST Service 236
8.7 Windows Azure Storage 239
Tables 240
Entities and Properties 240
Data Access 241
Queues 241
Blobs 242
Block BlobsPage Blobs 243
Windows Azure Drive 243
PART II: SERVICES AND SERVICE COMPOSITION
CHAPTER 9: Service-Orientation with .NET Part I: Service Contracts and Interoperability 247
9.1 Standardized Service Contract 250
Contract-First 250
1. Create or Reuse Data Contract 251
2. Create Message Contract 251
3. Create Interface Contract 252
Standardized Service Contract and Patterns 252
9.2 Canonical Schema 253
Creating Schemas with Visual Studio 254
Generating .NET Types 258
Using the DataContract Library 264
9.3 Data Model Transformation 267
Object-to-Object 269
LINQ-to-XML 271
XSLT Transformation 272
9.4 Canonical Protocol 274
Web Service 275
REST Service 277
Component 278
Another WCF Option: Named Pipes 279
Dual Protocols with WCF 279
9.5 Canonical Expression 280
Service Naming Conventions 280
Service Capability Naming Conventions 281
CHAPTER 10: Service-Orientation with .NET Part II: Coupling, Abstraction, and Discoverability 283
10.1 Service Loose Coupling 285
Service Loose Coupling and Patterns 286
10.2 Decoupled Contract 288
WSDL-First 289
Generating Service Code Using Svcutil 294
Generating WCF Service Code Using WSCF.blue 297
Generating ASMX Service Code Using WSCF.classic 302
10.3 Service Façade 304
10.4 Concurrent Contracts 307
10.5 Service Loose Coupling and Service Capability Granularity 308
10.6 Service Abstraction 313
10.7 Validation Abstraction 315
10.8 Exception Shielding 319
10.9 Service Discoverability 321
In-line Documentation 322
REST and Hypermedia 323
Service Profiles 323
10.10 Metadata Centralization 325
CHAPTER 11: Service-Orientation with .NET Part III: Reusability and Agnostic Service Models 327
11.1 Service Reusability and the Separation of Concerns 329
Functional Decomposition 330
Service Encapsulation 332
Agnostic Context 332
Agnostic Capability 334
Utility Abstraction 335
Entity Abstraction 336
The Inventory Analysis Cycle 337
Additional Design Considerations 339
11.2 Case Study Example: Utility Abstraction with a .NET Web Service 339
11.3 Case Study Example: Entity Abstraction with a .NET REST Service 351
CHAPTER 12: Service-Orientation with .NET Part IV: Service Composition and Orchestration Basics 369
12.1 Service Composition 101 371
Service-Orientation and Service Composition 371
Service Composability (PSD) 373
Capability Composition and Capability Recomposition 374
Capability Composition 375
Capability Recomposition 375
Composition Roles 377
Service Layers 377
Non-Agnostic Context 379
Process Abstraction and Task Services 380
12.2 Orchestration 382
Process Abstraction, Process Centralization, and Orchestrated Task Services 382
Process Centralization and Tools 384
Process Abstraction and WS-BPEL 385
State Repository and Compensating Service Transaction 385
State Repository with .NET 386
Compensating Service Transaction 387
Other Patterns 388
Microsoft Orchestration Platforms: WF and BizTalk Server 388
CHAPTER 13: Orchestration Patterns with WF 393
13.1 Process Abstraction and Orchestrated Task Services 397
A Brief History of WF Service Contract Support 397
Publishing WF Workflows as Web Services and Activities 399
Workflows Published as ASMX Services 399
Workflows Published via WCF 3.5 Activities 408
Workflows Published via WCF 4.0 Activities 410
Workflows Published via ExternalDataExchange Services 413
WS-I BasicProfile Support 417
Publishing WF Workflows as REST Services 419
JSON Encoding 421
Send and Receive Activity Configuration 422
Orchestrated Task Services with REST and WF 4.0 423
13.2 Process Centralization 425
Centralized Process Maintenance 425
WS-BPEL Support 426
13.3 State Repository 426
SQL Persistence Service and Scaling Out in WF 3.0 429
SQL Persistence Service and Scaling Out in WF 4 431
13.4 Compensating Service Transaction 434
Creating Compensations 434
Triggering Compensations 435
13.5 Case Study Example 436
CHAPTER 14: Orchestration Patterns with BizTalk Server 441
14.1 Process Abstraction and Orchestrated Task Services 443
Orchestrated Task Service Contracts 445
WS-* Support 447
Case Study Example 448
14.2 Process Centralization 450
Centralized Process Maintenance 450
WS-BPEL Support 451
Exporting BizTalk Orchestrations to WS-BPEL 451
Importing WS-BPEL Processes into BizTalk 454
14.3 State Repository 455
14.4 Compensating Service Transaction 456
Case Study Example 459
PART III: INFRASTRUCTURE AND ARCHITECTURE
CHAPTER 15: Enterprise Service Bus with BizTalk Server and Windows Azure 465
15.1 Microsoft and the ESB 466
15.2 Integration with BizTalk 467
Application Integration 101 467
The BizTalk Hub-Bus Model 469
15.3 The ESB Toolkit 470
Itineraries 472
Itineraries Types 474
The Itinerary Lifecycle 475
Resolvers 476
Adapter Providers 478
WCF-Custom and REST Services 479
15.4 Distributed and Scalable ESB Architecture 480
Configuring for High-Availability 480
Techniques for Scaling 481
Distributed ESBs 482
15.5 Cloud-Enabling the ESB with Windows Azure 483
Receiving Messages from Azure’s AppFabric Service Bus 484
Sending Messages to Azure’s AppFabric Service Bus 485
15.6 Governance Considerations 487
SLA Enforcement 488
Monitoring 488
Preparing Project Teams 489
15.7 Mapping the Microsoft Platform to the Enterprise Service Bus Pattern 490
CHAPTER 16: Windows Azure Platform AppFabric Service Bus 493
16.1 Introducing the Service Bus 494
Connectivity Fabric 494
Message Buffers 496
Service Registry 497
16.2 Service Bus and REST 498
REST-Based Service Design 498
REST-Based Service Consumer Design 499
Message Buffers and REST 499
16.3 Service Bus Connectivity Models 499
Eventing 500
Service Remoting 501
Tunneling 501
16.4 Working with Windows Azure Platform AppFabric Service Bus 503
Setting up the AppFabric Service Bus 504
Defining a REST-Based Service Bus Contract 513
Creating the Service Bus Message Buffer 514
CHAPTER 17: SOA Security with .NET and Windows Azure 517
17.1 Authentication and Authorization with WCF 518
Direct and Brokered Authentication 518
Direct Authentication 518
Brokered Authentication 519
Authentication Patterns in WCF 520
Role-Based Authorization 520
Authorization Roles in WCF 521
Authorizing Operations with Roles 523
Claims-Based Authorization 524
Claims Processing in WCF 526
Implementing Claims-Based Authorization 527
Access Control in Windows Azure 528
Designing Custom Claims 529
Case Study Example 530
17.2 Windows Identity Foundation (WIF) 533
Digital Identity 534
The Identity Metasystem 534
Windows Cardspace 536
Active Directory Federation Services (ADFS) 539
WIF Programming Model 540
WCF Integration 540
Programming Windows Cardspace 540
Developing a Relying Party 541
Developing an Identity Provider 542
17.3 Windows Azure Security 543
Cloud Computing Security 101 543
Cross-Domain Access Control 544
Hybrid Cloud Security 545
Inter-Organization Service Composition Security 545
External Identity Providers 546
Claims-Based Access Control, As-A-Service 546
Windows Azure Platform AppFabric Access Control Overview 548
Access Control Step-by-Step 550
Access Control and REST 552
Access Control Service Authorization Scenarios 553
Hybrid Cloud Authorization Model 553
Public Cloud Authorization Model 554
Cloud-to-Cloud Authorization Model 554
Case Study Example 555
CHAPTER 18: Service-Oriented Presentation Layers with .NET 557
18.1 Windows Presentation Foundation and the Prism Library 559
Shell 561
Views 562
View Discovery versus View Injection 563
Regions 563
Modules 565
Shared Services 566
18.2 Design Patterns for Presentation Logic 567
User Interface Patterns 567
Composite View [CJP] 568
Command [DP] 568
UI Mediator 568
Separated Presentation 568
Modularity Patterns 569
Separated Interface [PEA] 570
Plug-In [PEA] 570
Event Aggregator [PEA] 570
Inversion of Control [DP] 570
Dependency Injection [PEA] 570
Service Locator [CJP] 571
18.3 A Simple Service-Oriented User Interface 571
Creating the Project 571
Dynamically Loading Modules 579
CHAPTER 19: Service Performance Optimization 583
19.1 Overview 584
Optimization Areas 585
Service Implementation Processing 585
Service Framework Processing 586
Wire Transmission Processing 586
19.2 Service Performance Optimization Techniques 586
Caching to Avoid Costly Processing 587
Intermediary 589
Service Container 589
Service Proxy 590
Caching Utility Service 590
Comparing Caching Techniques 591
Cache Implementation Technologies 592
Computing Cache Keys 593
Case Study Example 594
Method 1 597
Method 2 598
Caching REST Responses 599
Monitoring Cache Efficiency 601
Reducing Resource Contention 603
Request Throttling 604
Throttling With WCF 605
Case Study Example 606
Request Throttling with BizTalk Server 607
Coarse-Grained Service Contracts 608
Case Study Example 609
Selecting Application Containers 610
Performance Policies 612
Case Study Example 620
REST Service Message Sizes 621
Hardware Encryption 622
Transport Encryption 622
Message Encryption 623
Custom Encryption Solution 623
High Performance Transport 625
Case Study Example 626
MTOM Encoding 627
Case Study Example 628
Performance Considerations for Service Contract Design 630
Case Study Example 631
Impact on Service-Orientation Principles 633
19.3 Service Composition Performance Optimization Techniques 637
Transformation Avoidance and Caching 637
Asynchronous Interactions 639
Parallelize Where Possible 641
Parallel Activity in WF 641
Parallel Execution in BizTalk Server 643
Replicator Activity in WF 644
Consider Co-Hosting When Necessary 645
Compose High Performance Services 648
Impact on Service-Orientation Principles 648
CHAPTER 20: SOA Metrics with BAM 653
20.1 SOA Metric Types 654
20.2 Introducing BizTalk BAM 655
BizTalk and BAM 655
BAM Solution Architecture 656
The BAM Management Utility 659
The Tracking Profile Editor (TPE) 659
Real-Time vs Scheduled Aggregations 660
20.3 Activities and Views 661
Roles-based Views for Service Governance 662
Creating Views 663
20.4 BAM APIs 665
Event Streams 665
DirectEventStream (DES) 665
BufferedEventStream (BES) 665
OrchestrationEventStream (OES) 666
IPipelineContext Interface 666
Abstracted APIs for Service Metrics 666
Metrics for Service Compositions 669
WCF and WF Interceptors 670
Notifications 670
Rapid Prototyping 671
20.5 Managing BAM 672
Database Outages 672
Security 672
Scripting Deployment 673
Reporting 676
Case Study Example 677
PART IV: APPENDICES
APPENDIX A: Case Study Conclusion 685
APPENDIX B: Industry Standards Reference 687
APPENDIX C: Service-Orientation Principles Reference 691
APPENDIX D: SOA Design Patterns Reference 707
APPENDIX E: The Annotated SOA Manifesto 795
The Annotated SOA Manifesto 796
APPENDIX F: Additional Resources 809
Consuming Services with WCF 811
Introduction 811
Cleaning Up Resources 812
The Proper Disposal and Closing of an ICommunicationObject 812
The ICommunicationObject.Close() Method 812
The ICommunicationObject.Abort() Method 814
Abort() versus Close() 814
IDisposable for Cleaning Up Resources 814
IDisposable and Its Relation to ClientBase and ChannelFactory 815
Cleaning Up Resources with the Using Block 816
Cleaning Up Resources with the Try-Catch-Finally-Abort Pattern 817
Handling Exceptions and Cleaning Up Resources with the Try-Close-Catch-Abort Pattern 818
Cleaning Up Resources in a Convenient Way 819
How to Handle Connections when Consuming Services Using WCF 822
Conclusion 823
About the Authors 825
About the Contributors 829
About the Foreword Contributors 831
Index 833