<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2363342003820939539</id><updated>2011-08-26T04:42:05.645-07:00</updated><title type='text'>Liqiang's Blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://yuan-fen.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2363342003820939539/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://yuan-fen.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Liqiang</name><uri>http://www.blogger.com/profile/12203252390285035007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>3</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2363342003820939539.post-9172184176730745442</id><published>2010-11-28T17:00:00.001-08:00</published><updated>2010-11-28T17:00:04.850-08:00</updated><title type='text'>Consume REST service on Windows Phone 7</title><content type='html'>&lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Windows Phone 7 (WP7) was out last month. It is a successor to Microsoft’s Mobile platform but completely different from Windows Mobile 6.5 or earlier version. That means no backward compatibility. The programming use Silverlight. For the detailed architecture overview of WP7, there is a great reference here: &lt;cite&gt;ecn.channel9.msdn.com/o9/te/NorthAmerica/2010/pptx/WPH313.pptx&lt;/cite&gt;&lt;/p&gt; &lt;p&gt;The service is the same as the last post (Oct. 25). &lt;/p&gt; &lt;p&gt;Here is the code on the WP7(everything in Silverlight is synchronized):&lt;/p&gt;&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; btnSearch_Click(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt; sender, RoutedEventArgs e)&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        {&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (txtSearch.Text != "&lt;span style="color: #8b0000"&gt;&lt;/span&gt;")&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            {&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; url = "&lt;span style="color: #8b0000"&gt;http://localhost:8000/Users/Eric&lt;/span&gt;";&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                WebClient proxy = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; WebClient();&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                proxy.OpenReadCompleted += &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; OpenReadCompletedEventHandler(proxy_OpenReadCompleted);&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                proxy.OpenReadAsync(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Uri(url));&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            }&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        }&lt;/pre&gt;&lt;/pre&gt;&lt;br /&gt;&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; proxy_OpenReadCompleted(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt; sender, OpenReadCompletedEventArgs e)&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        {&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            DataContractJsonSerializer ser = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; DataContractJsonSerializer(&lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt;(User));&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            User foundUser = ser.ReadObject(e.Result) &lt;span style="color: #0000ff"&gt;as&lt;/span&gt; User;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;null&lt;/span&gt; != foundUser)&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            {&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                txtUser.Text = foundUser.Name;          &lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            }&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        }&lt;/pre&gt;&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;These two namespaces need to be included for Json serialization:&lt;/p&gt;&lt;br /&gt;&lt;p&gt;using System.Runtime.Serialization;&lt;br&gt;using System.Runtime.Serialization.Json;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2363342003820939539-9172184176730745442?l=yuan-fen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuan-fen.blogspot.com/feeds/9172184176730745442/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yuan-fen.blogspot.com/2010/11/consume-rest-service-on-windows-phone-7.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2363342003820939539/posts/default/9172184176730745442'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2363342003820939539/posts/default/9172184176730745442'/><link rel='alternate' type='text/html' href='http://yuan-fen.blogspot.com/2010/11/consume-rest-service-on-windows-phone-7.html' title='Consume REST service on Windows Phone 7'/><author><name>Liqiang</name><uri>http://www.blogger.com/profile/12203252390285035007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2363342003820939539.post-9065030066841352622</id><published>2010-10-25T00:00:00.001-07:00</published><updated>2010-11-28T17:04:07.546-08:00</updated><title type='text'>Why I choose REST over SOAP</title><content type='html'>&lt;p&gt;REST is an architectural style when providing a service which focuses on resources. It is modeled after world wide web which is one of the greatest invention in the 21st century due to its scalability and ease of use. It is stateless means no client context being stored on the server between requests. SOAP is an XML/RPC based protocol. The biggest difference is scalability and complexity. Take a look of these two facts: &lt;br&gt;– 85% clients prefer Amazon RESTful API &lt;br&gt;– Google recently announced it would no longer support its SOAP/WSDL API &lt;br&gt;Because of the uniformity of REST, it is much easier to scale. WS-* (called WS splat) standards associated with SOAP based web services are EXTREMELY complicated. REST plus JSON (can use XML) encoding gave people an efficient and consistent way to provide and consume web services. &lt;br&gt;WCF in .NET 3.5 already support REST. .NET 4.0 provides more support via REST Starter Kit server components. Client component in starter kit didn’t make its way to .NET 4.0 but is available through a separate DLL. &lt;br&gt;Here is a simple REST service implemented in .NET 4.0: &lt;br&gt;&lt;/p&gt;&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    [ServiceContract]&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;interface&lt;/span&gt; IService&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    {&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        [OperationContract]&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        [WebGet(UriTemplate = "&lt;span style="color: #8b0000"&gt;Users/{id}&lt;/span&gt;", ResponseFormat = WebMessageFormat.Json)]&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        User GetUser(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; id);&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        [OperationContract]&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        [WebInvoke(Method="&lt;span style="color: #8b0000"&gt;POST&lt;/span&gt;", UriTemplate = "&lt;span style="color: #8b0000"&gt;Users&lt;/span&gt;", ResponseFormat = WebMessageFormat.Json)]&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        User PostUser(User user);&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    }&lt;/pre&gt;&lt;/pre&gt;&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Service : IService&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    {&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; User GetUser(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; id)&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        {&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; User { ID = id, Name = "&lt;span style="color: #8b0000"&gt;Demo User&lt;/span&gt;" };&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        }&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; User PostUser(User user)&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        {&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; User { ID = user.ID, Name = "&lt;span style="color: #8b0000"&gt;Hello, &lt;/span&gt;" + user.Name };&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        }&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    }&lt;/pre&gt;&lt;/pre&gt;&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    [DataContract(Namespace = "&lt;span style="color: #8b0000"&gt;&lt;/span&gt;")]&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; User&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    {&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        [DataMember]&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; ID { &lt;span style="color: #0000ff"&gt;get&lt;/span&gt;; &lt;span style="color: #0000ff"&gt;set&lt;/span&gt;; }&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        [DataMember]&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; Name { &lt;span style="color: #0000ff"&gt;get&lt;/span&gt;; &lt;span style="color: #0000ff"&gt;set&lt;/span&gt;; }&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    }&lt;/pre&gt;&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;The client sample is built on .NET 4.0 with the REST starter kit used on the client side (using Microsoft.Http):&lt;/p&gt;&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; baseUri = "&lt;span style="color: #8b0000"&gt;http://localhost:8000/Users&lt;/span&gt;";&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; uri1 = baseUri + "&lt;span style="color: #8b0000"&gt;/2&lt;/span&gt;";&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            var client = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; HttpClient();&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            var user = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; User() {ID="&lt;span style="color: #8b0000"&gt;2&lt;/span&gt;", Name="&lt;span style="color: #8b0000"&gt;Foo&lt;/span&gt;"};&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            var content = HttpContentExtensions.CreateJsonDataContract&amp;lt;User&amp;gt;(user);&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            HttpResponseMessage response = client.Post(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Uri(baseUri),content);&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; (content = response.Content &lt;span style="color: #0000ff"&gt;as&lt;/span&gt; HttpContent)&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            {&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; result = content.ReadAsString();&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            }&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            response = client.Get(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Uri(baseUri+"&lt;span style="color: #8b0000"&gt;\\2&lt;/span&gt;"));&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; (content = response.Content &lt;span style="color: #0000ff"&gt;as&lt;/span&gt; HttpContent)&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            {&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; result = content.ReadAsString();&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            }&lt;/pre&gt;&lt;/pre&gt;&lt;br&gt;REST service is based on HTTP stand and doesn’t have its own “standard,” that means it doesn’t have its own “flavor.” This has both pros and cons: the main pro is that it is not vendor dependent, as long as http is supported, it can be consumed as we can see in the client samples. The con is that since no proxy is generated, coding can be a little more than RPC/SOAP style when using a proxy. But this can be solved by using customized or vendor provided client REST support tools (e.g. Microsoft.Http and Microsoft.Http.Extensions). &lt;br&gt;&lt;br&gt;Reference:&lt;br&gt;&lt;br&gt;[1] &lt;a href="http://www.iks.inf.ethz.ch/education/ss07/ws_soa/slides/SOAPvsREST_ETH.pdf"&gt;http://www.iks.inf.ethz.ch/education/ss07/ws_soa/slides/SOAPvsREST_ETH.pdf&lt;/a&gt;&lt;br&gt;&lt;br&gt;[2] http://msdn.microsoft.com/en-us/netframework/cc950529.aspx &lt;br /&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2363342003820939539-9065030066841352622?l=yuan-fen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuan-fen.blogspot.com/feeds/9065030066841352622/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yuan-fen.blogspot.com/2010/10/why-i-choose-rest-over-soap_25.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2363342003820939539/posts/default/9065030066841352622'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2363342003820939539/posts/default/9065030066841352622'/><link rel='alternate' type='text/html' href='http://yuan-fen.blogspot.com/2010/10/why-i-choose-rest-over-soap_25.html' title='Why I choose REST over SOAP'/><author><name>Liqiang</name><uri>http://www.blogger.com/profile/12203252390285035007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2363342003820939539.post-669641302746985571</id><published>2010-10-23T22:12:00.000-07:00</published><updated>2010-10-23T23:09:01.534-07:00</updated><title type='text'>Top lines for this week</title><content type='html'>&lt;span style="color: black;"&gt;&lt;span style="font-size: small;"&gt;1. &lt;a href="http://jquerymobile.com/"&gt;jQuery Mobile released alpha version: touch screen optimized.&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: black;"&gt;&lt;span style="font-size: small;"&gt;2. &lt;a href="http://www.toptechnews.com/story.xhtml?story_id=113006JM16GM"&gt;Verizon staffing up call center for iPhone launch?&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: black;"&gt;&lt;span style="font-size: small;"&gt;3. &lt;a href="http://www.engadget.com/2010/10/20/windows-phone-7-review/"&gt;Windows Phone 7 in-depth review.&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2363342003820939539-669641302746985571?l=yuan-fen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yuan-fen.blogspot.com/feeds/669641302746985571/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yuan-fen.blogspot.com/2010/10/top-lines-for-this-week.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2363342003820939539/posts/default/669641302746985571'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2363342003820939539/posts/default/669641302746985571'/><link rel='alternate' type='text/html' href='http://yuan-fen.blogspot.com/2010/10/top-lines-for-this-week.html' title='Top lines for this week'/><author><name>Liqiang</name><uri>http://www.blogger.com/profile/12203252390285035007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
