Pablo M. Cibraro (aka Cibrax)
My thoughts on Web Services and .NET development
-
Testing WCF REST Services
Many of the WCF services that we build today rely on the WCF context (OperationContext and WebOperationContext) for performing different things, specially REST services where the context is necessary for settings and getting Http status codes or headers. The fact that the WCF context does not expose interfaces or base classes complicates the unit testing a lot. In this sense, I like the approach taken by the ASP.NET MVC team, all the classes exposed by the HttpContext as properties are base classes, so they can be easily mocked.
In order to test a WCF service with what we have today, we have to either test the service as a black box (integration tests, which requires a lot of plumbing code to setup all the WCF infrastructure for the test, channels, host, client, etc) or create some wrappers to encapsulate the WCF context behavior, as I mentioned in this post "Unit tests for WCF services" -
Adding Conditional Get Support to the WCF REST Starter kit
Some weeks ago, I discussed how important "Conditional Get" can be for some scenarios, specially when we want to make a better use of the network traffic.
-
Dynamic Content Type - A nice to have feature for the WCF REST Starter Kit
One of the missing features in the WCF web model is the ability to have a single operation definition and switch the content type for the response according to some runtime setting (Which could be the Accept or Content-Type request header for instance).
-
WCF Workflow services in business applications
It's pretty interesting to see how useful workflow services can be sometimes, specially for business applications that require orchestrating several back-end services calls.
-
My durable WCF RESTful calculator
A durable service in WCF is by a definition a service that can persist all its internal state across calls in some durable storage. For every operation, the service state is retrieved from the storage, the operation is executed and finally the state is persisted again in the storage. Therefore, there is not need to keep the service instance idle in memory while waiting for client calls. It is equivalent to a long run session, which make this feature something ideal for long-running processes like workflows (In fact, workflow services are mount on top of this feature),
-
Open Source alternatives in .NET for building RESTful services
Usually all my posts about REST are about WCF or mention this technology in some parts. Today, I decided to take a different approach and discuss some of the projects available today for building REST services, Resourceful and Dream framework (Both available for mono as well).
It is worth mentioning however that the WCF team has made an excellent work introducing the new Web Model in .NET 3.5, it has definitively helped a lot to adopt this kind of service in the .NET platform. In my opinion, there are still some aspects in WCF that could be improved, -
Using the WCF OAuth channel with an ADO.NET service
As I promised in my previous post "OAuth Channel for WCF RESTful services", it is now time to show this new channel in action with a real service. To make this sample more interesting, I decided to base this implementation on an ADO.NET service that provides information about contacts.
-
OAuth channel for WCF RESTful services
While OpenID and WS-Federation focus on delegating user identity (or a collection of identity claims), OAuth was designed to address a different and complementary scenario, the delegation of user authorization. In few words, OAuth allows a client application to obtain user consent (as access tokens) for executing operations over private resources on his behalf.
-
Routing to the right workflow service instance through URI templates (REST workflows part III)
Continuing from my previous posts "REST and Workflow services play well together I" and "REST and Workflow services play well together II", in which I created a new binding to send the workflow context as an http header, I've applied some modifications to that sample to support also routing through URI templates. This is very helpful for scenarios where client applications are not necessarily aware of the existence of a workflow services on the other end, so the context information is reconstructed from the resource URI using Uri templates.
-
Conditional Puts in REST
Conditional puts is a technique generally used in a REST architecture to inform clients about possible conflicts when multiple updates are performed simultaneously over the same resource version. It basically works as fist-write / first-win approach, a client can only commit an operation only if the underline resource has not changed in the meanwhile, otherwise it may receive a http conflict error.