About. Net WCF rest

Source: Internet
Author: User
Tags representational state transfer

Rest (representational state transfer) is a design and development method for network applications, which can reduce development complexity and improve system scalability.

Rest puts forward some design concepts and principles:

1. Everything on the network is abstracted as a resource );

2. Each resource corresponds to a unique resource identifier );

3. Operate resources through the general connector interface (generic connector Interface;

4. Operations on resources do not change the resource ID;

5. All operations are stateless ).

For today's most common network applications, resource identifier is a URL and generic connector interface is HTTP. The 4th guidelines are what we often call URL immutability. The resouce in these concepts is the easiest to misunderstand. Resouce does not refer to data, but to Data + specific representation (Representation). This is why the full name of rest is representational state transfer. For example, the data between "the best 10 books sold this month" and "your favorite 10 books" may overlap (if one book is sold well, you like it again ), even identical. However, their representation is different, so they are different resources.

Rest can simplify development because of its introduced architecture constraints. For example, the rest implementation in rails 1.2 limits the number of methods in controller to seven by default: index, show, new, edit, create, update, and destroy are actually implemented for curd. Furthermore, rails (which is also a majority of today's network applications) uses HTTP as the generic connector interface. Http limits the operation on a URL to four: get, post, put, and delete.

Rest can improve the scalability of the system because it forces all operations to be stateless, so there is no context constraint. If you want to do distributed and cluster operations, you do not need to consider the context issue. At the same time, it allows the system to effectively use the pool. Another improvement of rest performance comes from the distribution of client and server tasks. The server is only responsible for providing resource and resource-operated services, while the client needs to render itself based on the data and representation in the resource. This reduces the overhead of the server.

The Android system is related to the WCF rest operation:

Example: Call the WCF Service in Android and call the rest Web Service in Android development.

Microsoft's msdn:

Http://msdn.microsoft.com/zh-cn/library/cc656724.aspx

Http://msdn.microsoft.com/zh-cn/library/bb412169.aspx


 

Blog:

Http://www.cnblogs.com/wzd24/archive/2011/06/13/2080120.html

Http://www.cnblogs.com/wcgwolf/archive/2008/10/16/1312244.html

Instance: Call the WCF Service on Android

Use WCF 4.0 to build a rest Service

Configure XML, JSON

Http://www.cnblogs.com/apiaceae/archive/2010/04/25/1720843.html#commentform

A simple rest service instance

 

WCF rest work summary (1)

WCF rest work summary (2)

 

Other articles:

[01]
A simple rest service instance
[02]
Webhttpbinding and message encoding
[03]
Message Body style)
[04]
Select the Help Page and Automatic Message format (JSON/XML)
[05]
What is special about webservicehost?
[06]
Uritemplate, uritemplatetable, and webhttpdispatchoperationselector
[07]
Implement declarative cache through ASP. NET output caching
[08]
An effective way to improve performance: Conditional Resource Acquisition (conditional retrieval)
[09]
An Effective Method to Solve concurrent resource modification: Conditional update)

Android SMS Assistant (WCF + Android) (1)

Android SMS Assistant (WCF + Android) (2)

 

Http://mobile.51cto.com/android-245534.htm

Load XML documents through URLs

using (WebClient wc = new WebClient())        {            using (Stream s = wc.OpenRead("http://www.meituan.com/api/v1/divisions"))            {                using (StreamReader sr = new StreamReader(s))                {                    string str = sr.ReadToEnd();                    Response.Write(str);                }            }        }

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.