Introducing The ABCs of WCF AZNET
Introducing The ABCs of WCF AZNET
Rick G. Garibay
rickgaribay.net
rickgaribay.net
About Me
Microsoft Certified Application Developer - .NET Framework Microsoft Certified Professional 8+ years professional experience developing Microsoft solutions for the retail and financial services industry Architect, Program Manager for ESS, a Microsoft Gold Partner ISV in Phoenix, AZ
rickgaribay.net
Coupling
Time
rickgaribay.net
+ Location Transparency
White-Box Reuse
Black-Box Reuse
rickgaribay.net
rickgaribay.net
Services (Service Oriented Architecture, and Service Oriented Applications) are the next evolution from components, just as interfaced-based components where an evolution from objects. SOA is, to the best of our knowledge, the best way to build distributed applications that are maintainable, where the right aspects are decoupled yielding:
Productivity Maintainability Extensibility Real Reuse
Introducing the ABCs of Windows Communication Foundation | Spring 2007
rickgaribay.net
rickgaribay.net
More on bindings:
http://windowssdk.msdn.microsoft.com/en-us/library/ms730294.aspx
rickgaribay.net
Client
Proxy
SOAP
Object
Component Client
Proxy
Service Interface
Object
Client
Proxy
Component
Process A
Application Service
Service Client
Proxy
Service
Service
Client
Proxy
Process A
Process B
Service
Client
Proxy
Service Service
rickgaribay.net
rickgaribay.net
Additional SO Principles
Additional SO principles (you should adhere to simply because it is the right thing to do) : Services are secure. Services leave the system in a consistent state. Services are thread-safe. Services are reliable & robust.
Interoperable Scaleable Available Responsive Disciplined
From the IDesign WCF Standard Guidelines & Best Practices
Introducing the ABCs of Windows Communication Foundation | Spring 2007
rickgaribay.net
rickgaribay.net
.NET 3.0 is additive to .NET 2.0. It uses (and requires) the .NET 2.0 CLR exclusively Really bad branding decision
rickgaribay.net
Binding
All services expose a Contract. WCF uses 5 types of contracts: Service Contract Exposes the service. Operation Contract- Exposes the service members. Data Contract Describes service parameters. Fault Contracts Defines error handling semantics.
Contract
rickgaribay.net
rickgaribay.net
Architecture
rickgaribay.net
Service Contracts
.NET 3.0 WCF uses common .NET interface along with the ServiceContractAttribute class to explicitly define a contract. Service Contracts are implicitly public (access modifiers are a .NET notion).
using System; using System.ServiceModel; [ServiceContract()] interface IPersonnelAction { // Members }
rickgaribay.net
Operation Contracts
An Operation Contract uses the OperationContractAttribute class to opt-in a method to participate in a Service Contract.
using System; using System.ServiceModel; [ServiceContract()] interface IPersonnelAction { [OperationContract] double AdjustSalary(int employeeId, double baseSalary, double adjustmentPercent); // Not a part of the contract bool Terminate(int employeeId); }
rickgaribay.net
rickgaribay.net
http://www.netfx3.com/
rickgaribay.net
Hosting Options
rickgaribay.net
rickgaribay.net
Data Contracts
A Data Contract marks a business entity (class) as a participant in a Service Contract and Service Operation. Unlike using the SerialziableAttribute, all entities and members are strictly opt-in.
using System; using System.Runtime.Serialization; [DataContract()] public class Employee : Person { private string m_Name = string.Empty; private int m_EmployeeId = string.Empty; [DataMember] public int EmployeeId { get { return m_EmployeeId; } set { m_EmployeeId = value; } } } Introducing the ABCs of Windows Communication Foundation | Spring 2007
rickgaribay.net
rickgaribay.net
Fault Contracts
A Fault Contract is the definition of how errors are raised and handled by WCF clients. There is no concept of an exception in WCF (this is a .NET only idea). Fault Contracts describe error conditions and behavior for managing these conditions.
rickgaribay.net
rickgaribay.net
Questions?
References
IDesign WCF Master Class, Microsoft Silicon Valley Campus, San Jose, CA. June 2006. IDesign WCF Standard Programming WCF Services, Juval Lowy, 2007 OReilly Press. Timeline of Computing, Wikipedia: http://en.wikipedia.org/wiki/Timeline_of_computing. July 2006. S. Someasegar, Someasegars Blog: http://blogs.msdn.com/somasegar/archive/2006/06/09/624300.aspx. July 2006
rickgaribay.net