You are here

README.txt in Web service client 7

Same filename in this branch
  1. 7 README.txt
  2. 7 wsclient_tester/README.txt
Web Service Client Module (wsclient)
------------------------------------
by Klaus Purer (klausi), klaus.purer@epiqo.com
and Wolfgang Ziegler (fago), wolfgang.ziegler@epiqo.com

WSClient provides an interface to consume external web services. It focuses on
integrating web service operations as Rules actions, but can also be used as data
provider for other modules. It also offers a convenient API for developers to
quickly invoke web services.

WSClient ships with two sub-modules that support SOAP and REST endpoints.


Installation
------------

 * WSClient depends on the Entity API module, download and install it from
   http://drupal.org/project/entity
 * The WSClient user interface depends on Rules, download and install it from
   http://drupal.org/project/rules
 * Copy the whole wsclient directory to your modules directory
   (e.g. DRUPAL_ROOT/sites/all/modules) and activate the Web service client and
   Web service client UI modules.
 * The administrative user interface can be found at
   admin/config/services/wsclient
 * If you want to use REST services you have to download and install the
   http_client module (http://drupal.org/project/http_client) and you need to
   activate the Web service client REST module.
 * If you want to use SOAP services you have to activate the Web service client
   SOAP module.


Web service decriptions
-----------------------

 * Before invoking a web service you need a description of it. Enable the Web
   service client examples module to get some examples.
 * The URL of a web service is the base URL for REST services and the link to a
   WSDL file for SOAP services.
 * Every web service has operations, each with parameters and a result.
 * A web service can have custom data types that describe complex parameters or
   results.


Usage with Rules
----------------

 * A web service operation can be executed as Rules action.
 * Go to the Rules UI at admin/config/workflow/rules
 * Add a new rule and choose an event (e.g. "After saving new content").
 * Add an action and choose one in the Web Services group (e.g. "Google Ajax
   APIs: Translate text").
 * Fill out the required operation parameters either directly or use the data
   selection to make use of other variables (e.g. "node:title").
 * Add other follow-up actions to process the result of the web service call.
 * If you need a complex operation parameter, create it beforehand in a "Create
   a data structure" action.


Usage for developers
--------------------

 * You can create web service descriptions in code, see for example
   wsclient_examples.module

 * You can easily invoke web services by loading the description and executing
   an operation (the operation name can be used a dynamic method name):

     $service = wsclient_service_load('google');
     $result = $service->translate('Hallo Welt', 'de|en');

 * Hooks are available for altering requests before and after they are sent
   to the endpoint. See wsclient.api.inc for examples.
   This can be useful for:
   * Adding extra programatic encryption keys if needed by the service to 'sign'
     a request https://www.drupal.org/node/2462103
   * Manipulating parameters such as the endpoint URL when you need to get
     through a firewall or for other reasons https://www.drupal.org/node/2428053

 * Authentication is possible by setting the services 'authentication' setting.

   'Basic' (htauth) authentication parameters can be set with

     $service->settings['authentication']['basic'] = array(
       'username' => 'AzureDiamond',
       'password' => 'hunter2',
     );

    "Web Service Security" protocol is available in the same way.
    See https://www.drupal.org/node/2420779

     $service->settings['authentication']['wss'] = array(
       'username' => 'AzureDiamond',
       'password' => 'hunter2',
     );

File

README.txt
View source
  1. Web Service Client Module (wsclient)
  2. ------------------------------------
  3. by Klaus Purer (klausi), klaus.purer@epiqo.com
  4. and Wolfgang Ziegler (fago), wolfgang.ziegler@epiqo.com
  5. WSClient provides an interface to consume external web services. It focuses on
  6. integrating web service operations as Rules actions, but can also be used as data
  7. provider for other modules. It also offers a convenient API for developers to
  8. quickly invoke web services.
  9. WSClient ships with two sub-modules that support SOAP and REST endpoints.
  10. Installation
  11. ------------
  12. * WSClient depends on the Entity API module, download and install it from
  13. http://drupal.org/project/entity
  14. * The WSClient user interface depends on Rules, download and install it from
  15. http://drupal.org/project/rules
  16. * Copy the whole wsclient directory to your modules directory
  17. (e.g. DRUPAL_ROOT/sites/all/modules) and activate the Web service client and
  18. Web service client UI modules.
  19. * The administrative user interface can be found at
  20. admin/config/services/wsclient
  21. * If you want to use REST services you have to download and install the
  22. http_client module (http://drupal.org/project/http_client) and you need to
  23. activate the Web service client REST module.
  24. * If you want to use SOAP services you have to activate the Web service client
  25. SOAP module.
  26. Web service decriptions
  27. -----------------------
  28. * Before invoking a web service you need a description of it. Enable the Web
  29. service client examples module to get some examples.
  30. * The URL of a web service is the base URL for REST services and the link to a
  31. WSDL file for SOAP services.
  32. * Every web service has operations, each with parameters and a result.
  33. * A web service can have custom data types that describe complex parameters or
  34. results.
  35. Usage with Rules
  36. ----------------
  37. * A web service operation can be executed as Rules action.
  38. * Go to the Rules UI at admin/config/workflow/rules
  39. * Add a new rule and choose an event (e.g. "After saving new content").
  40. * Add an action and choose one in the Web Services group (e.g. "Google Ajax
  41. APIs: Translate text").
  42. * Fill out the required operation parameters either directly or use the data
  43. selection to make use of other variables (e.g. "node:title").
  44. * Add other follow-up actions to process the result of the web service call.
  45. * If you need a complex operation parameter, create it beforehand in a "Create
  46. a data structure" action.
  47. Usage for developers
  48. --------------------
  49. * You can create web service descriptions in code, see for example
  50. wsclient_examples.module
  51. * You can easily invoke web services by loading the description and executing
  52. an operation (the operation name can be used a dynamic method name):
  53. $service = wsclient_service_load('google');
  54. $result = $service->translate('Hallo Welt', 'de|en');
  55. * Hooks are available for altering requests before and after they are sent
  56. to the endpoint. See wsclient.api.inc for examples.
  57. This can be useful for:
  58. * Adding extra programatic encryption keys if needed by the service to 'sign'
  59. a request https://www.drupal.org/node/2462103
  60. * Manipulating parameters such as the endpoint URL when you need to get
  61. through a firewall or for other reasons https://www.drupal.org/node/2428053
  62. * Authentication is possible by setting the services 'authentication' setting.
  63. 'Basic' (htauth) authentication parameters can be set with
  64. $service->settings['authentication']['basic'] = array(
  65. 'username' => 'AzureDiamond',
  66. 'password' => 'hunter2',
  67. );
  68. "Web Service Security" protocol is available in the same way.
  69. See https://www.drupal.org/node/2420779
  70. $service->settings['authentication']['wss'] = array(
  71. 'username' => 'AzureDiamond',
  72. 'password' => 'hunter2',
  73. );