Archive for the ‘Microsoft’ Tag

Choosing between REST and SOAP interfaces

The REST vs SOAP debate has raged for long on the web and elsewhere. This post—largely an attempt to demystify the jargon—adds my inconsequential perspective to the conversation.

REST (REpresentational State Transfer) and Simple Object Access Protocol (SOAP) are two predominant approaches to building web services today. As a developer, when you consume web services in your application, you can use these interfaces to work with data or perform other operations.

While SOAP has been around longer on the web, RESTful interfaces are fast becoming popular due to their use of standard web semantics (HTTP); intuitive verbs like GET, PUT, POST, and DELETE; and uniform resource identifiers (URIs) to perform data operations. RESTful web services can, typically, return data in many formats—JSON, HTML, XML, CSV, etc— further simplifying common data operations.

SOAP, on the other hand, differs from REST in having built-in error handling and support for advanced enterprise security features. Besides data, SOAP web services often expose a portion of business logic that you can consume in your application. SOAP uses XML as the messaging format for all communication, sometimes leading to verbose messages and the requirement for additional data processing.

Typical applications

Smaller data payloads and support for standard web semantics have contributed to the popularity of RESTful interfaces on the social web for browser-based apps, mobile apps, and apps delivering high interactivity.

RESTful interfaces, however, do not have built-in error handling in their standard implementation, requiring clients to retry a connection in the event of a communication failure. Applications requiring more reliable messaging—for example, eCommerce and banking apps—find value in the robust connection/retry logic built into most SOAP interfaces. Also, the availability of established extension protocols, such as WS-Security, make SOAP interfaces inherently suitable for applications requiring enterprise-grade security.

Other considerations

Consider these additional factors while deciding whether RESTful or SOAP interfaces are appropriate for your application:

  • Caching. RESTful interfaces support easier caching through HTTP caching mechanisms.
  • Compatibility. If you’re leveraging existing SOAP-based middleware services for your application, you’d likely want to stick to using SOAP interfaces.
  • Bandwidth and resources. RESTful interfaces are, generally, more resource-efficient than SOAP interfaces.
  • Development environment. Some developer tools and services; Microsoft technologies, in particular; automate several aspects of building and consuming SOAP web services.

Examples: RESTful and SOAP requests

The following sample RESTful request gets the profile of a Google+ user with the ID, userId:

GET https://www.googleapis.com/plus/v1/people/userId

The Google Developers page, SOAP Primer, lists several examples of SOAP requests, complete with their XML envelopes.

Further reading:

Shut down the laptop or put it to sleep?

I’ve often wondered if it’s more efficient to put my laptop(s) to sleep rather than shut them down when I call it a day. It’s usually only a few hours of rest before I return to them.

Googling around, I stumbled upon a credible source that suggests putting the laptop to sleep is often better than shutting it down “if (the interval) is just a few hours or even overnight.” Check out If I’m not planning to use my computer for awhile, should I shut it down or put it to sleep? in the Microsoft knowledgebase.

Relevant excerpts:

If it’s just a few hours or even overnight, it’s usually more efficient to put your computer to sleep, either by clicking the Power button on the Start menu or by closing the lid on your mobile PC. (Some computers also have a dedicated sleep button on the computer case.)

There are several advantages to choosing sleep over shutting down:

  • All your work, including information about the programs you were using such as window location and size, is automatically saved.
  • When you awaken your machine from sleep, you don’t need to restart programs or reopen files as you would if you had shut down the computer.
  • While Windows does use some power in sleep mode, it’s very small: about one-tenth as much as it would need if you left the computer running. A mobile PC typically uses 1 to 2 percent of battery power per hour in sleep mode.
  • When Windows is asleep, it can still download and install updates and perform other routine maintenance tasks. For this reason, some companies require employees to put their computers to sleep rather than shut them down when going home for the evening.

But there are instances when you should shut down your computer fully—for example, when you install a new memory card or other hardware. If you don’t plan to use your computer for several days or more, you should also shut it down.