怎样构建?
•
您需要什么样的资源?
•
将使用哪些
URI
表示这些资源?
•
每个
URI
将支持统一接口的哪些部件(
HTTP
动词)?
URI的处理
•
UriTemplate
–
System.UriTemplate
--
构建
URI
–
System.UriTemplateMatch
–
分析
URI
![](https://i-blog.csdnimg.cn/blog_migrate/c50a908b029c90854a424ff128f83a63.png)
WCF 约定中的 HTTP 动词
•
WebGetAttribute
–
HTTP GET
动词所使用
•
WebInvokeAttribute
–
除
HTTP GET
以外的其他任何
HTTP
动词所使用
![](https://i-blog.csdnimg.cn/blog_migrate/e57fb4bb4beaf921a371158f01d3bb5e.png)
传输格式的转换
•
WebHttpBinding
–
支持
XML
、
JSON
和原始二进制数据
•
WebHttpBehavior
–
与
WebHttpBinding
配合使用
–
提供必要格式化程序和操作选择器等
•
ResponseFormat
=
WebMessageFormat.Json
–
指定
Response
格式