Source for file webservice.php
Documentation is available at webservice.php
* This implements the KnowledgeTree Web Service in SOAP.
* @license http://www.knowledgetree.com/KPL KnowledgeTree Public License Version 1.1
* The contents of this file are subject to the KnowledgeTree Public
* License Version 1.1 ("License"); You may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.knowledgetree.com/KPL
* Software distributed under the License is distributed on an "AS IS"
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* The Original Code is: KnowledgeTree Open Source
* The Initial Developer of the Original Code is The Jam Warehouse Software
* (Pty) Ltd, trading as KnowledgeTree.
* Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright
* (C) 2007 The Jam Warehouse Software (Pty) Ltd;
require_once('../config/dmsDefaults.php');
require_once('../ktapi/ktapi.inc.php');
require_once('SOAP/Server.php');
require_once('SOAP/Disco.php');
require_once('KTDownloadManager.inc.php');
// TODO: Test getting files/metadata based on versioning works and implementation is consistent.
// Status Codes as defined in the specification.
define('KTWS_ERR_INVALID_SESSION', 1);
define('KTWS_ERR_AUTHENTICATION_ERROR', 2);
define('KTWS_ERR_INSUFFICIENT_PERMISSIONS', 3);
define('KTWS_ERR_FILE_NOT_FOUND', 10);
define('KTWS_ERR_INVALID_FILENAME', 20);
define('KTWS_ERR_INVALID_DOCUMENT', 21);
define('KTWS_ERR_INVALID_FOLDER', 22);
define('KTWS_ERR_INVALID_METADATA', 23);
define('KTWS_ERR_INVALID_REASON', 24);
define('KTWS_ERR_INVALID_DEPTH', 25);
define('KTWS_ERR_PROBLEM', 98);
define('KTWS_ERR_DB_PROBLEM', 99);
* Defines functions, parameters, and return values.
* Defines the structures that are used by web service functions.
* This is the namespace used by the web service.
// Caching was giving some problems, so disable it.
$config =
&KTConfig::getSingleton();
$cache_enabled =
$config->get('cache/cacheEnabled');
$config->setns('cache','cacheEnabled',false);
'folder_name' =>
'string',
'checked_out_by' =>
'string',
'modified_by' =>
'string',
'major_version' =>
'string',
'minor_version' =>
'string',
'storage_path' =>
'string',
'mime_icon_path' =>
'string',
'mime_display' =>
'string',
'items' =>
"{urn:$this->namespace}kt_folder_items"
'item' =>
"{urn:$this->namespace}kt_folder_item"
'folder_name' =>
'string' ,
'full_path' =>
'string' ,
'items' =>
"{urn:$this->namespace}kt_folder_items",
'document_type' =>
'string',
'created_date' =>
'string',
'created_by' =>
'string',
'updated_date' =>
'string',
'updated_by' =>
'string',
'workflow_state' =>
'string',
'checkout_by' =>
'string',
// 'metadata' => "{urn:$this->namespace}kt_metadata_fieldsets"
$this->__typedef['kt_metadata_selection_item'] =
'item' =>
"{urn:$this->namespace}kt_metadata_selection_item"
'required' =>
'boolean' ,
'description' =>
'string' ,
'control_type' =>
'string' ,
'selection' =>
"{urn:$this->namespace}kt_metadata_selection" ,
'field' =>
"{urn:$this->namespace}kt_metadata_field"
'description' =>
'string',
'fields' =>
"{urn:$this->namespace}kt_metadata_fields" ,
'fieldset' =>
"{urn:$this->namespace}kt_metadata_fieldset"
'metadata' =>
"{urn:$this->namespace}kt_metadata_fieldsets" ,
$this->__typedef['kt_document_transitions'] =
$this->__typedef['kt_document_transitions_response'] =
'metadata' =>
"{urn:$this->namespace}kt_document_transitions"
$this->__typedef['kt_document_transaction_history_item'] =
'transaction_name'=>
'string',
$this->__typedef['kt_document_transaction_history'] =
'history' =>
"{urn:$this->namespace}kt_document_transaction_history_item"
$this->__typedef['kt_document_transaction_history_response'] =
'history' =>
"{urn:$this->namespace}kt_document_transaction_history"
$this->__typedef['kt_document_version_history_item'] =
'metadata_version'=>
'string',
'content_version'=>
'string',
$this->__typedef['kt_document_version_history'] =
'history' =>
"{urn:$this->namespace}kt_document_version_history_item"
$this->__typedef['kt_document_version_history_response'] =
'history' =>
"{urn:$this->namespace}kt_document_version_history"
$this->__typedef['kt_document_types_array'] =
'document_type' =>
'string'
$this->__typedef['kt_document_types_response'] =
'document_types' =>
"{urn:$this->namespace}kt_document_types_array"
array('in' =>
array('username' =>
'string', 'password' =>
'string', 'ip' =>
'string'),
'out' =>
array('return' =>
"{urn:$this->namespace}kt_response" ),
array('in' =>
array('session_id' =>
'string' ),
'out' =>
array('return' =>
"{urn:$this->namespace}kt_response" ),
array('in' =>
array('session_id' =>
'string', 'folder_id' =>
'int' ),
'out' =>
array('return' =>
"{urn:$this->namespace}kt_folder_detail"),
// get_folder_detail_by_name
array('in' =>
array('session_id' =>
'string', 'folder_name' =>
'string' ),
'out' =>
array('return' =>
"{urn:$this->namespace}kt_folder_detail"),
array('in' =>
array('session_id'=>
'string','folder_id'=>
'int','depth'=>
'int','what'=>
'string'),
'out' =>
array('return' =>
"{urn:$this->namespace}kt_folder_contents"),
array('in' =>
array('session_id'=>
'string','folder_id'=>
'int','folder_name' =>
'string'),
'out' =>
array('return' =>
"{urn:$this->namespace}kt_folder_detail"),
array('in' =>
array('session_id'=>
'string','folder_id'=>
'int','reason' =>
'string'),
'out' =>
array('return' =>
"{urn:$this->namespace}kt_response" ),
array('in' =>
array('session_id'=>
'string','folder_id'=>
'int','newname' =>
'string'),
'out' =>
array('return' =>
"{urn:$this->namespace}kt_response"),
array('in' =>
array('session_id'=>
'string','source_id'=>
'int','target_id'=>
'int','reason' =>
'string'),
'out' =>
array('return' =>
"{urn:$this->namespace}kt_response" ),
array('in' =>
array('session_id'=>
'string','source_id'=>
'int','target_id'=>
'int','reason' =>
'string'),
'out' =>
array('return' =>
"{urn:$this->namespace}kt_response" ),
array('in' =>
array('session_id' =>
'string', 'document_id' =>
'int' ),
'out' =>
array('return' =>
"{urn:$this->namespace}kt_document_detail"),
array('in' =>
array('session_id'=>
'string','document_id'=>
'int','filename'=>
'string','reason' =>
'string','tempfilename' =>
'string', 'major_update'=>
'boolean' ),
'out' =>
array( 'return' =>
"{urn:$this->namespace}kt_response" ),
array('in' =>
array('session_id'=>
'string','folder_id'=>
'int','title'=>
'string','filename'=>
'string','documentype' =>
'string','tempfilename' =>
'string' ),
'out' =>
array( 'return' =>
"{urn:$this->namespace}kt_document_detail" ),
// get_document_detail_by_name
array('in' =>
array('session_id' =>
'string', 'document_name' =>
'string', 'what'=>
'string' ),
'out' =>
array('return' =>
"{urn:$this->namespace}kt_document_detail"),
array('in' =>
array('session_id'=>
'string','document_id'=>
'int','reason' =>
'string'),
'out' =>
array('return' =>
"{urn:$this->namespace}kt_response" ),
// undo_document_checkout
array('in' =>
array('session_id'=>
'string','document_id'=>
'int','reason' =>
'string'),
'out' =>
array('return' =>
"{urn:$this->namespace}kt_response" ),
array('in' =>
array('session_id'=>
'string','document_id'=>
'int' ),
'out' =>
array('return' =>
"{urn:$this->namespace}kt_response" ),
array('in' =>
array('session_id'=>
'string','document_id'=>
'int','reason'=>
'string'),
'out' =>
array( 'return' =>
"{urn:$this->namespace}kt_response" ),
array('in' =>
array('session_id'=>
'string','document_id'=>
'int','username'=>
'string','reason'=>
'string'),
'out' =>
array( 'return' =>
"{urn:$this->namespace}kt_response" ),
array('in' =>
array('session_id'=>
'string','document_id'=>
'int','folder_id'=>
'int','reason'=>
'string','newtitle'=>
'string','newfilename'=>
'string'),
'out' =>
array( 'return' =>
"{urn:$this->namespace}kt_response" ),
array('in' =>
array('session_id'=>
'string','document_id'=>
'int','folder_id'=>
'int','reason'=>
'string','newtitle'=>
'string','newfilename'=>
'string'),
'out' =>
array( 'return' =>
"{urn:$this->namespace}kt_response" ),
array('in' =>
array('session_id'=>
'string','document_id'=>
'int', 'newtitle'=>
'string' ),
'out' =>
array( 'return' =>
"{urn:$this->namespace}kt_response" ),
// rename_document_filename
array('in' =>
array('session_id'=>
'string','document_id'=>
'int', 'newfilename'=>
'string' ),
'out' =>
array( 'return' =>
"{urn:$this-><