Learning WCF Chapter2 Service Description

While messaging protocols are responsible for message serialization formats,
there must be a way to capture the protocols required to communicate between clients and services.
In Chapter 1,you worked with WSDL documents,which describe the requirements of a service,
including the operations associated with each endpoint and the protocols used by each endpoint.
In this section,I’ll discuss the relationship between the service description, message exchange patterns, and WSDL.

Service Description

Services may implement one or more endpoints,each possibly supporting a different set of operations,messaging protocols,message encoding formats,and transport protocols.
Collectively,this information about a service is part of the service metadata,as I discussed in Chapter 1.
This can also be referred to as the service description.

In fact,WCF represents this information at runtime as a ServiceDescription type from the System.ServiceModel namespace.
The ServiceDescription type is a runtime representation of
all service endpoints and their associated service contracts,
the binding configuration that describes protocol support,
and local behaviors that affect how the service model processes messages.

It is the ServiceDescription type that is used to generate the WSDL document,
and it also supports dynamic metadata exchange so that clients can discover at runtime what protocols are required to invoke service operations.
Recall from Chapter 1 that SvcUtil is used to generate proxies for clients by consuming a WSDL document or using dynamic metadata exchange,
which is based on WS-MetadataExchange protocol (see Figure 2-1).

Figure 2-1. SvcUtil can generate proxies from a WSDL document or by using dynamic metadata exchange

WSDL
SOAP protocol defines the basic requirements to allow platforms to process SOAP messages,extracting headers and body elements to perform work.
Obviously,to understand the header and body elements,the platform also needs to know the format of those elements.
That’s where WSDL comes in.

WSDL describes the core messaging requirements for communicating with a service.
As you learned in Chapter 1,an XML document describes a service,its available endpoints and associated addresses,the protocols supported by each endpoint,and the list of operations and messages associated with each endpoint.
It includes XSD schema describing each message and the contents of the message.
While the message is framed in SOAP,WSDL describes the application-specific schema for each header and each body element.
In this chapter,I’ll be discussing how service contracts and data contracts contribute to the WSDL document.

WSDL is enough to describe application messaging requirements;
however,it is not enough to describe other protocol support related to WS*,for example.
That’s where WS-Policy comes in.

WS-Policy
WS-Policy is an interoperable standard for describing extended protocol requirements,or policy,for a particular endpoint.
The WS-Policy specification describes how to include policy in the WSDL document either directly or as an attachment(actually, that specification is called WS-PolicyAttachment).

While policy does not have an effect on the business messages exchanged between clients and services,
it does affect how the plumbing provided by the service model builds and serializes messages.
WS-Policy extensions exist for security,transactions,reliable messaging,sessions,
and other features that are defined by attributes applied to the service contract or through binding configuration.
Most aspects of the binding configuration are shared with clients through the policy section of the WSDL document,
enabling clients to build an equivalent channel stack to call services.

Note:
Throughout this book as I discuss bindings (Chapter 3) and other features related to security and reliability, I’ll discuss policy-related features.

WS-MetadataExchange
WS-MetadataExchange is a standard protocol that defines how to retrieve some or all of the service description at runtime.
This includes retrieving the contents of the entire WSDL document or possibly retrieving specific policy requirements related to security, for example. SvcUtil uses this protocol to generate proxies.

时间: 2024-08-30 06:34:57

Learning WCF Chapter2 Service Description的相关文章

Learning WCF Chapter2 Service Contracts

A service contract describes the operations supported by a service,the message exchange pattern they use,and the format of each message. The service contract is also the main driver for generating a service description. A valid WCF service implements

Learning WCF Chapter2 Data Contracts

A data contract describes how CLR types map to XSD schema definitions. Data contracts are the preferred way to enable serialization of complex types included in operation signatures as parameters or return values. You create a data contract by applyi

Learning WCF Chapter2 Messaging Protocols

In Chapter 1,you were introduced to fundamental WCF concepts,      在章节1中,学习了wcf中的基础概念including how to create and consume a service,           包括如何创建以及调用服务how to host a service and expose endpoints where it can be reached by clients,    如何托管服务,使得客户端可以

Learning WCF Chapter2 WCF Contracts and Serialization

So far I’ve talked about the standards behind it all,but in fact WCF hides most of this from the developer by providing a programming interface for designing service contracts and controlling the message format. Application messaging requirementsare

Learning WCF Chapter1 Generating a Service and Client Proxy

In the previous lab,you created a service and client from scratch without leveraging the tools available to WCF developers. Although this helps you to understand the raw requirements for sending messages between clients and services,in reality,develo

WCF Windows Service Using TopShelf and ServiceModelEx z

http://lourenco.co.za/blog/2013/08/wcf-windows-service-using-topshelf-and-servicemodelex/ There are two excellent .NET libraries that help us to build enterprise solutions using the Windows Communication Foundation (WCF) – TopShelf and ServiceModelEx

WCF - Windows Service Hosting

WCF - Windows Service Hosting The operation of Windows service hosting is a simple one. Given below are the steps with requisite coding and screenshots that explain the process in an easy way. 在windows服务上托管wcf是一个简单的操作. Step-1: Now let’s create a WCF

WCF RIA SERVICE相关技术

WCF RIA SERVICE实体属性拷贝 private void DoSubmit() { ((IEditableObject)this.RepairContract).EndEdit(); var domainContext = new DmsDomainContext(); var newRepairContract = new RepairContract(); domainContext.RepairContracts.Add(newRepairContract); newRepai

WCF Data Service ----理论准备

WCF数据服务(WCF Data Service )是.NET Framework的一个组件. 可以使用此组件创建一些服务,利用开放式数据协议(OData)来借助具象状态传输(REST)语义通过Web或Intranet公开和使用数据. OData(Open Data Protocol)开放数据协议 OData将数据公开为可通过URI寻址的资源,可使用GET.PUT.POST和DELETE这些标准HTTP谓词来访问和更改数据. OData使用Entity Data Model的实体关系约定,将资源