Demystifying The Code

REST in WCF – Part VI (HI-REST – Consuming our GET service via AJAX)

In Part V of this blog series I completed the service operation exposed via HTTP GET in a HI-REST manner.  Because the service was exposed via GET and had a representation format of POX, we were able to easily test it using our browser.  That is all well and good for testing purposes, but we are going to need to call our service from a real client, at some point.  We have a variety of choices when deciding upon our clients… We could write an ASP.NET client, an AJAX client, a Silverlight client, a smart client, an office client, etc.  For the purposes of this blog post, I will illustrate how you can call this service from an AJAX client.  By the time I am done with this post, you will have a newfound respect for the client proxy generation functionality exposed by the enableWebScript endpoint behavior (described in Part III of this series).

[ Read More → ]

REST in WCF – Part V (HI-REST – Exposing a service via GET – The ServiceContract and Implementation)

In yesterdays post (Part IV of the series), I began the process of developing a HI-REST GET service operation.  I noted that there is not a template (yet – it is coming in the REST toolkit due out later this year) for HI-REST services.  So, I decided to start by using the plain vanilla ‘WCF Service’ Visual Studio template.  This template defaults to a HTTP SOAP binding that supports advanced web service standards.  I next illustrated what we need to do to convert this configuration to support a HI-REST service.  Essentially it boiled down to 3 things: 1. Set the binding in your endpoint to webHttpBinding, 2. Add a behavior under the endpointBehaviors element that has a webHttp child element and 3. Add a behaviorconfiguration to your endpoint that references the endpoint behavior added in step 2.

In this post, we will complete the development of this HI_REST GET service operation. 

[ Read More → ]

REST in WCF – Part IV (HI-REST – Exposing a service via GET – Configuring the service)

In part I of this series, I gave a brief overview of REST and put forth the concept of the REST continuum.  I made the case that differing folks had differing views on what REST is and that is ok.  I put forth the case that these differing definitions of REST made up a continuum of sorts, with one end being LO-REST and the other HI-REST.  In parts II and III, I introduced the webHttpBinding, a new binding to WCF 3.5 (part of Fx 3.5 that installs with VS 2008).  I discussed that this is the binding that now allows us to expose services RESTfully.  I noted that when working with this binding, your endpoint must have a behaviorConfiguration that ties it to one of two endpoint behaviors: enableWebScript and webHttp.  I pointed out that the enableWebScript endpoint behavior was an AJAX-Friendly implementation of the webHttp endpoint behavior (it is actually a subclass).  Lastly, I build a sample utilizing the AJAX-Friendly endpoint behavior (enableWebScript) and postulated that this type of implementation was RESTful and fell along the LO side of the continuum.

In this post and the following few, I will introduce the features of the webHttp endpoint behavior.  I will illustrate how you can take advantage of these features to implement services that fall on the HI-REST end of the continuum.  Specifically, in today’s post, I will illustrate the GET functionality. 

[ Read More → ]

REST in WCF – Part III (AJAX Friendly Services, Consuming The Service)

In yesterdays post REST in WCF – Part II (AJAX Friendly Services, Creating The Service), I introduced a starter solution containing a few ASP.NET AJAX client library controls.  The starter solution was stubbed out, awaiting the implementation of an AJAX-Friendly WCF service and the client code to call that service.  I then went through and implemented an AJAX-Friendly service, taking advantage of the webHttpBinding and the enableWebScript endpoint behavior.

In this post I am going to implement the client-side code that consumes our service.  You will remember from the last post that Catalog.aspx (the main page in the application that contains the AJAX controls) had a stubbed out method GetData.  This method is called when the page is initialized.  It is also called when the user navigates between pages of products.  It is here that I need to add the code to call my WCF service. 

[ Read More → ]

REST in WCF – Part II (AJAX Friendly Services, Creating The Service)

In yesterday’s post REST in WCF – Part I (REST Overview), I gave a brief overview of REST, putting forth the idea of a continuum of RESTfulness of services, ranging from HI REST to LO REST.  In this post, I am going to illustrate, perhaps the most familiar kind of RESTful WCF service, an AJAX Friendly service.  As we will see, this kind of service will fall on the LO REST side of the continuum.  Now, some people naturally see bigger and higher as necessarily better, therefore discounting the viability of this LO REST implementation.  As you will see in this post, that is not the case.  The AJAX Friendly WCF service is indeed quite powerful and consequently helpful.

[ Read More → ]

REST in WCF – Part I (REST Overview)

I will be doing an interactive theatre session at TechEd in a few days (if you are going to be there, stop by – info below).  The topic of the session is REST in WCF.  I thought it might be nice to blog about the topic, as I review my demos, so here goes:

I have given this talk a number of times in the past and usually start with a brief overview of REST.  I’ll do the same here, but before I begin (and you start drafting your response), I want to bring up the fact that EVERYONE seems to have a different definition of REST.  Some of these definitions are more stringent, while others are more liberal.  I tend to envision a continuum of RESTiness (as GW would put it).  See below…

[ Read More → ]

« Previous Page

Demystifying The Code