Commit dd89ee3dae236bc906fd49fc431eb4a3f4bce733
1 parent
43daf1cc
KTS-1694
"SOAP Webservice Implementation" Implemented. These are samples for the WebService Object model. Reviewed By: Jalaloedien Abrahams git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@6449 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
5 changed files
with
256 additions
and
0 deletions
ktwsapi/examples/ktws_eg_add_document.php
0 → 100644
| 1 | +<? | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * | |
| 5 | + * This is a sample of how to add a document to the repository. | |
| 6 | + * | |
| 7 | + * The contents of this file are subject to the KnowledgeTree Public | |
| 8 | + * License Version 1.1 ("License"); You may not use this file except in | |
| 9 | + * compliance with the License. You may obtain a copy of the License at | |
| 10 | + * http://www.knowledgetree.com/KPL | |
| 11 | + * | |
| 12 | + * Software distributed under the License is distributed on an "AS IS" | |
| 13 | + * basis, | |
| 14 | + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | |
| 15 | + * for the specific language governing rights and limitations under the | |
| 16 | + * License. | |
| 17 | + * | |
| 18 | + * The Original Code is: KnowledgeTree Open Source | |
| 19 | + * | |
| 20 | + * The Initial Developer of the Original Code is The Jam Warehouse Software | |
| 21 | + * (Pty) Ltd, trading as KnowledgeTree. | |
| 22 | + * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright | |
| 23 | + * (C) 2007 The Jam Warehouse Software (Pty) Ltd; | |
| 24 | + * All Rights Reserved. | |
| 25 | + * | |
| 26 | + */ | |
| 27 | + | |
| 28 | +require_once('../ktwsapi.inc.php'); | |
| 29 | + | |
| 30 | +$ktapi = new KTWSAPI(KTWebService_WSDL); | |
| 31 | + | |
| 32 | +$response = $ktapi->start_session('admin','admin'); | |
| 33 | +if (PEAR::isError($response)) | |
| 34 | +{ | |
| 35 | + print $response->getMessage(); | |
| 36 | + exit; | |
| 37 | +} | |
| 38 | + | |
| 39 | +$root = $ktapi->get_root_folder(); | |
| 40 | + | |
| 41 | +$root->add_document('c:/temp/test.doc'); | |
| 42 | + | |
| 43 | +$ktapi->logout(); | |
| 44 | + | |
| 45 | +?> | |
| 0 | 46 | \ No newline at end of file | ... | ... |
ktwsapi/examples/ktws_eg_anonymous.php
0 → 100644
| 1 | +<? | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * | |
| 5 | + * Demonstrates how to create an anonymous session. | |
| 6 | + * | |
| 7 | + * The contents of this file are subject to the KnowledgeTree Public | |
| 8 | + * License Version 1.1 ("License"); You may not use this file except in | |
| 9 | + * compliance with the License. You may obtain a copy of the License at | |
| 10 | + * http://www.knowledgetree.com/KPL | |
| 11 | + * | |
| 12 | + * Software distributed under the License is distributed on an "AS IS" | |
| 13 | + * basis, | |
| 14 | + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | |
| 15 | + * for the specific language governing rights and limitations under the | |
| 16 | + * License. | |
| 17 | + * | |
| 18 | + * The Original Code is: KnowledgeTree Open Source | |
| 19 | + * | |
| 20 | + * The Initial Developer of the Original Code is The Jam Warehouse Software | |
| 21 | + * (Pty) Ltd, trading as KnowledgeTree. | |
| 22 | + * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright | |
| 23 | + * (C) 2007 The Jam Warehouse Software (Pty) Ltd; | |
| 24 | + * All Rights Reserved. | |
| 25 | + * | |
| 26 | + */ | |
| 27 | + | |
| 28 | +require_once('../ktwsapi.inc.php'); | |
| 29 | + | |
| 30 | +$ktapi = new KTWSAPI(KTWebService_WSDL); | |
| 31 | + | |
| 32 | +$response = $ktapi->start_anonymous_session(); | |
| 33 | +if (PEAR::isError($response)) | |
| 34 | +{ | |
| 35 | + print $response->getMessage(); | |
| 36 | + exit; | |
| 37 | +} | |
| 38 | + | |
| 39 | +// do something | |
| 40 | + | |
| 41 | +$root=$ktapi->get_root_folder(); | |
| 42 | + | |
| 43 | +// when done, logout | |
| 44 | + | |
| 45 | + | |
| 46 | +$ktapi->logout(); | |
| 47 | + | |
| 48 | +?> | |
| 0 | 49 | \ No newline at end of file | ... | ... |
ktwsapi/examples/ktws_eg_checkin.php
0 → 100644
| 1 | +<? | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * | |
| 5 | + * Demonstrates document checkout and checkin | |
| 6 | + * | |
| 7 | + * The contents of this file are subject to the KnowledgeTree Public | |
| 8 | + * License Version 1.1 ("License"); You may not use this file except in | |
| 9 | + * compliance with the License. You may obtain a copy of the License at | |
| 10 | + * http://www.knowledgetree.com/KPL | |
| 11 | + * | |
| 12 | + * Software distributed under the License is distributed on an "AS IS" | |
| 13 | + * basis, | |
| 14 | + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | |
| 15 | + * for the specific language governing rights and limitations under the | |
| 16 | + * License. | |
| 17 | + * | |
| 18 | + * The Original Code is: KnowledgeTree Open Source | |
| 19 | + * | |
| 20 | + * The Initial Developer of the Original Code is The Jam Warehouse Software | |
| 21 | + * (Pty) Ltd, trading as KnowledgeTree. | |
| 22 | + * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright | |
| 23 | + * (C) 2007 The Jam Warehouse Software (Pty) Ltd; | |
| 24 | + * All Rights Reserved. | |
| 25 | + * | |
| 26 | + */ | |
| 27 | + | |
| 28 | +require_once('../ktwsapi.inc.php'); | |
| 29 | + | |
| 30 | +$ktapi = new KTWSAPI(KTWebService_WSDL); | |
| 31 | + | |
| 32 | +// change session to something that is in table 'active_sessions' | |
| 33 | + | |
| 34 | +$response = $ktapi->active_session('qekolkpkk9mq2nlc31ghndi1l2'); | |
| 35 | +if (PEAR::isError($response)) | |
| 36 | +{ | |
| 37 | + print $response->getMessage(); | |
| 38 | + exit; | |
| 39 | +} | |
| 40 | + | |
| 41 | +$root = $ktapi->get_root_folder(); | |
| 42 | + | |
| 43 | +$document = $root->add_document('c:/temp/test.doc'); | |
| 44 | + | |
| 45 | +$document->checkout('going to update','c:/'); | |
| 46 | + | |
| 47 | +$document->checkin('c:/test.doc','have updated',false); | |
| 48 | + | |
| 49 | +$ktapi->logout(); | |
| 50 | + | |
| 51 | +?> | |
| 0 | 52 | \ No newline at end of file | ... | ... |
ktwsapi/examples/ktws_eg_create_folder.php
0 → 100644
| 1 | +<? | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * | |
| 5 | + * Demonstrates creating a folder in an active session. | |
| 6 | + * | |
| 7 | + * The contents of this file are subject to the KnowledgeTree Public | |
| 8 | + * License Version 1.1 ("License"); You may not use this file except in | |
| 9 | + * compliance with the License. You may obtain a copy of the License at | |
| 10 | + * http://www.knowledgetree.com/KPL | |
| 11 | + * | |
| 12 | + * Software distributed under the License is distributed on an "AS IS" | |
| 13 | + * basis, | |
| 14 | + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | |
| 15 | + * for the specific language governing rights and limitations under the | |
| 16 | + * License. | |
| 17 | + * | |
| 18 | + * The Original Code is: KnowledgeTree Open Source | |
| 19 | + * | |
| 20 | + * The Initial Developer of the Original Code is The Jam Warehouse Software | |
| 21 | + * (Pty) Ltd, trading as KnowledgeTree. | |
| 22 | + * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright | |
| 23 | + * (C) 2007 The Jam Warehouse Software (Pty) Ltd; | |
| 24 | + * All Rights Reserved. | |
| 25 | + * | |
| 26 | + */ | |
| 27 | + | |
| 28 | +require_once('../ktwsapi.inc.php'); | |
| 29 | + | |
| 30 | +$ktapi = new KTWSAPI(KTWebService_WSDL); | |
| 31 | + | |
| 32 | +// change session to something that is in table 'active_sessions' | |
| 33 | + | |
| 34 | +$response = $ktapi->active_session('qekolkpkk9mq2nlc31ghndi1l2'); | |
| 35 | +if (PEAR::isError($response)) | |
| 36 | +{ | |
| 37 | + print $response->getMessage(); | |
| 38 | + exit; | |
| 39 | +} | |
| 40 | + | |
| 41 | +$root = $ktapi->get_root_folder(); | |
| 42 | +if (PEAR::isError($root)) | |
| 43 | +{ | |
| 44 | + print $root->getMessage(); | |
| 45 | + exit; | |
| 46 | +} | |
| 47 | + | |
| 48 | +$folder = $root->add_folder('test folder'); | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | +?> | |
| 0 | 53 | \ No newline at end of file | ... | ... |
ktwsapi/examples/ktws_eg_doc_info.php
0 → 100644
| 1 | +<? | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * | |
| 5 | + * Demonstrates using an active session and getting document info and metadata. | |
| 6 | + * | |
| 7 | + * The contents of this file are subject to the KnowledgeTree Public | |
| 8 | + * License Version 1.1 ("License"); You may not use this file except in | |
| 9 | + * compliance with the License. You may obtain a copy of the License at | |
| 10 | + * http://www.knowledgetree.com/KPL | |
| 11 | + * | |
| 12 | + * Software distributed under the License is distributed on an "AS IS" | |
| 13 | + * basis, | |
| 14 | + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | |
| 15 | + * for the specific language governing rights and limitations under the | |
| 16 | + * License. | |
| 17 | + * | |
| 18 | + * The Original Code is: KnowledgeTree Open Source | |
| 19 | + * | |
| 20 | + * The Initial Developer of the Original Code is The Jam Warehouse Software | |
| 21 | + * (Pty) Ltd, trading as KnowledgeTree. | |
| 22 | + * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright | |
| 23 | + * (C) 2007 The Jam Warehouse Software (Pty) Ltd; | |
| 24 | + * All Rights Reserved. | |
| 25 | + * | |
| 26 | + */ | |
| 27 | + | |
| 28 | +require_once('../ktwsapi.inc.php'); | |
| 29 | + | |
| 30 | +$ktapi = new KTWSAPI(KTWebService_WSDL); | |
| 31 | + | |
| 32 | +// change session to something that is in table 'active_sessions' | |
| 33 | + | |
| 34 | +$response = $ktapi->active_session('qekolkpkk9mq2nlc31ghndi1l2'); | |
| 35 | +if (PEAR::isError($response)) | |
| 36 | +{ | |
| 37 | + print $response->getMessage(); | |
| 38 | + exit; | |
| 39 | +} | |
| 40 | + | |
| 41 | +// lets ge the document based on id. | |
| 42 | + | |
| 43 | +$document = $ktapi->get_document_by_id(50); | |
| 44 | +if (PEAR::isError($document)) | |
| 45 | +{ | |
| 46 | + print $document->getMessage(); | |
| 47 | + exit; | |
| 48 | +} | |
| 49 | + | |
| 50 | +// lets get the document metadata | |
| 51 | + | |
| 52 | +$metadata = $document->get_metadata(); | |
| 53 | +if (PEAR::isError($metadata)) | |
| 54 | +{ | |
| 55 | + print $metadata->getMessage(); | |
| 56 | + exit; | |
| 57 | +} | |
| 58 | +var_dump($metadata); | |
| 59 | + | |
| 60 | +?> | ... | ... |