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 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的更多相关文章
- Learning WCF Chapter2 Data Contracts
A data contract describes how CLR types map to XSD schema definitions. Data contracts are the prefer ...
- Learning WCF Chapter2 Service Contracts
A service contract describes the operations supported by a service,the message exchange pattern they ...
- Learning WCF Chapter2 Messaging Protocols
In Chapter 1,you were introduced to fundamental WCF concepts, 在章节1中,学习了wcf中的基础概念including how t ...
- 理解WCF中的Contracts
WCF中的Contracts WCF通过Contract来说明服务和操作,一般包含五种类型的Contract:ServiceContract,OperationContract,FaultContra ...
- Learing WCF Chapter1 WCF Services
WCF ServicesWCF services are the new distributed boundary in an enterprise application—with an empha ...
- 跟我一起学WCF(13)——WCF系列总结
引言 WCF是微软为了实现SOA的框架,它是对微乳之前多种分布式技术的继承和扩展,这些技术包括Enterprise Service..NET Remoting.XML Web Service.MSMQ ...
- Learning WCF Chapter2 Service Description
While messaging protocols are responsible for message serialization formats,there must be a way to c ...
- 跟我一起学WCF(7)——WCF数据契约与序列化详解
一.引言 在前面博文介绍到,WCF的契约包括操作契约.数据契约.消息契约和错误契约,前面一篇博文已经结束了操作契约的介绍,接下来自然就是介绍数据契约了.所以本文要分享的内容就是数据契约. 二.数据契约 ...
- 重温WCF之WCF传输安全(十三)(4)基于SSL的WCF对客户端采用证书验证(转)
转载地址:http://www.cnblogs.com/lxblog/archive/2012/09/20/2695397.html 前一篇我们演示了基于SSL的WCF 对客户端进行用户名和密码方式的 ...
随机推荐
- C#里面比较时间大小三种方法
1.比较时间大小的实验 string st1="12:13";string st2="14:14";DateTime dt1=Convert.ToDateTim ...
- Js~数组的操作push,pop,shift,unshift
说几个概念: 队列:先进先出堆栈:先进后出 shift:从集合中把第一个元素删除,返回这个元素的值pop:从集合中把最后一个元素删除,返回这个元素的值 unshift:在集合开头添加一个或者多个元素, ...
- 使用ROW_NUMBER进行的快速分页
DECLARE @pageSize INT ; DECLARE @pageIndex INT ; SET @pageSize = 5 SET @pageIndex =2 ; --第二页,每页显示5条数 ...
- FOR XML PATH 转换问题
以下我带大家了解关于 FOR XML PATH 首先我们看下所熟悉的表数据 之后转换 <骨牌编号>1</骨牌编号> <骨牌颜色>橙</骨牌颜色> < ...
- ORACLE 11g R2数据库安装硬件环境要求
物理内存要求:最小1G,在windows7,windows8,windows8.1上最小2G. 虚拟内存(或分页空间)容量要求: Available RAM Swap Space Required B ...
- Java之反射的应用
package com.zheges; import java.util.Date; public class Customer {//JavaBean 对象 private String nam ...
- 菜鸟笔记之java中方法使用
N!!!java中无参无返回值方法的使用 1,定义方法 eg: public void show(){ System.out.println("HelloWorld!") } -- ...
- 关于Spring AOP和IOC的一些总结
Spring官方网站:https://spring.io/ 最早对象的创建是有new关键字,但是如果产生的类比较繁多或者复杂,就用工厂代替new关键字,但是工厂的控制能力有限,譬如对产生对象的生命周期 ...
- Leaflet交流
GIS科研网 Leaflet交流 谢绝转载 http://www.3sbase.com欢迎加群交流 108299288 http://www.3sbase.com/3sbase/webgistest ...
- 不对称密钥密码体系之RSA
公钥密码的特性: 1.加密和解密使用不同的钥匙 2.从一个钥匙推出另一个钥匙在计算上不可行 3.每个钥匙都可以做加密和解密 RSA算法: 1978年, MIT三位数学家 R.L.Rivest,A.Sh ...