diff --git a/ktatompub/Client/index.html b/ktatompub/Client/index.html
index 79f364a..fae0993 100644
--- a/ktatompub/Client/index.html
+++ b/ktatompub/Client/index.html
@@ -2,544 +2,526 @@
-
+
+
+
+
+
+
+ | Checking ServiceDocument |
+ |
+
+
+ | Document Tree Service |
+ |
+
+
+ | Folder Info Service |
+ |
+
+
+ | Document Info Service |
+ |
+
+
-
diff --git a/ktatompub/Client/js/APP/ktApp.js b/ktatompub/Client/js/APP/ktApp.js
index 9f97e23..0f788f2 100644
--- a/ktatompub/Client/js/APP/ktApp.js
+++ b/ktatompub/Client/js/APP/ktApp.js
@@ -79,6 +79,18 @@ ktApp.folder=new function(){
}
}
+ktApp.serviceDoc=new function(){
+ this.parseXML=function(data,workspace){
+ $('workspace',data).each(function(){
+ var ws=$(this);
+ lib.debug.inspect($(ws[0].childNodes).);
+ if($('title',this)[0].textContent==workspace){
+ alert('found workspace '+workspace)
+ }
+ });
+ }
+}
+
ktApp.document=new function(){
this.fieldList={
diff --git a/ktatompub/Client/js/lib/lib.xml.js b/ktatompub/Client/js/lib/lib.xml.js
new file mode 100644
index 0000000..8d26047
--- /dev/null
+++ b/ktatompub/Client/js/lib/lib.xml.js
@@ -0,0 +1,17 @@
+lib.xml=new function(){
+ getXmlDoc=function(xmlString){
+ try{ //Internet Explorer
+ xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
+ xmlDoc.async="false";
+ xmlDoc.loadXML(txt);
+ return xmlDoc;
+ }
+ catch(e){
+ parser=new DOMParser();
+ xmlDoc=parser.parseFromString(txt,"text/xml");
+ return xmlDoc;
+ }
+ }
+
+
+}
\ No newline at end of file
diff --git a/ktatompub/Client/js/site/site.event_handlers.js b/ktatompub/Client/js/site/site.event_handlers.js
index d42dd0b..fc3d6bf 100644
--- a/ktatompub/Client/js/site/site.event_handlers.js
+++ b/ktatompub/Client/js/site/site.event_handlers.js
@@ -132,4 +132,18 @@ site.event_handlers=new function(){
'
The site will then generate an atompub formatted DELETE request, and clear it\'s own cache and the document tree cache before ' +
'switching to an empty panel.');
}
+
+
+ this.discovery=function(url){
+ var sdoc=url+'servicedocument';
+ if(typeof(url)!='string')sdoc=site.cfg('service');
+ site.cfg('service',sdoc);
+ if(lib.resources.resourceLoaded(sdoc)){
+ var data=lib.resources.getResourceFromUrl(sdoc);
+ ktApp.serviceDoc.parseXML($(data.data).find('service')[0],'DMS');
+
+ }else{
+ lib.resources.getUrl(sdoc,site.event_handlers.discovery);
+ }
+ }
}
\ No newline at end of file
diff --git a/ktatompub/Client/js/site/site.js b/ktatompub/Client/js/site/site.js
index bc7942c..20ec45d 100644
--- a/ktatompub/Client/js/site/site.js
+++ b/ktatompub/Client/js/site/site.js
@@ -11,11 +11,11 @@ site=new function(){
this.currentDocument=null;
this._cfgDefaults={
- 'baseurl' :'http://kt.dev/ktatompub/?',
- 'services' :'servicedoc/',
- 'service.treestruct' :'fulltree/',
- 'service.folderInfo' :'folder/',
- 'service.docInfo' :'document/'
+ 'baseurl' :'',
+ 'services' :'',
+ 'service.treestruct' :'',
+ 'service.folderInfo' :'',
+ 'service.docInfo' :''
};
this.cfg=function(cfgName){
@@ -61,13 +61,20 @@ site=new function(){
this.setupTabEvents();
this.setupInspectors();
this.setupDisplay();
+ this.checkSettings();
events.trigger('perspective.folders.show');
}
+ this.checkSettings=function(){
+ if(this.cfg('baseurl')==''){
+ $('#setup').dialog('open');
+ }else{
+ }
+ }
+
this.bootStrap=function(){
for(var liburl in this.libraries){
this.includeJs(liburl);
- //alert('loading '+ liburl)
}
$('document').ready(function(){site.init();});
}
@@ -83,6 +90,7 @@ site=new function(){
this.setupDisplay=function(){
events.trigger('panel.clear');
$('#dialog').dialog({autoOpen:false, modal:true, dialogClass:'dialogs', closeOnEscape:true, buttons:{'OK':function(){$(this).dialog('close');}}});
+ $('#setup').dialog({width: 400, height:200, modal: true, autoOpen:false, dialogClass: 'dialogs'});
$('.fg-button').each(function(){
$(this).mouseover(function(){
$(this).addClass('ui-state-hover');
@@ -142,6 +150,7 @@ site=new function(){
events.listen('panel.folder.action.save',site.event_handlers.folder_action_save,site.event_handlers);
events.listen('panel.folder.action.move',site.event_handlers.folder_action_move,site.event_handlers);
+ events.listen('setup.getservicedoc',site.event_handlers.discovery,site.event_handlers);
diff --git a/ktatompub/auth.php b/ktatompub/auth.php
index f1fa8c9..f76ac4b 100644
--- a/ktatompub/auth.php
+++ b/ktatompub/auth.php
@@ -32,13 +32,14 @@
* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
* must display the words "Powered by KnowledgeTree" and retain the original
* copyright notice.
- * Contributor( s):
+ * Contributor( s):
* Mark Holtzhausen
*
*/
/**
* Automatic Login bypassing HTTP Basic Auth
+ * TODO: Thest HTTP Basic Auth - Try Library From Home
*/
$SessionId=KTAPPHelper::login('admin','admin');
diff --git a/ktatompub/index.php b/ktatompub/index.php
index 378a315..5e51982 100644
--- a/ktatompub/index.php
+++ b/ktatompub/index.php
@@ -59,7 +59,7 @@ define('KT_APP_BASE_URI',"http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_S
define('KT_APP_SYSTEM_URI',"http://".$_SERVER['HTTP_HOST']);
// Define whether to use in debug mode for viewing generated structures
-define('KT_APP_WEB_OUTPUT',false);
+//define('KT_APP_WEB_OUTPUT',false); //defunct
@@ -67,61 +67,28 @@ define('KT_APP_WEB_OUTPUT',false);
* Includes
*/
include_once('../ktapi/ktapi.inc.php');
+include_once('lib/ktAPP.inc.php');
include_once('lib/KTAPPHelper.inc.php'); //Containing helper bridge functions to KtAPI
include_once('lib/KTAPDoc.inc.php'); //Containing the parent class allowing easy XML manipulation
include_once('lib/KTAPPServiceDoc.inc.php'); //Containing the servicedoc class allowing easy ServiceDocument generation
include_once('lib/KTAPPFeed.inc.php'); //Containing the response feed class allowing easy atom feed generation
+include_once('lib/ktAPP_Service.inc.php');
+include_once('lib/ktApp.default_dms_services.inc.php');
include_once('auth.php'); //Containing the authentication protocols
+//Start the AtomPubProtocol Routing Engine
+$APP=new KTAPP();
-//Parse the query string
-$query=split('/',trim($_SERVER['QUERY_STRING'],'/'));
-
-//Initializing the $output variable. Everything rendered by the engine must be placed in this variable as it is the only thing that will be rendered
-$output='';
-
-
-// Using the querystring to load the appropriate service
-
-switch(strtolower(trim($query[0]))){
- case 'mimetypes':
- include('services/mimetypes.inc.php');
- break;
- case 'fulltree':
- include('services/fulltree.inc.php');
- break;
- case 'folder':
- include('services/folder.inc.php');
- break;
- case 'document':
- include('services/document.inc.php');
- break;
- case 'cmis':
- include('services/cmis/index.php');
- break;
- case 'servicedocument':
- default:
- include('services/servicedocument.inc.php');
- break;
-}
-
-
-
-
-/**
- * Writing the Output
- *
- * To ensure we don't render illegal XML, we clean the output buffer and only use what is in the $ouput variable
- */
-ob_end_clean();
-if(KT_APP_WEB_OUTPUT){
- echo ''.htmlentities($output).'
';
-}else{
- header('Content-type: text/xml');
- echo $output;
-}
+//Register New Services (in the DMS workspace)
+$APP->registerService('DMS','fulltree','ktAPP_Service_fullTree','Full Document Tree');
+$APP->registerService('DMS','folder','ktAPP_Service_folder','Folder Detail');
+$APP->registerService('DMS','document','ktAPP_Service_document','Document Detail');
+//Execute the current url/header request
+$APP->execute();
+//Render the resulting feed response
+$APP->render();
?>
\ No newline at end of file
diff --git a/ktatompub/lib/KTAPPFeed.inc.php b/ktatompub/lib/KTAPPFeed.inc.php
index 27feb0e..c1c677c 100644
--- a/ktatompub/lib/KTAPPFeed.inc.php
+++ b/ktatompub/lib/KTAPPFeed.inc.php
@@ -32,7 +32,7 @@
* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
* must display the words "Powered by KnowledgeTree" and retain the original
* copyright notice.
- * Contributor( s):
+ * Contributor( s):
* Mark Holtzhausen
*
*/
@@ -43,7 +43,7 @@
*/
include_once('KTAPDoc.inc.php');
-/*
+/* Remember to include support for feed attributes / nodes
@@ -69,40 +69,44 @@ include_once('KTAPDoc.inc.php');
class KTAPPFeed extends KTAPDoc {
-
+
private $baseURI=NULL;
private $feed=NULL;
-
+
public function __construct($baseURI=NULL,$title=NULL,$link=NULL,$updated=NULL,$author=NULL,$id=NULL){
parent::__construct();
$this->constructHeader();
$this->baseURI=$baseURI;
}
-
+
private function constructHeader(){
$feed=$this->newElement('feed');
$feed->appendChild($this->newAttr('xmlns','http://www.w3.org/2005/Atom'));
$this->feed=&$feed;
$this->DOM->appendChild($this->feed);
}
-
+
public function &newEntry(){
$entry=$this->newElement('entry');
$this->feed->appendChild($entry);
- return $entry;
+ return $entry;
}
-
+
public function &newField($name=NULL,$value=NULL,&$entry=NULL){
$field=$this->newElement($name,$value);
if(isset($entry))$entry->appendChild($field);
return $field;
}
-
+
public function getAPPdoc(){
return $this->formatXmlString(trim($this->DOM->saveXML()));
}
-
+
+ public function render(){
+ return $this->getAPPdoc();
+ }
+
}
diff --git a/ktatompub/lib/KtAPP_Service.inc.php b/ktatompub/lib/KtAPP_Service.inc.php
new file mode 100644
index 0000000..7481b49
--- /dev/null
+++ b/ktatompub/lib/KtAPP_Service.inc.php
@@ -0,0 +1,57 @@
+method=$method;
+ $this->params=$params;
+ $this->rawContent=$content;
+ $this->parsedXMLContent=json_decode(json_encode(@simplexml_load_string($this->rawContent)),true);
+ $this->setStatus(self::STATUS_OK);
+ $this->responseFeed=new KTAPPFeed(KT_APP_BASE_URI);
+ switch(strtoupper($this->method)){
+ case 'GET': $this->GET_action();break;
+ case 'PUT': $this->PUT_action();break;
+ case 'POST': $this->POST_action();break;
+ case 'DELETE': $this->DELETE_action();break;
+ }
+ }
+
+ public function GET_action(){
+ $this->setStatus(ktAPP_Service::STATUS_OK);
+ }
+
+ public function PUT_action(){
+ $this->setStatus(ktAPP_Service::STATUS_NOT_FOUND );
+ }
+
+ public function POST_action(){
+ $this->setStatus(ktAPP_Service::STATUS_NOT_FOUND );
+ }
+
+ public function DELETE_action(){
+ $this->setStatus(ktAPP_Service::STATUS_NOT_FOUND );
+ }
+
+
+ public function render(){
+ return $this->responseFeed->render();
+ }
+
+ private function setStatus($status=NULL){
+ header("HTTP/1.1 ".$status);
+ }
+}
+?>
\ No newline at end of file
diff --git a/ktatompub/lib/ktAPP.inc.php b/ktatompub/lib/ktAPP.inc.php
new file mode 100644
index 0000000..56fd1cc
--- /dev/null
+++ b/ktatompub/lib/ktAPP.inc.php
@@ -0,0 +1,78 @@
+queryArray=$queryArray;
+ $this->serviceName=$service;
+
+ if($workspace=='servicedocument'){
+ $this->serviceDocument();
+ return;
+ }
+
+ $service=$this->getRegisteredService($workspace,$serviceName);
+
+ if(is_array($service)){
+ $serviceClass=$service['serviceClass'];
+ $serviceObject=new $serviceClass($reqMethod,$requestParams,$rawRequest);
+ $this->output=$serviceObject->render();
+ }else{
+ echo "Could not find service:{$service['serviceFunc']} in $workspace"; //TODO: ERROR HERE
+ }
+ }
+
+ public function registerService($workspace=NULL,$serviceName=NULL,$serviceClass=NULL,$title=NULL){
+ $workspace=strtolower(trim($workspace));
+ $serviceName=strtolower(trim($serviceName));
+
+ $serviceRecord=array(
+ 'fileName' =>$fileName,
+ 'serviceClass' =>$serviceClass,
+ 'title' =>$title
+ );
+
+ $this->services[$workspace][$serviceName]=$serviceRecord;
+ }
+
+ public function getRegisteredService($workspace,$serviceName=NULL){
+ $serviceName=strtolower(trim($serviceName));
+ if(isset($this->services[$workspace][$serviceName]))return $this->services[$workspace][$serviceName];
+ return false;
+ }
+
+ public function serviceDocument(){
+ $service=new KTAPPServiceDoc(KT_APP_BASE_URI);
+
+ foreach($this->services as $workspace=>$collection){
+ //Creating the Default Workspace for use with standard atomPub Clients
+ $ws=$service->newWorkspace($workspace);
+
+ foreach($collection as $serviceName=>$serviceInstance){
+ $col=$service->newCollection(KT_APP_BASE_URI.$workspace.'/'.$serviceName.'/',$serviceInstance['title'],$ws);
+ }
+ }
+
+ $this->output=$service->getAPPdoc();
+ }
+
+ public function render(){
+ ob_end_clean();
+ header('Content-type: text/xml');
+ echo $this->output;
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/ktatompub/lib/ktAPP_ResponseFeed.inc.php b/ktatompub/lib/ktAPP_ResponseFeed.inc.php
new file mode 100644
index 0000000..d846c02
--- /dev/null
+++ b/ktatompub/lib/ktAPP_ResponseFeed.inc.php
@@ -0,0 +1,5 @@
+
\ No newline at end of file
diff --git a/ktatompub/lib/ktApp.default_dms_services.inc.php b/ktatompub/lib/ktApp.default_dms_services.inc.php
new file mode 100644
index 0000000..d6ea227
--- /dev/null
+++ b/ktatompub/lib/ktApp.default_dms_services.inc.php
@@ -0,0 +1,88 @@
+newEntry();
+ $feed->newField('id',$id,$entry);
+ foreach($item as $property=>$value){
+ $feed->newField($property,$value,$entry);
+ }
+ }
+ //Expose the responseFeed
+ $this->responseFeed=$feed;
+ }
+}
+
+
+
+
+/**
+ * AtomPub Service: folder
+ *
+ * Returns detail on a particular folder
+ *
+ */
+class ktAPP_Service_folder extends ktAPP_Service {
+ public function GET_action(){
+ //Create a new response feed
+ $feed=new KTAPPFeed(KT_APP_BASE_URI);
+
+ //Invoke the KtAPI to get detail about the referenced document
+ $folderDetail=KTAPPHelper::getFolderDetail($this->params[0]?$this->params[0]:1);
+
+ //Create the atom response feed
+ $entry=$feed->newEntry();
+ foreach($folderDetail as $property=>$value){
+ $feed->newField($property,$value,$entry);
+ }
+
+ //Expose the responseFeed
+ $this->responseFeed=$feed;
+ }
+}
+
+
+
+
+/**
+ * AtomPub Service: document
+ *
+ * Returns detail on a particular document
+ *
+ */
+class ktAPP_Service_document extends ktAPP_Service {
+ public function GET_action(){
+ //Create a new response feed
+ $feed=new KTAPPFeed(KT_APP_BASE_URI);
+
+ //Invoke the KtAPI to get detail about the referenced document
+ $docDetail=KTAPPHelper::getDocumentDetail($this->params[0]);
+
+ //Create the atom response feed
+ $entry=$feed->newEntry();
+ foreach($docDetail['results'] as $property=>$value){
+ $feed->newField($property,$value,$entry);
+ }
+ //Add a downloaduri field manually
+ $feed->newField('downloaduri',urlencode(KT_APP_SYSTEM_URI.'/action.php?kt_path_info=ktcore.actions.document.view&fDocumentId='.$docDetail['results']['document_id']),$entry);
+
+ //Expose the responseFeed
+ $this->responseFeed=$feed;
+ }
+}
+?>
\ No newline at end of file
diff --git a/lib/session/Session.inc b/lib/session/Session.inc
index e2974d1..0d4aeb5 100644
--- a/lib/session/Session.inc
+++ b/lib/session/Session.inc
@@ -283,6 +283,10 @@ class Session {
// now check if the timeout has been exceeded
$lastused = $aRow["lastused"];
$diff = time() - strtotime($lastused);
+
+ //To make sure the sessionTimeout setting is nonzero
+ if($default->sessionTimeout<=0)$default->sessionTimeout=1200;
+
if($diff <= $default->sessionTimeout) {
// update last used timestamp
$aFV = array(
diff --git a/webservice/classes/soap/IPReflectionClass.class.php b/webservice/classes/soap/IPReflectionClass.class.php
index 21e30b9..9e451b2 100755
--- a/webservice/classes/soap/IPReflectionClass.class.php
+++ b/webservice/classes/soap/IPReflectionClass.class.php
@@ -1,114 +1,114 @@
-classname = $classname;
- parent::__construct($classname);
-
- $this->parseComment();
- }
-
- /**
- *Provides all methods exposed by this class as an array
- *
- * @param boolean If the method should also return protected functions
- * @param boolean If the method should also return private functions
- * @return IPReflectionMethod[]
- */
- public function getMethods($alsoProtected = true, $alsoPrivate = true){
- $ar = parent::getMethods();
- foreach($ar as $method){
- $m = new IPReflectionMethod($this->classname, $method->name);
- if((!$m->isPrivate() || $alsoPrivate) && (!$m->isProtected() || $alsoProtected) && ($m->getDeclaringClass()->name == $this->classname))
- $this->methods[$method->name] = $m;
- }
- ksort($this->methods);
- return $this->methods;
- }
-
- /**
- * Exposes an array with public properties of the class
- *
- * @param boolean If the method should also return protected properties
- * @param boolean If the method should also return private properties
- * @return IPReflectionProperty[]
- */
- public function getProperties($alsoProtected=true,$alsoPrivate=true) {
- $ar = parent::getProperties();
- $this->properties = Array();
- foreach($ar as $property){
- if((!$property->isPrivate() || $alsoPrivate) && (!$property->isProtected() || $alsoProtected)){
- try{
- $p = new IPReflectionProperty($this->classname, $property->getName());
- $this->properties[$property->name]=$p;
- }catch(ReflectionException $exception){
- echo "Fault on property: ".$property->name."
\n";
- }
- }
- }
- ksort($this->properties);
- return $this->properties;
- }
-
- /**
- * Exposes annotations of the class
- * @param $annotationName String the annotation name
- * @param $annotationClass String the annotation class
- * @return void
- */
- public function getAnnotation($annotationName, $annotationClass = null){
- return IPPhpDoc::getAnnotation($this->comment, $annotationName, $annotationClass);
- }
-
- /**
- * Gets all the usefull information from the comments
- * @return void
- */
- private function parseComment() {
- $this->comment = $this->getDocComment();
- new IPReflectionCommentParser($this->comment, $this);
- }
-}
+classname = $classname;
+ parent::__construct($classname);
+
+ $this->parseComment();
+ }
+
+ /**
+ *Provides all methods exposed by this class as an array
+ *
+ * @param boolean If the method should also return protected functions
+ * @param boolean If the method should also return private functions
+ * @return IPReflectionMethod[]
+ */
+ public function getMethods($alsoProtected = true, $alsoPrivate = true){
+ $ar = parent::getMethods();
+ foreach($ar as $method){
+ $m = new IPReflectionMethod($this->classname, $method->name);
+ if((!$m->isPrivate() || $alsoPrivate) && (!$m->isProtected() || $alsoProtected) && ($m->getDeclaringClass()->name == $this->classname))
+ $this->methods[$method->name] = $m;
+ }
+ ksort($this->methods);
+ return $this->methods;
+ }
+
+ /**
+ * Exposes an array with public properties of the class
+ *
+ * @param boolean If the method should also return protected properties
+ * @param boolean If the method should also return private properties
+ * @return IPReflectionProperty[]
+ */
+ public function getProperties($alsoProtected=true,$alsoPrivate=true) {
+ $ar = parent::getProperties();
+ $this->properties = Array();
+ foreach($ar as $property){
+ if((!$property->isPrivate() || $alsoPrivate) && (!$property->isProtected() || $alsoProtected)){
+ try{
+ $p = new IPReflectionProperty($this->classname, $property->getName());
+ $this->properties[$property->name]=$p;
+ }catch(ReflectionException $exception){
+ echo "Fault on property: ".$property->name."
\n";
+ }
+ }
+ }
+ ksort($this->properties);
+ return $this->properties;
+ }
+
+ /**
+ * Exposes annotations of the class
+ * @param $annotationName String the annotation name
+ * @param $annotationClass String the annotation class
+ * @return void
+ */
+ public function getAnnotation($annotationName, $annotationClass = null){
+ return IPPhpDoc::getAnnotation($this->comment, $annotationName, $annotationClass);
+ }
+
+ /**
+ * Gets all the usefull information from the comments
+ * @return void
+ */
+ private function parseComment() {
+ $this->comment = $this->getDocComment();
+ new IPReflectionCommentParser($this->comment, $this);
+ }
+}
?>
\ No newline at end of file
diff --git a/webservice/classes/soap/IPReflectionCommentParser.class.php b/webservice/classes/soap/IPReflectionCommentParser.class.php
index 9d8340f..b7b6933 100755
--- a/webservice/classes/soap/IPReflectionCommentParser.class.php
+++ b/webservice/classes/soap/IPReflectionCommentParser.class.php
@@ -1,170 +1,170 @@
-comment = $comment;
- $this->obj = $obj;
- $this->parse();
- }
- /**
- * parses the comment, line for line
- *
- * Will take the type of comment (class, property or function) as an
- * argument and split it up in lines.
- * @param string Defines if its the comment for a class, public of function
- * @return void
- */
- function parse() {
- //reset object
- $descriptionDone = false;
- $this->fullDescriptionDone = false;
-
- //split lines
- $lines = split("\n", $this->comment);
-
- //check lines for description or tags
- foreach ($lines as $line) {
- $pos = strpos($line,"* @");
- if (trim($line) == "/**" || trim($line) == "*/") { //skip the start and end line
- }elseif (!($pos === false)) { //comment
- $this->parseTagLine(substr($line,$pos+3));
- $descriptionDone=true;
- }elseif(!$descriptionDone){
- $this->parseDescription($line);
- }
- }
- //if full description is empty, put small description in full description
- if (trim(str_replace(Array("\n","\r"), Array("", ""), $this->obj->fullDescription)) == "")
- $this->obj->fullDescription = $this->obj->smallDescription;
- }
-
- /**
- * Parses the description to the small and full description properties
- *
- * @param string The description line
- * @return void
- */
-
- function parseDescription($descriptionLine) {
- if(strpos($descriptionLine,"*") <= 2) $descriptionLine = substr($descriptionLine, (strpos($descriptionLine,"*") + 1));
-
- //geen lege comment regel indien al in grote omschrijving
- if(trim(str_replace(Array("\n","\r"), Array("", ""), $descriptionLine)) == ""){
- if($this->obj->fullDescription == "")
- $descriptionLine = "";
- $this->smallDescriptionDone = true;
- }
-
- if(!$this->smallDescriptionDone)//add to small description
- $this->obj->smallDescription.=$descriptionLine;
- else{//add to full description
- $this->obj->fullDescription.=$descriptionLine;
- }
- }
-
- /**
- * Parses a tag line and extracts the tagname and values
- *
- * @param string The tagline
- * @return void
- */
- function parseTagLine($tagLine) {
- $tagArr = explode(" ", $tagLine);
- $tag = $tagArr[0];
-
- switch(strtolower($tag)){
- case 'abstract':
- $this->obj->abstract = true; break;
- case 'access':
- $this->obj->isPrivate = (strtolower(trim($tagArr[1]))=="private")?true:false;
- break;
- case 'author':
- unset($tagArr[0]);
- $this->obj->author = implode(" ",$tagArr);
- break;
- case 'copyright':
- unset($tagArr[0]);
- $this->obj->copyright = implode(" ",$tagArr);
- break;
- case 'deprecated':
- case 'deprec':
- $this->obj->deprecated = true;
- break;
- case 'extends': break;
- case 'global':
- $this->obj->globals[] = $tagArr[1];
- break;
- case 'param':
- $o = new stdClass();
- $o->type = trim($tagArr[1]);
- $o->comment = implode(" ",$tagArr);
- $this->obj->params[] = $o;
- break;
- case 'return':
- $this->obj->return = trim($tagArr[1]); break;
- case 'link':break;
- case 'see':break;
- case 'since':
- $this->obj->since = trim($tagArr[1]); break;
- case 'static':
- $this->obj->static = true; break;
- case 'throws':
- unset($tagArr[0]);
- $this->obj->throws = implode(" ",$tagArr);
- break;
- case 'todo':
- unset($tagArr[0]);
- $this->obj->todo[] = implode(" ",$tagArr);
- break;
- case 'var':
- $this->obj->type = trim($tagArr[1]);
- unset($tagArr[0],$tagArr[1]);
- $comment=implode(" ",$tagArr);
- //check if its an optional property
- $this->obj->optional = strpos($comment,"[OPTIONAL]") !== FALSE;
- $this->obj->autoincrement = strpos($comment,"[AUTOINCREMENT]") !== FALSE;
- $this->obj->description = str_replace("[OPTIONAL]", "", $comment);
- break;
- case 'version':
- $this->obj->version = $tagArr[1];
- break;
- default:
- //echo "\nno valid tag: '".strtolower($tag)."' at tagline: '$tagLine'
";
- //do nothing
- }
- }
-}
+comment = $comment;
+ $this->obj = $obj;
+ $this->parse();
+ }
+ /**
+ * parses the comment, line for line
+ *
+ * Will take the type of comment (class, property or function) as an
+ * argument and split it up in lines.
+ * @param string Defines if its the comment for a class, public of function
+ * @return void
+ */
+ function parse() {
+ //reset object
+ $descriptionDone = false;
+ $this->fullDescriptionDone = false;
+
+ //split lines
+ $lines = split("\n", $this->comment);
+
+ //check lines for description or tags
+ foreach ($lines as $line) {
+ $pos = strpos($line,"* @");
+ if (trim($line) == "/**" || trim($line) == "*/") { //skip the start and end line
+ }elseif (!($pos === false)) { //comment
+ $this->parseTagLine(substr($line,$pos+3));
+ $descriptionDone=true;
+ }elseif(!$descriptionDone){
+ $this->parseDescription($line);
+ }
+ }
+ //if full description is empty, put small description in full description
+ if (trim(str_replace(Array("\n","\r"), Array("", ""), $this->obj->fullDescription)) == "")
+ $this->obj->fullDescription = $this->obj->smallDescription;
+ }
+
+ /**
+ * Parses the description to the small and full description properties
+ *
+ * @param string The description line
+ * @return void
+ */
+
+ function parseDescription($descriptionLine) {
+ if(strpos($descriptionLine,"*") <= 2) $descriptionLine = substr($descriptionLine, (strpos($descriptionLine,"*") + 1));
+
+ //geen lege comment regel indien al in grote omschrijving
+ if(trim(str_replace(Array("\n","\r"), Array("", ""), $descriptionLine)) == ""){
+ if($this->obj->fullDescription == "")
+ $descriptionLine = "";
+ $this->smallDescriptionDone = true;
+ }
+
+ if(!$this->smallDescriptionDone)//add to small description
+ $this->obj->smallDescription.=$descriptionLine;
+ else{//add to full description
+ $this->obj->fullDescription.=$descriptionLine;
+ }
+ }
+
+ /**
+ * Parses a tag line and extracts the tagname and values
+ *
+ * @param string The tagline
+ * @return void
+ */
+ function parseTagLine($tagLine) {
+ $tagArr = explode(" ", $tagLine);
+ $tag = $tagArr[0];
+
+ switch(strtolower($tag)){
+ case 'abstract':
+ $this->obj->abstract = true; break;
+ case 'access':
+ $this->obj->isPrivate = (strtolower(trim($tagArr[1]))=="private")?true:false;
+ break;
+ case 'author':
+ unset($tagArr[0]);
+ $this->obj->author = implode(" ",$tagArr);
+ break;
+ case 'copyright':
+ unset($tagArr[0]);
+ $this->obj->copyright = implode(" ",$tagArr);
+ break;
+ case 'deprecated':
+ case 'deprec':
+ $this->obj->deprecated = true;
+ break;
+ case 'extends': break;
+ case 'global':
+ $this->obj->globals[] = $tagArr[1];
+ break;
+ case 'param':
+ $o = new stdClass();
+ $o->type = trim($tagArr[1]);
+ $o->comment = implode(" ",$tagArr);
+ $this->obj->params[] = $o;
+ break;
+ case 'return':
+ $this->obj->return = trim($tagArr[1]); break;
+ case 'link':break;
+ case 'see':break;
+ case 'since':
+ $this->obj->since = trim($tagArr[1]); break;
+ case 'static':
+ $this->obj->static = true; break;
+ case 'throws':
+ unset($tagArr[0]);
+ $this->obj->throws = implode(" ",$tagArr);
+ break;
+ case 'todo':
+ unset($tagArr[0]);
+ $this->obj->todo[] = implode(" ",$tagArr);
+ break;
+ case 'var':
+ $this->obj->type = trim($tagArr[1]);
+ unset($tagArr[0],$tagArr[1]);
+ $comment=implode(" ",$tagArr);
+ //check if its an optional property
+ $this->obj->optional = strpos($comment,"[OPTIONAL]") !== FALSE;
+ $this->obj->autoincrement = strpos($comment,"[AUTOINCREMENT]") !== FALSE;
+ $this->obj->description = str_replace("[OPTIONAL]", "", $comment);
+ break;
+ case 'version':
+ $this->obj->version = $tagArr[1];
+ break;
+ default:
+ //echo "\nno valid tag: '".strtolower($tag)."' at tagline: '$tagLine'
";
+ //do nothing
+ }
+ }
+}
?>
\ No newline at end of file
diff --git a/webservice/classes/soap/IPReflectionMethod.class.php b/webservice/classes/soap/IPReflectionMethod.class.php
index 9f11b05..55bcf15 100755
--- a/webservice/classes/soap/IPReflectionMethod.class.php
+++ b/webservice/classes/soap/IPReflectionMethod.class.php
@@ -1,100 +1,100 @@
-classname = $class;
- parent::__construct($class,$method);
- $this->parseComment();
- }
-
- /**
- * Returns the full function name, including arguments
- * @return string
- */
- public function getFullName(){
- $args = $this->getParameters();
- $argstr = "";
-
- foreach((array)$args as $arg){
- if($argstr!="")$argstr.=", ";
- $argstr.= $arg->type ." $".$arg->name;
- }
- return $this->return." ".$this->name."(".$argstr.")";
- }
-
- /**
- * Returns an array with parameter objects, containing type info etc.
- *
- * @return ReflectionParameter[] Associative array with parameter objects
- */
- public function getParameters(){
- $this->parameters = Array();
- $ar = parent::getParameters();
- $i = 0;
-
- foreach((array)$ar as $parameter){
- $parameter->type = $this->params[$i++]->type;
- $this->parameters[$parameter->name] = $parameter;
- }
-
- return $this->parameters;
- }
-
- /**
- *
- * @param $annotationName String the annotation name
- * @param $annotationClass String the annotation class
- * @return void
- */
- public function getAnnotation($annotationName, $annotationClass = null){
- return IPPhpDoc::getAnnotation($this->comment, $annotationName, $annotationClass);
- }
-
- /**
- * Parses the comment and adds found properties to this class
- * @return void
- */
- private function parseComment(){
- $this->comment = $this->getDocComment();
- new IPReflectionCommentParser($this->comment, $this);
- }
-}
+classname = $class;
+ parent::__construct($class,$method);
+ $this->parseComment();
+ }
+
+ /**
+ * Returns the full function name, including arguments
+ * @return string
+ */
+ public function getFullName(){
+ $args = $this->getParameters();
+ $argstr = "";
+
+ foreach((array)$args as $arg){
+ if($argstr!="")$argstr.=", ";
+ $argstr.= $arg->type ." $".$arg->name;
+ }
+ return $this->return." ".$this->name."(".$argstr.")";
+ }
+
+ /**
+ * Returns an array with parameter objects, containing type info etc.
+ *
+ * @return ReflectionParameter[] Associative array with parameter objects
+ */
+ public function getParameters(){
+ $this->parameters = Array();
+ $ar = parent::getParameters();
+ $i = 0;
+
+ foreach((array)$ar as $parameter){
+ $parameter->type = $this->params[$i++]->type;
+ $this->parameters[$parameter->name] = $parameter;
+ }
+
+ return $this->parameters;
+ }
+
+ /**
+ *
+ * @param $annotationName String the annotation name
+ * @param $annotationClass String the annotation class
+ * @return void
+ */
+ public function getAnnotation($annotationName, $annotationClass = null){
+ return IPPhpDoc::getAnnotation($this->comment, $annotationName, $annotationClass);
+ }
+
+ /**
+ * Parses the comment and adds found properties to this class
+ * @return void
+ */
+ private function parseComment(){
+ $this->comment = $this->getDocComment();
+ new IPReflectionCommentParser($this->comment, $this);
+ }
+}
?>
\ No newline at end of file
diff --git a/webservice/classes/soap/IPReflectionProperty.class.php b/webservice/classes/soap/IPReflectionProperty.class.php
index 4feaa29..86984af 100755
--- a/webservice/classes/soap/IPReflectionProperty.class.php
+++ b/webservice/classes/soap/IPReflectionProperty.class.php
@@ -1,75 +1,75 @@
-classname = $class;
- parent::__construct($class, $property);
- $this->parseComment();
- }
-
- /**
- *
- * @param $annotationName String the annotation name
- * @param $annotationClass String the annotation class
- * @return void
- */
- public function getAnnotation($annotationName, $annotationClass = null){
- return IPPhpDoc::getAnnotation($this->comment, $annotationName, $annotationClass);
- }
-
- private function parseComment(){
- // No getDocComment available for properties in php 5.0.3 :(
- $this->comment = $this->getDocComment();
- new IPReflectionCommentParser($this->comment, $this);
- }
-}
+classname = $class;
+ parent::__construct($class, $property);
+ $this->parseComment();
+ }
+
+ /**
+ *
+ * @param $annotationName String the annotation name
+ * @param $annotationClass String the annotation class
+ * @return void
+ */
+ public function getAnnotation($annotationName, $annotationClass = null){
+ return IPPhpDoc::getAnnotation($this->comment, $annotationName, $annotationClass);
+ }
+
+ private function parseComment(){
+ // No getDocComment available for properties in php 5.0.3 :(
+ $this->comment = $this->getDocComment();
+ new IPReflectionCommentParser($this->comment, $this);
+ }
+}
?>
\ No newline at end of file
diff --git a/webservice/classes/soap/WSDLException.class.php b/webservice/classes/soap/WSDLException.class.php
index df20680..f2bf5ef 100755
--- a/webservice/classes/soap/WSDLException.class.php
+++ b/webservice/classes/soap/WSDLException.class.php
@@ -1,26 +1,26 @@
-msg = $msg;
- }
- /**
- * @return void
- */
- function Display() {
- print "Error creating WSDL document:".$this->msg;
- //var_dump(debug_backtrace());
- }
-}
+msg = $msg;
+ }
+ /**
+ * @return void
+ */
+ function Display() {
+ print "Error creating WSDL document:".$this->msg;
+ //var_dump(debug_backtrace());
+ }
+}
?>
\ No newline at end of file
diff --git a/webservice/classes/soap/WSDLStruct.class.php b/webservice/classes/soap/WSDLStruct.class.php
index 4b2c2b4..f9700d4 100755
--- a/webservice/classes/soap/WSDLStruct.class.php
+++ b/webservice/classes/soap/WSDLStruct.class.php
@@ -1,338 +1,338 @@
-use = $use;
- $this->binding_style=$type;
- $this->tns = $tns;
- $this->url = $url;
- $this->doc = new domDocument();
- $this->definitions = $this->addElement("wsdl:definitions",$this->doc);
-
- $this->typesTag = $this->addElement("wsdl:types", $this->definitions);
- $this->xsdSchema = $this->addElement("xsd:schema", $this->typesTag);
- $this->xsdSchema->setAttribute("targetNamespace", $this->tns);
- $this->xmlSchema = new IPXMLSchema($this->xsdSchema);
-
- }
-
- /**
- * Adds the class to the services for this WSDL
- *
- * @param IPReflectionClass The service
- * @return void
- */
- public function setService(IPReflectionClass $class){
- $this->services[$class->classname] = $class;
- $this->services[$class->classname]->getMethods(false, false);
- }
- /**
- * @return string The WSDL document for this structure
- */
- public function generateDocument(){
- $this->addToDebug("Generating document");
-
- //add all definitions
- $definitions=$this->definitions;
- $definitions->setAttribute("xmlns", self::NS_WSDL);
- $definitions->setAttribute("xmlns:soap", self::NS_SOAP);
- $definitions->setAttribute("xmlns:SOAP-ENC", self::NS_ENC);
- $definitions->setAttribute("xmlns:wsdl", self::NS_WSDL);
- $definitions->setAttribute("xmlns:xsd", self::NS_XSD);
- $definitions->setAttribute("xmlns:tns", $this->tns);
- $definitions->setAttribute("targetNamespace", $this->tns);
-
- //add all the services
- foreach((array)$this->services as $serviceName => $service){
- //add the portType
- $portType = $this->addPortType($serviceName);
-
- //add binding
- $binding = $this->addBinding($serviceName);
-
- //loop the operations
- foreach((array)$service->methods as $operation){
- $operationName = $operation->name;
- $operationTag = $this->addOperation($operationName, $serviceName);
-
- //input
- //only when to operation needs arguments
- $parameters = $operation->getParameters();
- if(count($parameters)>0 || self::CREATE_EMPTY_INPUTS){
- $messageName = $operationName."Request";
- $input=$this->addElement("wsdl:input", $operationTag);
- $input->setAttribute("message", "tns:".$messageName);
- $para=Array();
- foreach((array)$parameters as $parameterName => $parameter){
- $para[$parameterName] = $parameter->type;
- }
- $this->addMessage($messageName, $para);
- $this->addInput($this->bindingOperationTags[$serviceName][$operationName]);
- }
-
-
- //output
- //only when the operation returns something
- if(!$operation->return || trim($operation->return) == "") throw new WSDLException('No return type for '.$operationName);
- if(strtolower(trim($operation->return))!='void'){
- $messageName = $operationName."Response";
- $output = $this->addElement("wsdl:output", $operationTag);
- $output->setAttribute("message", "tns:".$messageName);
- $this->addOutput($this->bindingOperationTags[$serviceName][$operationName]);
- $this->addMessage($messageName,Array($operation->name."Return" => $operation->return));
- }
- }
- // SH. now add the portType and binding
- $this->definitions->AppendChild($portType);
- $this->definitions->AppendChild($binding);
-
- //add the service
- $this->addService($serviceName);
-
- }
- return $this->doc->saveXML();
- }
-
- /**
- * Adds a new operation to the given service
- * @param string operation name
- * @param string service name
- * @return domElement
- */
- private function addOperation($operationName, $serviceName){
- $this->addToDebug("Adding Operation: '$operationName : $serviceName'");
- $operationTag = $this->addElement("wsdl:operation",$this->portTypeTags[$serviceName]);
- $operationTag->setAttribute("name",$operationName);
-
- //create operation tag for binding
- $bindingOperationTag = $this->addElement("wsdl:operation",$this->bindingTags[$serviceName]);
- $bindingOperationTag->setAttribute("name",$operationName);
-
- //soap operation tag
- $soapOperationTag = $this->addElement("soap:operation",$bindingOperationTag);
- $soapOperationTag->setAttribute("soapAction",$this->url."&method=".$operationName);
- $soapOperationTag->setAttribute("style",($this->binding_style == SOAP_RPC)? "rpc" : "document");
-
- //save references
- $this->operationTags[$serviceName][$operationName] = $operationTag;
- $this->bindingOperationTags[$serviceName][$operationName] = $bindingOperationTag;
-
- //and return
- return $operationTag;
- }
-
- /**
- * adds a new service tag to the WSDL file
- * @param string the service name
- * @return domElement
- */
- private function addService($serviceName){
- $this->addToDebug("Adding service: '$serviceName'");
- //create service
- $serviceTag=$this->addElement("wsdl:service",$this->definitions);
- $serviceTag->setAttribute("name",$serviceName);
-
- //port tag
- $portTag=$this->addElement("wsdl:port", $serviceTag);
- $portTag->setAttribute("name", $serviceName."Port");
- $portTag->setAttribute("binding", "tns:".$serviceName."Binding");
-
- //address tag
- $addressTag = $this->addElement("soap:address", $portTag);
- $addressTag->setAttribute("location", $this->url);
-
- //keep a reference
- $this->serviceTags[$serviceName] = $serviceTag;
- //and return
- return $serviceTag;
- }
-
- /**
- * Adds a new portType to the WSDL structure
- * @param string the service name for which we create a portType
- * @return domElement
- */
- private function addPortType($serviceName){
- $this->addToDebug("Adding portType: '$serviceName'");
- // SH don't add to main doc just yet
- // $portTypeTag=$this->addElement("wsdl:portType", $this->definitions);
- $portTypeTag = $this->addElement("wsdl:portType");
- $portTypeTag->setAttribute("name", $serviceName."PortType");
-
- //keep a reference
- $this->portTypeTags[$serviceName]=$portTypeTag;
- //and return
- return $portTypeTag;
- }
-
- /**
- * Adds a new binding to the WSDL structure
- * @param string serviceName to bind
- * @return domElement
- */
- private function addBinding($serviceName){
- $this->addToDebug("Adding binding: '$serviceName'");
- // SH. don't add to main doc just yet
- // $bindingTag=$this->addElement("binding");
- $bindingTag=$this->addElement("binding",$this->definitions);
- $bindingTag->setAttribute("name", $serviceName."Binding");
- $bindingTag->setAttribute("type", "tns:".$serviceName."PortType");
-
- //soap binding tag
- $soapBindingTag = $this->addElement("soap:binding", $bindingTag);
- $soapBindingTag->setAttribute("style", ($this->binding_style == SOAP_RPC)? "rpc" : "document");
- $soapBindingTag->setAttribute("transport", "http://schemas.xmlsoap.org/soap/http");
-
- //keep a reference
- $this->bindingTags[$serviceName] = $bindingTag;
- //and return
- return $bindingTag;
- }
-
- /**
- * Adds a message tag to the WSDL document
- * @param string Message name
- * @param Array[string=>string] Array with variables & types
- */
- private function addMessage($name, $parts){
- $this->addToDebug("Adding message: '$name'");
- $msg = $this->addElement("message", $this->definitions);
- $msg->setAttribute("name", $name);
- foreach((array)$parts as $partName => $partType){
- $this->addToDebug("Adding Message part: '$partName => $partType'");
- $part=$this->addElement("part", $msg);
- $part->setAttribute("name", $partName);
-
- //check if it is a valid XML Schema datatype
- if($t = IPXMLSchema::checkSchemaType(strtolower($partType)))
- $part->setAttribute("type", "xsd:".$t);
- else{
- //If it is an array, change the type name
- $partName = (substr($partType,-2) == "[]")?substr($partType,0,strpos($partType,"["))."Array":$partType;
-
- $part->setAttribute("type", "tns:".$partName);
- $this->xmlSchema->addComplexType($partType, $partName);
- }
- }
- }
-
- /**
- * Adds an input element to the given parent (an operation tag)
- * @param domNode The Parent domNode
- * @param boolean Kind of tag. true=input tag, false=output tag
- * @return domNode The input/output node
- */
- private function addInput($parent, $input=true){
- $name = $input ? "wsdl:input" : "wsdl:output";
- $tag=$this->addElement($name, $parent);
- $soapOperation=$this->addElement("soap:body", $tag);
- $soapOperation->setAttribute("use", ($this->use == SOAP_ENCODED)? "encoded" : "literal");
- $soapOperation->setAttribute("namespace", $this->tns);
- if($this->use == SOAP_ENCODED)
- $soapOperation->setAttribute("encodingStyle", self::NS_ENC);
- }
-
- /**
- * Adds an output element to the given parent (an operation tag)
- * @param domNode The Parent domNode
- * @return domNode The output node
- */
- private function addOutput($parent){
- return $this->addInput($parent,false);
- }
-
- /************************* Supporting functions ****************************/
-
- private function addToDebug($msg){
- if($this->_debug) echo '-'.$msg."
\n";
- }
-
- /**
- * Adds an child element to the parent
- * @param string The name element
- * @param domNode
- * @return domNode
- */
- private function addElement($name, $parent=false, $ns=false){
- if($ns)
- $el=$this->doc->createElementNS($ns,$name);
- else
- $el=$this->doc->createElement($name);
- if($parent)
- $parent->appendChild($el);
- return $el;
- }
-}
+use = $use;
+ $this->binding_style=$type;
+ $this->tns = $tns;
+ $this->url = $url;
+ $this->doc = new domDocument();
+ $this->definitions = $this->addElement("wsdl:definitions",$this->doc);
+
+ $this->typesTag = $this->addElement("wsdl:types", $this->definitions);
+ $this->xsdSchema = $this->addElement("xsd:schema", $this->typesTag);
+ $this->xsdSchema->setAttribute("targetNamespace", $this->tns);
+ $this->xmlSchema = new IPXMLSchema($this->xsdSchema);
+
+ }
+
+ /**
+ * Adds the class to the services for this WSDL
+ *
+ * @param IPReflectionClass The service
+ * @return void
+ */
+ public function setService(IPReflectionClass $class){
+ $this->services[$class->classname] = $class;
+ $this->services[$class->classname]->getMethods(false, false);
+ }
+ /**
+ * @return string The WSDL document for this structure
+ */
+ public function generateDocument(){
+ $this->addToDebug("Generating document");
+
+ //add all definitions
+ $definitions=$this->definitions;
+ $definitions->setAttribute("xmlns", self::NS_WSDL);
+ $definitions->setAttribute("xmlns:soap", self::NS_SOAP);
+ $definitions->setAttribute("xmlns:SOAP-ENC", self::NS_ENC);
+ $definitions->setAttribute("xmlns:wsdl", self::NS_WSDL);
+ $definitions->setAttribute("xmlns:xsd", self::NS_XSD);
+ $definitions->setAttribute("xmlns:tns", $this->tns);
+ $definitions->setAttribute("targetNamespace", $this->tns);
+
+ //add all the services
+ foreach((array)$this->services as $serviceName => $service){
+ //add the portType
+ $portType = $this->addPortType($serviceName);
+
+ //add binding
+ $binding = $this->addBinding($serviceName);
+
+ //loop the operations
+ foreach((array)$service->methods as $operation){
+ $operationName = $operation->name;
+ $operationTag = $this->addOperation($operationName, $serviceName);
+
+ //input
+ //only when to operation needs arguments
+ $parameters = $operation->getParameters();
+ if(count($parameters)>0 || self::CREATE_EMPTY_INPUTS){
+ $messageName = $operationName."Request";
+ $input=$this->addElement("wsdl:input", $operationTag);
+ $input->setAttribute("message", "tns:".$messageName);
+ $para=Array();
+ foreach((array)$parameters as $parameterName => $parameter){
+ $para[$parameterName] = $parameter->type;
+ }
+ $this->addMessage($messageName, $para);
+ $this->addInput($this->bindingOperationTags[$serviceName][$operationName]);
+ }
+
+
+ //output
+ //only when the operation returns something
+ if(!$operation->return || trim($operation->return) == "") throw new WSDLException('No return type for '.$operationName);
+ if(strtolower(trim($operation->return))!='void'){
+ $messageName = $operationName."Response";
+ $output = $this->addElement("wsdl:output", $operationTag);
+ $output->setAttribute("message", "tns:".$messageName);
+ $this->addOutput($this->bindingOperationTags[$serviceName][$operationName]);
+ $this->addMessage($messageName,Array($operation->name."Return" => $operation->return));
+ }
+ }
+ // SH. now add the portType and binding
+ $this->definitions->AppendChild($portType);
+ $this->definitions->AppendChild($binding);
+
+ //add the service
+ $this->addService($serviceName);
+
+ }
+ return $this->doc->saveXML();
+ }
+
+ /**
+ * Adds a new operation to the given service
+ * @param string operation name
+ * @param string service name
+ * @return domElement
+ */
+ private function addOperation($operationName, $serviceName){
+ $this->addToDebug("Adding Operation: '$operationName : $serviceName'");
+ $operationTag = $this->addElement("wsdl:operation",$this->portTypeTags[$serviceName]);
+ $operationTag->setAttribute("name",$operationName);
+
+ //create operation tag for binding
+ $bindingOperationTag = $this->addElement("wsdl:operation",$this->bindingTags[$serviceName]);
+ $bindingOperationTag->setAttribute("name",$operationName);
+
+ //soap operation tag
+ $soapOperationTag = $this->addElement("soap:operation",$bindingOperationTag);
+ $soapOperationTag->setAttribute("soapAction",$this->url."&method=".$operationName);
+ $soapOperationTag->setAttribute("style",($this->binding_style == SOAP_RPC)? "rpc" : "document");
+
+ //save references
+ $this->operationTags[$serviceName][$operationName] = $operationTag;
+ $this->bindingOperationTags[$serviceName][$operationName] = $bindingOperationTag;
+
+ //and return
+ return $operationTag;
+ }
+
+ /**
+ * adds a new service tag to the WSDL file
+ * @param string the service name
+ * @return domElement
+ */
+ private function addService($serviceName){
+ $this->addToDebug("Adding service: '$serviceName'");
+ //create service
+ $serviceTag=$this->addElement("wsdl:service",$this->definitions);
+ $serviceTag->setAttribute("name",$serviceName);
+
+ //port tag
+ $portTag=$this->addElement("wsdl:port", $serviceTag);
+ $portTag->setAttribute("name", $serviceName."Port");
+ $portTag->setAttribute("binding", "tns:".$serviceName."Binding");
+
+ //address tag
+ $addressTag = $this->addElement("soap:address", $portTag);
+ $addressTag->setAttribute("location", $this->url);
+
+ //keep a reference
+ $this->serviceTags[$serviceName] = $serviceTag;
+ //and return
+ return $serviceTag;
+ }
+
+ /**
+ * Adds a new portType to the WSDL structure
+ * @param string the service name for which we create a portType
+ * @return domElement
+ */
+ private function addPortType($serviceName){
+ $this->addToDebug("Adding portType: '$serviceName'");
+ // SH don't add to main doc just yet
+ // $portTypeTag=$this->addElement("wsdl:portType", $this->definitions);
+ $portTypeTag = $this->addElement("wsdl:portType");
+ $portTypeTag->setAttribute("name", $serviceName."PortType");
+
+ //keep a reference
+ $this->portTypeTags[$serviceName]=$portTypeTag;
+ //and return
+ return $portTypeTag;
+ }
+
+ /**
+ * Adds a new binding to the WSDL structure
+ * @param string serviceName to bind
+ * @return domElement
+ */
+ private function addBinding($serviceName){
+ $this->addToDebug("Adding binding: '$serviceName'");
+ // SH. don't add to main doc just yet
+ // $bindingTag=$this->addElement("binding");
+ $bindingTag=$this->addElement("binding",$this->definitions);
+ $bindingTag->setAttribute("name", $serviceName."Binding");
+ $bindingTag->setAttribute("type", "tns:".$serviceName."PortType");
+
+ //soap binding tag
+ $soapBindingTag = $this->addElement("soap:binding", $bindingTag);
+ $soapBindingTag->setAttribute("style", ($this->binding_style == SOAP_RPC)? "rpc" : "document");
+ $soapBindingTag->setAttribute("transport", "http://schemas.xmlsoap.org/soap/http");
+
+ //keep a reference
+ $this->bindingTags[$serviceName] = $bindingTag;
+ //and return
+ return $bindingTag;
+ }
+
+ /**
+ * Adds a message tag to the WSDL document
+ * @param string Message name
+ * @param Array[string=>string] Array with variables & types
+ */
+ private function addMessage($name, $parts){
+ $this->addToDebug("Adding message: '$name'");
+ $msg = $this->addElement("message", $this->definitions);
+ $msg->setAttribute("name", $name);
+ foreach((array)$parts as $partName => $partType){
+ $this->addToDebug("Adding Message part: '$partName => $partType'");
+ $part=$this->addElement("part", $msg);
+ $part->setAttribute("name", $partName);
+
+ //check if it is a valid XML Schema datatype
+ if($t = IPXMLSchema::checkSchemaType(strtolower($partType)))
+ $part->setAttribute("type", "xsd:".$t);
+ else{
+ //If it is an array, change the type name
+ $partName = (substr($partType,-2) == "[]")?substr($partType,0,strpos($partType,"["))."Array":$partType;
+
+ $part->setAttribute("type", "tns:".$partName);
+ $this->xmlSchema->addComplexType($partType, $partName);
+ }
+ }
+ }
+
+ /**
+ * Adds an input element to the given parent (an operation tag)
+ * @param domNode The Parent domNode
+ * @param boolean Kind of tag. true=input tag, false=output tag
+ * @return domNode The input/output node
+ */
+ private function addInput($parent, $input=true){
+ $name = $input ? "wsdl:input" : "wsdl:output";
+ $tag=$this->addElement($name, $parent);
+ $soapOperation=$this->addElement("soap:body", $tag);
+ $soapOperation->setAttribute("use", ($this->use == SOAP_ENCODED)? "encoded" : "literal");
+ $soapOperation->setAttribute("namespace", $this->tns);
+ if($this->use == SOAP_ENCODED)
+ $soapOperation->setAttribute("encodingStyle", self::NS_ENC);
+ }
+
+ /**
+ * Adds an output element to the given parent (an operation tag)
+ * @param domNode The Parent domNode
+ * @return domNode The output node
+ */
+ private function addOutput($parent){
+ return $this->addInput($parent,false);
+ }
+
+ /************************* Supporting functions ****************************/
+
+ private function addToDebug($msg){
+ if($this->_debug) echo '-'.$msg."
\n";
+ }
+
+ /**
+ * Adds an child element to the parent
+ * @param string The name element
+ * @param domNode
+ * @return domNode
+ */
+ private function addElement($name, $parent=false, $ns=false){
+ if($ns)
+ $el=$this->doc->createElementNS($ns,$name);
+ else
+ $el=$this->doc->createElement($name);
+ if($parent)
+ $parent->appendChild($el);
+ return $el;
+ }
+}
?>
\ No newline at end of file
diff --git a/webservice/classes/soap/WSException.class.php b/webservice/classes/soap/WSException.class.php
index 93c4de4..989e81d 100755
--- a/webservice/classes/soap/WSException.class.php
+++ b/webservice/classes/soap/WSException.class.php
@@ -1,24 +1,24 @@
-msg = $msg;
- }
- /**
- * @return void
- */
- public function Display() {
- echo $this->msg;
- }
-}
+msg = $msg;
+ }
+ /**
+ * @return void
+ */
+ public function Display() {
+ echo $this->msg;
+ }
+}
?>
\ No newline at end of file
diff --git a/webservice/classes/soap/WSHelper.class.php b/webservice/classes/soap/WSHelper.class.php
index a7e82cb..5bd0058 100755
--- a/webservice/classes/soap/WSHelper.class.php
+++ b/webservice/classes/soap/WSHelper.class.php
@@ -1,183 +1,183 @@
-uri = $uri;
- $this->setWSDLCacheFolder($_SERVER['DOCUMENT_ROOT'].dirname($_SERVER['PHP_SELF'])."/wsdl/");
- if($class) $this->setClass($class);
- }
-
- /**
- * Adds the given class name to the list of classes
- * to be included in the documentation/WSDL/Request handlers
- * @param string
- * @return void
- */
- public function setClass($name){
- $this->name = $name;
- $this->wsdlfile = $this->wsdlFolder.$this->name.".wsdl";
- }
-
- public function setWSDLCacheFolder($folder) {
- $this->wsdlFolder = $folder;
- //reset wsdlfile
- $this->wsdlfile = $this->wsdlFolder.$this->name.".wsdl";
- }
- /**
- * Sets the persistence level for the soap class
- */
- public function setPersistence($persistence) {
- $this->persistence = $persistence;
- }
-
- /**
- * Handles everything. Makes sure the webservice is handled,
- * documentations is generated, or the wsdl is generated,
- * according to the page request
- * @return void
- */
- public function handle(){
- if(substr($_SERVER['QUERY_STRING'], -4) == 'wsdl'){
- $this->showWSDL();
- }elseif(isset($GLOBALS['HTTP_RAW_POST_DATA']) && strlen($GLOBALS['HTTP_RAW_POST_DATA'])>0){
- $this->handleRequest();
- }else{
- $this->createDocumentation();
- }
- }
- /**
- * Checks if the current WSDL is up-to-date, regenerates if necessary and outputs the WSDL
- * @return void
- */
- public function showWSDL(){
- //check if it's a legal webservice class
- if(!in_array($this->name, $this->classNameArr))
- throw new Exception("No valid webservice class.");
-
- //@TODO: nog een mooie oplossing voor het cachen zoeken
- header("Content-type: text/xml");
- if($this->useWSDLCache && file_exists($this->wsdlfile)){
- readfile($this->wsdlfile);
- }else{
- //make sure to refresh PHP WSDL cache system
- ini_set("soap.wsdl_cache_enabled",0);
- echo $this->createWSDL();
- }
- }
-
- private function createWSDL(){
- $this->class = new IPReflectionClass($this->name);
- $wsdl = new WSDLStruct($this->uri, "http://".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME']."?class=".$this->name, $this->type, $this->use);
- $wsdl->setService($this->class);
-
- try {
- $gendoc = $wsdl->generateDocument();
- } catch (WSDLException $exception) {
- $exception->Display();
- exit();
- }
-
- $fh = fopen($this->wsdlfile, "w+");
- fwrite($fh, $gendoc);
- fclose($fh);
-
- return $gendoc;
- }
-
- /**
- * Lets the native PHP5 soap implementation handle the request
- * after registrating the class
- * @return void
- */
- private function handleRequest(){
- //check if it's a legal webservice class
- if(!in_array($this->name, $this->classNameArr))
- throw new Exception("No valid webservice class.");
-
- //check cache
- //if(!file_exists($this->wsdlfile))
- $this->createWSDL();
-
- $options = Array('actor' => $this->actor, 'classmap' => $this->structureMap);
-
- header("Content-type: text/xml");
- $this->server = new SoapServer($this->wsdlfile, $options);
- $this->server->setClass($this->name);
- $this->server->setPersistence($this->persistence);
-
- use_soap_error_handler(true);
- $this->server->handle();
- }
-
- /**
- * @param string code
- * @param string string
- * @param string actor
- * @param mixed details
- * @param string name
- * @return void
- */
- public function fault($code, $string, $actor, $details, $name='') {
- return $this->server->fault($code, $string, $actor, $details, $name);
- }
-
- /**
- * Generates the documentations for the webservice usage.
- * @TODO: "int", "boolean", "double", "float", "string", "void"
- * @param string Template filename
- * @return void
- */
- public function createDocumentation($template="classes/soap/templates/docclass.xsl") {
- if(!is_file($template))
- throw new WSException("Could not find the template file: '$template'");
- $this->class = new IPReflectionClass($this->name);
- $xtpl = new IPXSLTemplate($template);
- $documentation = Array();
- $documentation['menu'] = Array();
- //loop menu items
- sort($this->classNameArr);
- foreach($this->classNameArr as $className) {
- $documentation['menu'][] = new IPReflectionClass($className);
- }
-
- if($this->class){
- $this->class->properties = $this->class->getProperties(false, false);
- $this->class->methods = $this->class->getMethods(false, false);
- foreach((array)$this->class->methods as $method) {
- $method->params = $method->getParameters();
- }
-
- $documentation['class'] = $this->class;
- }
- echo $xtpl->execute($documentation);
- }
-}
+uri = $uri;
+ $this->setWSDLCacheFolder($_SERVER['DOCUMENT_ROOT'].dirname($_SERVER['PHP_SELF'])."/wsdl/");
+ if($class) $this->setClass($class);
+ }
+
+ /**
+ * Adds the given class name to the list of classes
+ * to be included in the documentation/WSDL/Request handlers
+ * @param string
+ * @return void
+ */
+ public function setClass($name){
+ $this->name = $name;
+ $this->wsdlfile = $this->wsdlFolder.$this->name.".wsdl";
+ }
+
+ public function setWSDLCacheFolder($folder) {
+ $this->wsdlFolder = $folder;
+ //reset wsdlfile
+ $this->wsdlfile = $this->wsdlFolder.$this->name.".wsdl";
+ }
+ /**
+ * Sets the persistence level for the soap class
+ */
+ public function setPersistence($persistence) {
+ $this->persistence = $persistence;
+ }
+
+ /**
+ * Handles everything. Makes sure the webservice is handled,
+ * documentations is generated, or the wsdl is generated,
+ * according to the page request
+ * @return void
+ */
+ public function handle(){
+ if(substr($_SERVER['QUERY_STRING'], -4) == 'wsdl'){
+ $this->showWSDL();
+ }elseif(isset($GLOBALS['HTTP_RAW_POST_DATA']) && strlen($GLOBALS['HTTP_RAW_POST_DATA'])>0){
+ $this->handleRequest();
+ }else{
+ $this->createDocumentation();
+ }
+ }
+ /**
+ * Checks if the current WSDL is up-to-date, regenerates if necessary and outputs the WSDL
+ * @return void
+ */
+ public function showWSDL(){
+ //check if it's a legal webservice class
+ if(!in_array($this->name, $this->classNameArr))
+ throw new Exception("No valid webservice class.");
+
+ //@TODO: nog een mooie oplossing voor het cachen zoeken
+ header("Content-type: text/xml");
+ if($this->useWSDLCache && file_exists($this->wsdlfile)){
+ readfile($this->wsdlfile);
+ }else{
+ //make sure to refresh PHP WSDL cache system
+ ini_set("soap.wsdl_cache_enabled",0);
+ echo $this->createWSDL();
+ }
+ }
+
+ private function createWSDL(){
+ $this->class = new IPReflectionClass($this->name);
+ $wsdl = new WSDLStruct($this->uri, "http://".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME']."?class=".$this->name, $this->type, $this->use);
+ $wsdl->setService($this->class);
+
+ try {
+ $gendoc = $wsdl->generateDocument();
+ } catch (WSDLException $exception) {
+ $exception->Display();
+ exit();
+ }
+
+ $fh = fopen($this->wsdlfile, "w+");
+ fwrite($fh, $gendoc);
+ fclose($fh);
+
+ return $gendoc;
+ }
+
+ /**
+ * Lets the native PHP5 soap implementation handle the request
+ * after registrating the class
+ * @return void
+ */
+ private function handleRequest(){
+ //check if it's a legal webservice class
+ if(!in_array($this->name, $this->classNameArr))
+ throw new Exception("No valid webservice class.");
+
+ //check cache
+ //if(!file_exists($this->wsdlfile))
+ $this->createWSDL();
+
+ $options = Array('actor' => $this->actor, 'classmap' => $this->structureMap);
+
+ header("Content-type: text/xml");
+ $this->server = new SoapServer($this->wsdlfile, $options);
+ $this->server->setClass($this->name);
+ $this->server->setPersistence($this->persistence);
+
+ use_soap_error_handler(true);
+ $this->server->handle();
+ }
+
+ /**
+ * @param string code
+ * @param string string
+ * @param string actor
+ * @param mixed details
+ * @param string name
+ * @return void
+ */
+ public function fault($code, $string, $actor, $details, $name='') {
+ return $this->server->fault($code, $string, $actor, $details, $name);
+ }
+
+ /**
+ * Generates the documentations for the webservice usage.
+ * @TODO: "int", "boolean", "double", "float", "string", "void"
+ * @param string Template filename
+ * @return void
+ */
+ public function createDocumentation($template="classes/soap/templates/docclass.xsl") {
+ if(!is_file($template))
+ throw new WSException("Could not find the template file: '$template'");
+ $this->class = new IPReflectionClass($this->name);
+ $xtpl = new IPXSLTemplate($template);
+ $documentation = Array();
+ $documentation['menu'] = Array();
+ //loop menu items
+ sort($this->classNameArr);
+ foreach($this->classNameArr as $className) {
+ $documentation['menu'][] = new IPReflectionClass($className);
+ }
+
+ if($this->class){
+ $this->class->properties = $this->class->getProperties(false, false);
+ $this->class->methods = $this->class->getMethods(false, false);
+ foreach((array)$this->class->methods as $method) {
+ $method->params = $method->getParameters();
+ }
+
+ $documentation['class'] = $this->class;
+ }
+ echo $xtpl->execute($documentation);
+ }
+}
?>
\ No newline at end of file
diff --git a/webservice/classes/soap/common.php b/webservice/classes/soap/common.php
index 84324cc..44e3721 100755
--- a/webservice/classes/soap/common.php
+++ b/webservice/classes/soap/common.php
@@ -40,48 +40,48 @@
* @version Version 0.1
*/
-
-error_reporting(E_ALL);
-ob_start("ob_gzhandler");
-
-require_once ("config.php");
-
-if(!extension_loaded("soap"))
- die("Soap extension not loaded!");
-
-session_start();
-
+
+error_reporting(E_ALL);
+ob_start("ob_gzhandler");
+
+require_once ("config.php");
+
+if(!extension_loaded("soap"))
+ die("Soap extension not loaded!");
+
+session_start();
+
/** autoload function for PHP5
* Loads all the classes in the model
*
-*/
-function __autoload($classname) {
- try{
- if(file_exists("classes/soap/model/$classname.class.php"))
- include("classes/soap/model/$classname.class.php");
- elseif(file_exists("classes/soap/$classname.class.php"))
- include("classes/soap/$classname.class.php");
- elseif(file_exists("classes/soap/$classname.class.php"))
- include("classes/soap/$classname.class.php");
- } catch (Exception $e) {
- echo $e->getMessage();
- }
-
-}
-
-/** Write out debug file */
-function debug($txt,$file="debug.txt"){
- $fp = fopen($file, "a");
- fwrite($fp, str_replace("\n","\r\n","\r\n".$txt));
- fclose($fp);
-}
-
-/** Write out object in the debug log */
-function debugObject($txt,$obj){
- ob_start();
- print_r($obj);
- $data = ob_get_contents();
- ob_end_clean();
- debug($txt."\n".$data);
-}
-?>
+*/
+function __autoload($classname) {
+ try{
+ if(file_exists("classes/soap/model/$classname.class.php"))
+ include("classes/soap/model/$classname.class.php");
+ elseif(file_exists("classes/soap/$classname.class.php"))
+ include("classes/soap/$classname.class.php");
+ elseif(file_exists("classes/soap/$classname.class.php"))
+ include("classes/soap/$classname.class.php");
+ } catch (Exception $e) {
+ echo $e->getMessage();
+ }
+
+}
+
+/** Write out debug file */
+function debug($txt,$file="debug.txt"){
+ $fp = fopen($file, "a");
+ fwrite($fp, str_replace("\n","\r\n","\r\n".$txt));
+ fclose($fp);
+}
+
+/** Write out object in the debug log */
+function debugObject($txt,$obj){
+ ob_start();
+ print_r($obj);
+ $data = ob_get_contents();
+ ob_end_clean();
+ debug($txt."\n".$data);
+}
+?>
diff --git a/webservice/classes/soap/templates/docclass.xsl b/webservice/classes/soap/templates/docclass.xsl
index 380bdc4..a1c9648 100755
--- a/webservice/classes/soap/templates/docclass.xsl
+++ b/webservice/classes/soap/templates/docclass.xsl
@@ -1,116 +1,116 @@
-
-
-
-
-
-
-
- Webservices
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Full description
-
-
- Properties
-
-
-
-
-
-
-
-
- type
-
-
- type
-
-
-
-
-  missing type info
-
-
-
-
-
-
- Methods
-
-
-
- (
-
-
- ,
-
- )
-
-
-
-
-
- returns
-
-
- returns
-
-
-
-
-  missing return value
-
-
-
-
- throws
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+ Webservices
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Full description
+
+
+ Properties
+
+
+
+
+
+
+
+
+ type
+
+
+ type
+
+
+
+
+  missing type info
+
+
+
+
+
+
+ Methods
+
+
+
+ (
+
+
+ ,
+
+ )
+
+
+
+
+
+ returns
+
+
+ returns
+
+
+
+
+  missing return value
+
+
+
+
+ throws
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/webservice/classes/soap/templates/str.replace.function.xsl b/webservice/classes/soap/templates/str.replace.function.xsl
index 5d74e86..626e549 100755
--- a/webservice/classes/soap/templates/str.replace.function.xsl
+++ b/webservice/classes/soap/templates/str.replace.function.xsl
@@ -1,105 +1,105 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ERROR: function implementation of str:replace() relies on exsl:node-set().
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ERROR: function implementation of str:replace() relies on exsl:node-set().
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/webservice/tests/annotations.php b/webservice/tests/annotations.php
index e10ef44..a0ee1ff 100755
--- a/webservice/tests/annotations.php
+++ b/webservice/tests/annotations.php
@@ -1,44 +1,44 @@
-
-chdir("..");
-include "common.php";
-
-class DefaultController {
- const TYPE_PLAIN = 1;
- const TYPE_HTML = 2;
- public $type;
- public $length;
-}
-/**
- * @ann1('me'=>'you');
- */
-class something{
- /**
- * @var string
- * @Controller(type => DefaultController::TYPE_PLAIN, length => 100)
- */
- public $propertyA;
-
- /**
- * @var string
- * @Controller(type => DefaultController::TYPE_HTML, length => 100)
- */
- public function methodB () {
- return "aap";
- }
-}
-
-/* Annotation example */
-$rel = new IPReflectionClass("something");
-$properties = $rel->getProperties();
-$methods = $rel->getMethods();
-
-var_dump($rel->getAnnotation("ann1", "stdClass"));
-
-$property = $properties["propertyA"];
-$ann = $property->getAnnotation("Controller", "DefaultController");
-var_dump($ann);
-
-$method = $methods["methodB"];
-$ann = $method->getAnnotation("Controller", "DefaultController");
-var_dump($ann);
+
+chdir("..");
+include "common.php";
+
+class DefaultController {
+ const TYPE_PLAIN = 1;
+ const TYPE_HTML = 2;
+ public $type;
+ public $length;
+}
+/**
+ * @ann1('me'=>'you');
+ */
+class something{
+ /**
+ * @var string
+ * @Controller(type => DefaultController::TYPE_PLAIN, length => 100)
+ */
+ public $propertyA;
+
+ /**
+ * @var string
+ * @Controller(type => DefaultController::TYPE_HTML, length => 100)
+ */
+ public function methodB () {
+ return "aap";
+ }
+}
+
+/* Annotation example */
+$rel = new IPReflectionClass("something");
+$properties = $rel->getProperties();
+$methods = $rel->getMethods();
+
+var_dump($rel->getAnnotation("ann1", "stdClass"));
+
+$property = $properties["propertyA"];
+$ann = $property->getAnnotation("Controller", "DefaultController");
+var_dump($ann);
+
+$method = $methods["methodB"];
+$ann = $method->getAnnotation("Controller", "DefaultController");
+var_dump($ann);
?>
\ No newline at end of file