Tuesday, February 4, 2014

A reusable Canadian address builder/validator widget (1)


My recent work is to develop a Canadian address builder / validator for existing web pages where client's addresses need to be generated while enforcing accuracy. I will write two posts describing the solution. Here are the topics:

  • Introduction
  • The user experience
  • How it works
  • The configuration
  • Integrate with address hosting page
  • The backend WCF service
  • Multiple addresses support

Introduction

AddrBdr is a javascript component for building/correcting/verifying a Canadian address. It is part of address solution in applications that host a collection of client addresses and require them to be correct/up-to-date.

The user experience

AddrBdr has two working context and auto-switches between them: postal search and address correction. To create a new address, the user is guided to the postal code search function where the user keys in a postal code and the application conducts look-up, then from the suggested addresses the user chooses one. Next, the user fine-tunes the selected address before accepting it. Once the Accept button is clicked, AddrBdr verifies the address. If failed, AddrBdr prompts the user with “Continue” and “Cancel” options.  AddrBdr allows the user to accept an unverifiable address, but will mark it as ‘unverifiable’ on to the address hosting page, so that it can be tracked and processed by the application later in other functions.

In case of updating an address which means an address has already been populated on the hosting page, AddrBdr guides the user to address correction mode,  the user types in / updates address fields while AddrBdr constantly tries to correct/complete the address, when succeeds it prompts a “corrected” message.  To accept the address, AddrBdr will validate it in the same way as mentioned above.

 

How it works

AddrBdr works on top of a Canada Post certified .Net API, which includes an address database published by Canada Post and updated monthly. AddrBdr Server-side wraps up the API and exposes a WCF service. Then AddrBdr Front-end accesses the address database through SOAP/WCF.

Normally the database file (Access db) is deployed  in a folder on the hosting machine of the web application, where the AddrBdr WCF is also hosted. The local folder for the database also serves as cache facility utilized by the API. This “local” hosting strategy will result in optimal performance benefits.

The configuration entry required by AddrBdr WCF:





(to be continued)

No comments: