When should a web service not be used?

Web Services are an absolutely horrible choice for data access. It’s a ton of overhead and complexity for almost zero benefit.

If your app is going to run on one machine, why deny it the ability to do in-process data access calls? I’m not talking about directly accessing the database from your UI code, I’m talking about abstracting your repositories away but still including their assemblies in your running web site.

There are cases where I’d recommend web services (and I’m assuming you mean SOAP) but that’s mostly for interoperability.

The granularity of the services is also in question here. A service in the SOA sense will encapsulate an operation or a business process. Data access methods are only part of that process.

In other words:

  - someService.SaveOrder(order);  // <-- bad
    // some other code for shipping, charging, emailing, etc

  - someService.FulfillOrder(order);  //<-- better
    //the service encapsulates the entire process

Web services for the sake of web services is irresponsible programming.

Leave a Comment