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 described by contracts in WCF.
There are three types of formal contracts that clients and services rely on to control messaging.

The service contract describes the operations exposed by a particular service endpoint.
Each operation,through parameters and return types,defines the format of request and response messages.

A data contract describes how a complex type is serialized as part of a message.
Data contracts are the preferred way to include complex types in a service contract.

A message contract provides control over the format of the entire SOAP message,
including support for custom message headers and individual body elements that can be described by data contracts.

By default,message serialization is handled by the DataContractSerializer.
This is a new serializer introduced with WCF that requires all types to opt-in their exact requirements for serialization—in compliance with SOA tenets.

The DataContractSerializer can serialize data contracts,message contracts,and other serializable types such as those marked with the SerializableAttribute or those that inherit IXmlSerializable (see Figure 2-2).

Figure 2-2. The DataContractSerializer can serialize message contracts, data contracts, and other serializable types

It is also possible to tell WCF to use the XmlSerializer that ASP.NET web services use (useful only in rare cases).
The XmlSerializer provides much less control over serialization in that all public members are serialized.
I’ll discuss these and other serialization concepts later in this chapter.

As you complete the labs in this chapter,you will practice working with service contracts,data contracts,message contracts,other serializable types,and raw messages.
Throughout,I’ll provide you with practical design tips,discuss approaches in contract versioning,and teach you how to override default serialization behaviors.

SOAP, WSDL, and WS*
It is amazing to think about the simplicity of the early specifications: SOAP and WSDL.
By their simplicity,adoption was promoted—web service platforms appeared left and right.
Interoperability issues quickly surfaced,forcing platform vendors to pay close attention to their XML parsers and SOAP engines to improve consistency in how XML schema and WSDL were interpreted.
In the meantime,standards building on SOAP and WSDL emerged to deal with addressing and routing scenarios,security,large binary attachments,reliable messaging,transactions,policy,and more.
Like with SOAP and WSDL,these advanced standards—collectively labeled WS*—cycle through phases of development and approval,vendor adoption,and interoperability testing.
A healthy collection of these advanced standards have been fully ratified by W3C (www.w3c.org) and OASIS (www.oasis-open.org),
while others are still in the development or approval process.

Learning WCF Chapter2 WCF Contracts and Serialization的更多相关文章

  1. Learning WCF Chapter2 Data Contracts

    A data contract describes how CLR types map to XSD schema definitions. Data contracts are the prefer ...

  2. Learning WCF Chapter2 Service Contracts

    A service contract describes the operations supported by a service,the message exchange pattern they ...

  3. Learning WCF Chapter2 Messaging Protocols

    In Chapter 1,you were introduced to fundamental WCF concepts,      在章节1中,学习了wcf中的基础概念including how t ...

  4. 理解WCF中的Contracts

    WCF中的Contracts WCF通过Contract来说明服务和操作,一般包含五种类型的Contract:ServiceContract,OperationContract,FaultContra ...

  5. Learing WCF Chapter1 WCF Services

    WCF ServicesWCF services are the new distributed boundary in an enterprise application—with an empha ...

  6. 跟我一起学WCF(13)——WCF系列总结

    引言 WCF是微软为了实现SOA的框架,它是对微乳之前多种分布式技术的继承和扩展,这些技术包括Enterprise Service..NET Remoting.XML Web Service.MSMQ ...

  7. Learning WCF Chapter2 Service Description

    While messaging protocols are responsible for message serialization formats,there must be a way to c ...

  8. 跟我一起学WCF(7)——WCF数据契约与序列化详解

    一.引言 在前面博文介绍到,WCF的契约包括操作契约.数据契约.消息契约和错误契约,前面一篇博文已经结束了操作契约的介绍,接下来自然就是介绍数据契约了.所以本文要分享的内容就是数据契约. 二.数据契约 ...

  9. 重温WCF之WCF传输安全(十三)(4)基于SSL的WCF对客户端采用证书验证(转)

    转载地址:http://www.cnblogs.com/lxblog/archive/2012/09/20/2695397.html 前一篇我们演示了基于SSL的WCF 对客户端进行用户名和密码方式的 ...

随机推荐

  1. MVC小系列(一)【制作表格】

    在Razor引擎中,对于在表格中进行遍历时,一般会这样写 复制代码 <table border="> @{ ; i < ; i++) { <tr> <td ...

  2. tomcat启动

    http://jingyan.baidu.com/article/c33e3f48a42352ea15cbb5d4.html

  3. Apache + Tomcat + mod_jk实现集群服务及session共享

    实现效果:用apache 分发请求到tomcat中的对应的项目 原理:

  4. UITextField文本字段控件的位置

    如果需要更改默认的UITextField清除按钮.左右视图等等控件的位置,可以通过如下设置: // 控制清除按钮的位置 (默认 width = 15 = height) -(CGRect)clearB ...

  5. 时空分割的画面--用xcode命令行回忆turbo c

    大学时期曾经玩过turbo c的同学,可以用xcode命令行写写c程序,回味一下吧:) 1. 首先在终端输入,touch main.c 新建文件 2. 编辑main.c内容,写一段简单代码 #incl ...

  6. 浪潮MegaCli

    再总结: 一般,清RAID再做RAID,安装完毕后: ./MegaCli64 -PDList -aALL | egrep 'Slot|Enclosure Device'                 ...

  7. 实体框架(Entity Framework)简介

    实体框架(Entity Framework)简介 简称EF,与ADO.NET关系 ADO.NET Entity Framework 是微软以 ADO.NET 为基础所发展出来的对象关系对应 (O/R ...

  8. 网站开发常用jQuery插件总结(六)关键词说明插件cluetip

    我们开发的网站,总有它一定的用途.如企业站用来宣传企业或展示产品,技术站用来分享自己的思路和经验.既然网站有了它的用途,那么就拥有了它本身的关键词(关键词说明网站的主要内容).例如企业站的关键词大部分 ...

  9. laravel队列-让守护进程处理耗时任务

    待解决的问题 最近在做一个服务器集群管理的web项目,需要处理一些极其耗时的操作,比如磁盘格式化分区.对于这个需求,最开始的想法是,为了让节点上的rpc(远程过程调用) service端尽可能简单(简 ...

  10. H5 required 改变错误提示oninvalid、oninput、onforminput

    <input type="text" name="password" oninvalid="this.setCustomValidity('XX ...