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:

My perspective: What is wrong with Flipkart?

Slightly off theme, but I just posted the following answer to the question, “What is wrong with Flipkart?” on Quora:

I used to be a loyal Flipkart customer, even opting for a Flipkart First membership on the very day that it was launched. However, over the past six months or so, their quality of customer service has gone downhill very steeply.

In particular, I found two of their programs particularly deceptive, even to the point of being scams.

Flipkart First

When you opt for premium membership of a reputed eCommerce website, you expect the special privileges to apply to all of the products that it sells. No, Flipkart First applies only to products directly sold by WS Retail, Flipkart’s “frontend operations” company.

You might argue that I should have read the terms and conditions of membership before opting for it. I did. However, what I failed to imagine was that a company of the stature of Flipkart would offer no way to search for WS Retail products on its website. In fact, you can’t search by seller at all. Worse, Flipkart doesn’t even display the seller name upfront on the homepage. One has to click open products one by one to see if they’re sold by WS Retail. What a gaping hole in user experience!

Even then, if you make the effort of ordering only products sold by WS Retail, there’s no guarantee that your product will be delivered within the promised timeframe. A product I ordered on November 3 as a Flipkart First customer has still not been delivered (OD 2011 875 181 457 23 100). So much for their in-a-day delivery promise!

Flipkart e-Gift Vouchers

The name itself is deceptive. These vouchers, again, apply only to WS Retail products. Again, there is no way to search for WS Retail products on Flipkart.com. Why not be truthful and call the vouchers ‘WS Retail E-Gift Vouchers’?

If you’re planning an event or a giveaway, save your participants a full day of trial-and-error shopping. Don’t gift them Flipkart eGift Vouchers!

……

Aside from these two programs, I’ve realized that a lot of Flipkart’s customer experience delivery endpoints are badly broken. Sometimes, the lapses seem deliberate. The other day, I was trying to get on chat with a customer care representative. I was kept waiting for 17 minutes, and right when the system said I was the first one in the waiting queue, I was uncermoniously disconnected with a “Sorry, no agents are currently available!” message. Why keep customers waiting for 17 minutes if no agents are available? Couldn’t Flipkart have handled this situation gracefully, promising a call back within a reasonable timeframe? 

Flipkart’s customer experience used to be the talk of the town not very long ago. They introduced us Indians to a new breed of companies, the one that seemed to value customers. However, all of that good work has come to naught and how quickly! On the contrary, Amazon India has been very gracious whenever I’ve had the opportunity to interact with them.

I wish Flipkart well, but I’m compelled to go with the best customer experience in the end. So will most customers.

MakeMyTrip #fail: Refusal to recognize a glaring bug

This is the first (and, hopefully, the last) rant I’m going to post to this blog.

Recently, I had a surreal experience debating the definition of a usability bug with a MakeMyTrip “engineer”. No, he wasn’t interested in the generally-accepted definitions of a bug; he believed the onus of proving what I’d experienced was a bug fell squarely on me.

Before I share the details of my ordeal, let me quote how Wikipedia defines a software bug:

A software bug is an error, flaw, failure, or fault in a computer program or system that causes it to produce an incorrect or unexpected result, or to behave in unintended ways.

And here’s another definition—this time from an Intel blog:

A usability bug is any unintended behavior by the product which is noticed by the user and has impact on the user.

Did you notice the word “user” in this definition? Yes, the powerless unsuspecting user who often loses money or is put to inconvenience when corporations fail to tie up the loose ends in their code. And money I did lose because of MakeMyTrip. So far, it hasn’t come back to my bank account.

The ordeal…

Here’s how it all began. On December 6, I set out to book an air ticket from Delhi to Bangalore for my upcoming trip. I visited MakeMyTrip on my Windows 8 mobile phone (Nokia Lumia 720) and booked the ticket. When I received the confirmation email (booking ID NF7901329760605), I was shocked to see that the ticket had been booked for Mumbai instead of Bangalore, my intended destination. How did that happen?

When you visit MakeMyTrip.com using a mobile device, you’re presented with the following screen to begin with:

Image

You go ahead and click Book Flights to land at the flight booking form. Notice that Mumbai is the default destination in this form.

Image

You change the destination to your intended destination and select a Departure date:

Image

Now, you try to select a Return date as the next natural step. The form resets the Destination field to Mumbai automatically without any warning! Yes, just like that. See this screenshot:

Image

Note: All these screenshots were taken on January 1, 2014 using my Windows 8 phone.

Proceeding with the process, I ended up booking a ticket to Mumbai instead of Bangalore! What’s worth noticing in this case is that, in all likelihood, users booking their tickets on smaller screens (mobiles and tablets) would realize what happened only after the booking has completed. I’m sure I’m one of the many users reporting this issue to MakeMyTrip.

The endless wait…

I reported the issue to the MakeMyTrip voice-based customer care team as soon as I received the confirmation email (incident ID 131206-037689). On their advice, I also went ahead and booked another ticket for the same departure and return dates (booking ID NF7901129761703)—this time really to Bangalore—and all within a space of 30 minutes. MakeMyTrip customer care also suggested that I cancel the earlier unintended ticket. The cancellation penalty of ₹2000 would be refunded to my account after “due investigation”, I was assured. Just to be sure, I also emailed customer care the details of the case and exact steps to reproduce the bug. See this email.

What followed was 13 days of silence, punctuated only by system-generated emails asking for several two-day extensions to address the issue. Finally, around December 20, I received a call from one Mr Himesh (if I recall the name correctly), apparently from their “technical team”. I walked him through the steps and reproduced the bug on phone. He seemed dismissive right from the beginning and ended the call saying, “Main nahin maanta yeh bug hai” (I don’t believe this is a bug). When I asked him what other name he had coined for the glitch, he had no answer.

No closure…

Surprisingly, even after this interaction, I continued receiving system-generated emails from MakeMyTrip customer care asking for further two-day extensions. Finally, on December 26, I received an email saying “the higher authority” had decided that “there is no bug” and that MakeMyTrip would be unable to refund the cancellation fee.

Persistent, I tweeted to MakeMyTrip customer care and demanded answers to three common-sense questions:

  • Why would I book a ticket to Mumbai when I clearly wanted to go to Bangalore?
  • Beyond doubt, the MakeMyTrip website produced unexpected results in this case, causing me inconvenience and monetary loss. If this issue is not a bug, what exactly is it?
  • Why has MakeMyTrip not bothered to fix this issue even after 20 days of my reporting it? Is customers losing money not a serious matter for the company?

I have received no answers so far.

Hoping against hope…

I’m going to send a link to this blog post to the MakeMyTrip customer care in the hope that somebody who values customers will look into this issue. While a monetary loss of an amount as insignificant as ₹2000 does not bother me much, it is sad that one of the largest online travel companies in India sees no value in familiarizing its employees with the fundamentals of UX and customer advocacy. What’s also evident is that MakeMyTrip customer care is an entirely disorganized department with no effective way of tracking issues to closure.

For the while, I’ve vowed never to book my travels with MakeMyTrip again. By contrast, my experience with their competitor, ClearTrip, has always been great.

One company’s loss is another’s gain. Quite literally in this case.

Quick review of my HMT ADSL 04 automatic watch

One of my passions in life has been watches. There’s something sublime about them, especially the mechanical kind. In particular, I am a big fan of “antique” HMT watches that are hard to lay your hands on these days. While I did have a couple of hand-winding HMTs earlier, I recently acquired my first automatic watch, the HMT ADSL 04. Here’s a short video review:

Do let me know your thoughts/questions.

Self-censoring Facebook at work

If you feel Facebook is a tempting distraction at work, you’re not alone. Plus, most companies now track how much time their employees are spending on social networks. Hogwash? – check out the Time Doctor website to understand the sort of statistics you may be generating in the course of “harmless” Web browsing.

An easy solution to curtail your Facebook usage at work is to block the website at a “local” level on your computer’s operating system. Doing so is easy. Just follow the steps below for your OS.

Windows

  1. Navigate to C:\Windows and right-click notepad.exe. Select Run as administrator. When prompted, click Yes to allow Notepad to make changes to your computer.
  2. In Notepad, open the hosts file for editing. The file is usually located in the C:\Windows\System 32\drivers\etc folder on your computer.
  3. Add the following lines to the file:

    127.0.0.1 https://facebook.com
    127.0.0.1 login.facebook.com
    127.0.0.1 http://www.facebook.com
    127.0.0.1 blog.facebook.com
    127.0.0.1 apps.facebook.com

  4. Save hosts.
  5. Repeat steps 1-4 for all your work computers.
  6. Try opening Facebook.com on each computer. You’ll be redirected to 127.0.0.1 instead.

Mac OS X

  1. Open the Terminal.
  2. At the command prompt, run this command: sudo nano /etc/hosts.
  3. In Nano, add the following lines at the end of the hosts file:

    127.0.0.1 https://facebook.com
    127.0.0.1 login.facebook.com
    127.0.0.1 http://www.facebook.com
    127.0.0.1 blog.facebook.com
    127.0.0.1 apps.facebook.com

  4. Press Control+X to save the hosts file. When prompted, type Y to confirm writing changes to the disk.
  5. Repeat steps 1-4 for all your work computers.
  6. Try opening Facebook.com on each computer. You’ll be redirected to 127.0.0.1 instead.

That’s all. I first came across this useful method on the Hide Tools blog.

PS: I still remain a die-hard Facebook user, but at home. 🙂

Finally got started with Pinterest

Finally, I managed to get past the annoying “Building Feed” message that would greet me every time I logged in to Pinterest.

The workaround is here: https://support.pinterest.com/entries/21124157-issue-building-feed-message-won-t-stop.

I really hope Pinterest fixes this issue soon. It has been open much too long!

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.

Installable clients for SaaS

The more I use smaller-screen devices, the more I get convinced that SaaS software and Web applications deliver the best user experience only when I’m using them through ‘installed’ frontends. Why else would I prefer using the Facebook app on my Android phone over browsing Facebook in a full browser window on my laptop? Or access Twitter using TweetDeck (an AIR application)?

The online-offline integration that such frontends offer takes user experience to a different level. That’s precisely why Picasa is such a pleasure to use on my laptop, as against just using it online. In fact, my mind doesn’t quite register an app running only in the browser as a bonafide app yet!

Why don’t we have more installable frontends for popular SaaS applications out there? Google Docs, for example? That the traditionally shrinkwrap software applications are Web integrated now is a different matter altogether. Adobe Reader and Microsoft Office, for example.

Food for thought, eh?

BTW, this blog post was written using the WordPress app on Android. 🙂

Android: Delete user-added words from the keyboard dictionary

If you use Android on your smartphone, you’d appreciate that it’s really easy to add words to the keyboard dictionary. Next time, when you’re trying to type these words, predictive text inputs makes life simpler for you. Example: since a lot of my text messages are a mix of English and Hindi, I’ve added many commonly-used Hindi words to the dictionary.

So far, so good.

Eventually, like me, you may realize that you’ve added some unnecessary/misspelled words to the dictionary. You now want to delete these words from the dictionary, so that they’re not suggested to you when you’re trying to type something entirely different.

Here are the steps you need:

  1. Tap Settings > Language and Keyboard > Touch Input > Personal Dictionary.
  2. Tap Edit Personal Dictionary.
  3. Tap Menu and then tap Delete.
  4. On the Delete Word screen, select the relevant words and then tap Delete.
  5. You’re done!

The relevant options are a bit buried inside the menus, so I thought a blog post would help. These steps are relevant to Android 2.2 (Froyo) running on my HTC Desire HD.  I guess they’ll be relevant for 2.1 and 2.3 as well.