Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
dev:web_services [2007/10/11 09:48] ishan |
— (current) | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Web Services ====== | ||
- | |||
- | Right now the web services are exposed as SOAP. Work is underway to support REST. The NuSoap library is used,but it does not support the entire WS* stack. Thus HTTP Basic authentication is used. Research is underway in to the recently released WSF/PHP SOAP library( released last month). Its the only library that supports the entire WS* stack. | ||
- | |||
- | Module developers can expose their functions using Sahana Web Services module. Developers needs to create two files to to their module directory. | ||
- | |||
- | - api.inc | ||
- | - ws.xml | ||
- | |||
- | |||
- | ==== api.inc ==== | ||
- | |||
- | |||
- | In this file, developers can define functions that are expected to expose as Web Services. | ||
- | |||
- | e.g. | ||
- | |||
- | <code php> | ||
- | /**. | ||
- | *This function return all the catalog names | ||
- | * @access public | ||
- | * @return array | ||
- | */ | ||
- | function shn_cs_get_all_catalog_names() | ||
- | { | ||
- | global $global; | ||
- | $db=$global[" | ||
- | $query=" | ||
- | $res=$db-> | ||
- | $unit_name_arr = array(); | ||
- | |||
- | while(!$res==NULL && !$res-> | ||
- | { | ||
- | $catalog_list[] = array(' | ||
- | $res-> | ||
- | } | ||
- | | ||
- | return $catalog_list; | ||
- | } | ||
- | </ | ||
- | |||
- | ==== ws.xml ==== | ||
- | |||
- | This file is used by the WS module to identify exposed services and their input/ | ||
- | |||
- | e.g. | ||
- | <code xml> | ||
- | <?xml version=" | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | List items in all inventories with associated quantities. | ||
- | </ | ||
- | < | ||
- | < | ||
- | shn_ims_list_item_by_inventory | ||
- | </ | ||
- | <input type=" | ||
- | < | ||
- | < | ||
- | A useful method to retrieve a list items in an all or a particular inventory with associated quantities | ||
- | </ | ||
- | </ | ||
- | < | ||
- | < | ||
- | Item Details | ||
- | </ | ||
- | < | ||
- | < | ||
- | shn_ims_get_item_details | ||
- | </ | ||
- | <input type=" | ||
- | < | ||
- | < | ||
- | | ||
- | inventories it is located in, quantities and expiry | ||
- | </ | ||
- | </ | ||
- | </ | ||
- | </ | ||
- | </ | ||
- | |||