基本信息出版社:东南大学出版社
页码:287 页
出版日期:2009年05月
ISBN:7564116501/9787564116507
条形码:9787564116507
版本:第1版
装帧:平装
开本:16
正文语种:英语
外文书名:RESTful.NET
内容简介 《RESTful.NET应用(影印版)》是第一本为欲使用最新的微软工具建立RESTful web服务的Windows开发人员而准备的书。《RESTful.NET应用(影印版)》作者Jon Flanders是WCF(WindowsCommunication Foundation)专家。这本简单实用的教程示范了如何使用WCF和.NET 3.5 Framework的其他组成部分,来建立、部署并使用多种应用场景中基于REST的wleb服务。RESTful体系结构提供了比SOAP、SOA或繁琐的WS-*堆栈更为简单的方式以建立web服务。WCF已经被证实为无须依托WS-*标准即可建立分布式处理系统的灵活技术。《RESTful.NET》为消耗机器和人力建立web服务提供了一个WCF REST编程模型的完全指导。
媒体推荐 “REST是简易的,WCF却不是这样。要切实理解并利用这部分的WCF,需要一个有丰富知识和实战经验的指导者。我想不出比Jon Flanders更适合担任这个角色的人……Jon在解释复杂的概念方面功夫一流。在创建和使用WCF的这些服务上,这本书是我见过的最好的介绍。”
——DaVid Chappell,Chappell&Associates公司
编辑推荐 《RESTful.NET应用(影印版)》是由东南大学出版社出版的。
目录
Foreword
Preface
1. REST Basics
Architecture of the World Wide Web
SOAP
REST
Resources and URIs
Uniform Interface
Resource Representations
Implementing a Simple RESTful Service Example
Resources
URIs and Uniform Interface
Representations
Interaction
Wrap-Up
Processes
Summary
2. WCF RESTful Programming Model
Isn't WCF All About SOAP?
Channels and Dispatching
HTTP Programming with WCF 3.0
Web Programming in WCF 3.5
WebHttpBinding
WebHttpBehavior
WebServiceHost
WebOperationContext
WebGetAttribute
UriTemplate
UriTemplate Literal Values
UriTemplate Special Values
UriTemplate QueryString
Summary
3. Pr0gramming Read-0nly Services
Using WebGetAttribute and UriTemplate
Data Formats
Message
DataContract
XmlSerializer
Hybrid Approach
Summary
4. Programming Read/Write Services
POST, PUT, and DELETE
Using WeblnvokeAttribute
Resources
URIs and Uniform Interface
Representations
Implementation
Summary
5. Hosting WCF RESTful Services
WCF REST Hosting Isn't a Special Case
Self-Hosting
Configuring, Opening, and Closing a ServiceHost
Base Addresses
ServiceHost Versus WebServiceHost
Custom ServiceHost
Hosting in IIS
ASP.NET Compatibility
Multiple Hosmames
Removing the .svc File Extension
Custom ServiceHostFactory
Hosting Wrap-Up
Summary
6. Programming Feeds
Building a Feed with WCF
SyndicationItem
Formatters
Exposing a Feed on a Live URI
Feed Validation
Adding Links to a Feed
Summary
7. Programming Ajax and Silverlight Clients
WCF Web Services and Ajax
JSON
JSON-Enabling a Service Endpoint
ASP.NET Ajax
Silverlight 1.0
Silverlight 2.0
Parsing XML in Silverlight 2.0
Parsing JSON in Silverlight 2.0
Consuming Feeds in Silverlight 2.0
Cross-Domain Security in Silverlight 2.0
Returning JSON and XML Conditionally with a Single Method
Summary
8. Securing REST Endpoints
Authenticating: Self-Hosted Endpoints
Setting Endpoint Security: WebHttpBinding.Security's Mode Property
Setting Authentication Requirements: WebHttpBinding's Transport
Property
Authenticating: Managed Hosting Endpoints
Authorizing Endpoints
Authorization with Impersonation
Role-Based Authorization
Summary
9. Using Workflow to Deliver REST Services
Consuming REST Services from WF
The SendActivity Instance
The ReceiveActivity Instance
Stateless Workflow Services
Stateful Workflow Services
Summary
10. Consuming RESTful XML Services Using WCF
Defining the Client
Generating the Contract
Creating the Resource Representations
Creating the ServiceContract
Using the Service
Client Extensibility
Summary
11. Working with HTTP
Programming HTTP with WCF
IncomingWebRequestContext
OutgoingWebResponseContext
OutgoingWebRequestContext
IncomingWebResponseContext
Context Wrap-Up
Status Codes
201 —— Created
404 —— Not Found
Conditional GET
LastModified
ETags
Caching
Output Caching
HttpContext.Cache
Content-Type
Summary
A. WCF 3.5 SP1
B. ADO.NETData Services.
C. ADO.NET Entity Framework Walkthrough
Index
……
序言 I've been working with the Web throughout my entire software engineering career. Istarted out writing ASP pages and COM components. I then moved into the worldof .NET with ASP.NET and ASMX web services
In 2004, I got involved with BizTalk Server, which pushed me even more into the worldof services and XML. I worked with Windows Communication Foundation (WCF) inits early beta stages, before its release in 2007. At that time, the Microsoft world ofservices was focused on service-oriented architecture (SOA), SOAP, and the WS-*specifications as the preferred methods for building services
Had I been paying attention, I would have noticed that in 2000 a man named RoyFielding had written a doctoral dissertation describing the architecture of the Web. By2000, the Web had arguably become the world's biggest and most scalable distributedapplication platform. In his dissertation, Fielding examined this platform and distilledfrom it an architectural style based on the factors that led to its success. He named thisarchitecture REST and suggested it as a way of building not only websites, but also webservices
REST is an architecture that uses the strengths of the Web to build services. It proposesa set of constraints that simplifies development and encourages more scalable designs.Developers (the majority of whom were outside the Microsoft world) began to adoptthis set of architectural constraints shortly after it was proposed (although, to be fair,there were a few inside the Microsoft camp who jumped on the REST technology).Many toolkits embraced REST as the major driver for building applications and serv-ices, especially Ruby on Rails, which soared in popularity
Although WCF isn't tied to SOAP and WS-*, the majority of its programming modelwas initially geared toward building those kinds of services. The WCF channel modelactually did have support for building services using REST, but the WCF programmingmodel lacked explicit support for doing so
In 2007, a Microsoft program manager named Steve Maine spearheaded an effort tobuild a REST programming model on top of the WCF infrastructure. This model wasreleased with WCF 3.5 in early 2008
文摘 插图:

People often ask me why I would use WF when anything that I canaccomplish in WF could be written using just code. My typical answeris that I think WF is a powerful model for some (perhaps many) usecases because of the visibility it provides, both at development time andat runtime. For instance, notice that I didn't have to spend much timeexplaining what this workflow does, as Figure 9-1 explains it well. Infact, while I was writing this chapter, I asked my 15-year-old son (whois not a developer) to look at the figure, and with no background knowl-edge of WF he was able to discern the functionality of the workflow.Using WF to explain application logic to a 15-year-old is probably astretch, but I think it illustrates the power of WF's visibility-encouragingmodeling.
The workflow first checks the blog entry for any spelling errors. If there are errors, theUI will notify the user and allow him to fix the errors. Then the workflow creates anAtom entry, and finally it executes the last and most important activity in the workflow:the AddEntry activity. This instance of SendActivity will call the RESTful endpoint thatimplements the service function of the IBlogAPI contract (the code for the IBlogAPIcontract is included with the code samples for this book).
You can add a 5endActivity instance to your workflow by dragging it from the Toolboxand dropping it onto your workflow design surface in the appropriate area. To config-ure it, double-click on it in the Designer (or go to the Property Grid and modify all therequired properties). When you double-click on SendActivity, the Choose Operationdialog box will appear (see Figure 9-2).