19th March 2013

Drupal's Web Service Integration Framework (WSIF) module

John Ennew
Technical Director

Many Drupal projects we work on at Deeson Online include a web services connection to an external service. This can take many forms with many flavours of interface standards. Some examples might be:

  • A payment provider
  • An email delivery service such as MailChimp or Responsys
  • An external membership management system or CRM
  • An integrated site tool such as Apache Solr

After building a number of integrations using a number of different web service standards, we found we were repeating a lot of 'glue', service management and debug code. To generalise this we have developed the Web Services Integration Framework (WSIF) module. The goal of the WSIF is to provide this framework code so that developers can extend it when developing their specific integrations.

For example, when connecting Drupal to an external webservice there are a number of repeated tasks that any good web service integration considers:

  1. Disable the connection to the web service down globally if it stops responding, accepts connections but doesn't respond or runs slowly, to protect Apache clients and stop slow loading pages
  2. Poll the web service when it is globally disabled to see re-enable when it is working correctly.
  3. Singleton and Factory patterns for resource handling.
  4. Global logging and exception handling.
  5. Global caching.
  6. Reporting if the web service is running on the report status screen.
  7. Reporting service failures to an administrator by email.

The framework provides an abstraction layer between the service integration layer (provided by your actual integration module) and Drupal. We've used this framework for external service integration with Drupal using the following underlying technologies/standards:

  • Several SOAP interfaces
  • Remote REST
  • Direct connection to a remote MSSQL server

To find out more, review the code and see how you might use it and check out the Web Service Integration Framework (WSIF) project page on drupal.org. This is very much a work in progress and we welcome contributions on the WSIF issue queue.