How to use the Simple Web Services Framework:

Post to handler.php a field called service_request.

This field is JSON text containing:

  • Numeric user ID
  • Rolling session  key
  • Service requested
  • Action to take
  • Any additional values required by the service

The return value will be a JSON string containing:

  • Numeric user ID
  • New session key value
  • Results from the user exit function

Configuration:

  • config.php contains the URL to the handler.php file and the DB connection information.
  • Define a service
  • Define an action
  • Define a role
  • Create a link from a service and action combination to a function name
  • Add that service and action to a role
  • Add the role to the user

Programming:

  • In the application.php file, create a function corresponding to the configuration above.
  • The function will receive an associative array with all of the contents of the JSON request.
  • The function must return an associative array of the values to be passed back.
  • User ID and session key values will be handled automatically, and do not need to be addressed.

Features:

  • Role based security
  • JSON in, JSON out
  • Rolling key to prevent session hijacking without a state requirement
  • Simple HTTP/S requests to allow access from any platform
  • Delivered example call from PHP