Presentation is loading. Please wait.

Presentation is loading. Please wait.

Getting Started with Windows Communication Foundation 4.5 Ed Jones, MCT, MCPD, MCTS Consultant RBA Inc.

Similar presentations


Presentation on theme: "Getting Started with Windows Communication Foundation 4.5 Ed Jones, MCT, MCPD, MCTS Consultant RBA Inc."— Presentation transcript:

1

2

3

4 Getting Started with Windows Communication Foundation 4.5 Ed Jones, MCT, MCPD, MCTS Consultant RBA Inc.

5 Welcome to TechFuse! Objective: To give you enough information to get started at building a WCF solution! To get the most out of this session, you need to know… –.NET Programming (all samples in C#) – Simple configuration (.config files)

6 Overview TechFuse Suites: our sample application What does it mean to be SOA? Contracts and Service Implementation Bindings and Behaviors Hosting the Service Consuming WCF Services What’s New in WCF 4.5?

7 TechFuse Suites A simple service that allows one to make, alter, or cancel a reservation at TechFuse Suites. The reservation system is available to any client regardless of type of code, native OS, etc. Architecture – The reservation system is a WCF 4.5 Service – The service is hosted in a Windows Service over http and netTcp – The database is SQL Server 2012 – Supports multiple clients: Windows Forms Java-Based (we’ll use the SOAP UI tool) Sample Code and Database available at: http://sdrv.ms/13ZU79u http://sdrv.ms/13ZU79u

8 Service Oriented Architecture and Principles

9 What is service orientation? Service-Oriented Architecture (SOA) is a set of principles and methodologies for designing and developing software in the form of interoperable services. These services are well-defined business functionalities that are built as software components (discrete pieces of code and/or data structures) that can be reused for different purposes. SOA design principles are used during the phases of systems development and integration. -Wikipedia, “Service-Oriented Architecture”

10 Or better yet… A loosely-coupled architecture designed to meet the business needs of the organization.

11 SOA Design Principles Boundaries Are Explicit Services Are Autonomous Services Share Schema & Contract, Not Class Service Compatibility Is Based Upon Policy

12 What is WCF? Windows Communication Foundation (WCF) is a framework for building service-oriented applications. It is a runtime and a set of APIs for creating systems that send messages between services and clients. WCF is the foundation for other distributed technologies by Microsoft, such as Azure, AppFabric, and BizTalk

13 How it works: A WCF Overview

14 TechFuse Suites: Solution Overview

15 WCF Contracts Building out service and data contracts

16 WCF Contracts Contracts determine what data and operations are exposed Service contracts define operations Data contracts define data (duh!) And you’ve got other contracts, too – Message Contracts – Fault Contracts

17 A Contract Is Just a Schema…

18 Service Contracts

19 Data Contracts

20 TechFuse Suites: Contracts and Implementation

21 Configuring the Service

22 Bindings The binding controls the messaging details (what happens on the wire) for that endpoint. Common bindings are common recipes as to how WCF will configure the underlying channel stacks. There are countless extensibility points found throughout the WCF channel layer

23 Sample Binding (older WCF)

24 ABC’s: Address, Binding, Contract

25 TechFuse Suites: Configuration

26 Hosting the Service

27 A WCF Service is a library, it has no life of its own The host brings the WCF service to life by providing the process in which it operates. Most of the time, WCF services will run in a ready-made host environment such as Internet Information Server (IIS) or Azure A lot of things require a host!

28 Creating the Host Create references to: – System.Runtime.Serialization – System.ServiceModel – Your WCF service assembly Create an instance of the ServiceHost class (System.ServiceModel.ServiceHost), passing in a reference to your own service class Call ServiceHost.Open() to start your service and ServiceHost.Close() to stop it. Configure the server settings in the.config file for the Host application.

29 TechFuse Suites: Host Application

30 Using a WCF Service Creating a Client

31 Consuming a service Because WCF exposes service functionality through open standards, such as SOAP, you can use almost any type of client to consume the service. Allowing a.NET client to consume the service is as easy as creating a service reference or generating a proxy through a command-line utility (svcutil.exe) Non-.NET clients would typically use SOAP to consume a WCF Service

32 Creating the Client Create a proxy class by using svcutil.exe or creating a service reference. Configure the client settings in the.config file for the client application Call the open method on the proxy to establish a connection to the service and the close method to end it. Call the operations on the service as you would any method

33 A TechFuse Suites Client

34 Other Things You Can Do with WCF Secure Services RESTful Services Routing Streaming Discovery Web Sockets …and much, much, more

35 What’s New in WCF 4.5 Config File Tootips, IntelliSense Contract-First Generation Generate Classes from Sample XML ASP.NET compatibility mode defaults to “true” WCF Configuration Validation Streaming Improvements Single WSDL ChannelFactory Caching UDP Support HttpClient Class

36 Review What does it mean to be SOA? Contracts and Service Implementation Bindings and Behaviors Hosting the Service Consuming WCF Services What’s New in WCF 4.5?

37 References Wikipedia – “Service-Oriented Architecture” http://en.wikipedia.org/wiki/Service-oriented_architecture http://en.wikipedia.org/wiki/Service-oriented_architecture Stefan Tilkov, “10 Principles of SOA” http://www.infoq.com/articles/tilkov-10-soa-principles http://www.infoq.com/articles/tilkov-10-soa-principles John Spacey, “The 9 Principles of Service Oriented Design” http://simplicable.com/new/the-9-principles-of-soa-design http://simplicable.com/new/the-9-principles-of-soa-design MSDN, “How to: Host a WCF Service in a Managed Windows Service” http://msdn.microsoft.com/en-us/library/ms733069.aspxhttp://msdn.microsoft.com/en-us/library/ms733069.aspx MSDN, “What’s New in Windows Communication Foundation 4.5” http://msdn.microsoft.com/en-us/library/dd456789.aspx http://msdn.microsoft.com/en-us/library/dd456789.aspx MSDN, “Basic WCF Programming” http://msdn.microsoft.com/en- us/library/ms731067.aspxhttp://msdn.microsoft.com/en- us/library/ms731067.aspx MSDN, “Chapter 1: Service Oriented Architecture” http://msdn.microsoft.com/en-us/library/bb833022.aspx http://msdn.microsoft.com/en-us/library/bb833022.aspx

38 Thank You! Ed Jones, MCT, MCPD (Web, Azure), MCTS (WCF, BizTalk) – Email: ed.jones@rbaconsulting.comed.jones@rbaconsulting.com – Blog: http://talentedmonkeys.wordpress.comhttp://talentedmonkeys.wordpress.com – LinkedIn: http://www.linkedin.com/in/edjjones/http://www.linkedin.com/in/edjjones/ http://www.rbaconsulting.com


Download ppt "Getting Started with Windows Communication Foundation 4.5 Ed Jones, MCT, MCPD, MCTS Consultant RBA Inc."

Similar presentations


Ads by Google