Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00033 define('DEFAULT_TIMEOUT',5);
00034 define('DEFAULT_RESPONSE_TIMEOUT',30);
00035
00036 include_once './webservice/soap/lib/nusoap.php';
00037
00038 class ilSoapClient
00039 {
00040 var $server = '';
00041 var $timeout = null;
00042 var $response_timeout = null;
00043 var $use_wsdl = true;
00044
00045 function ilSoapClient($a_server = '')
00046 {
00047 global $ilLog;
00048
00049 $this->log =& $ilLog;
00050 $this->__setServer($a_server);
00051 }
00052
00053 function __setServer($a_server)
00054 {
00055 if(strlen($a_server))
00056 {
00057 return $this->server = $a_server;
00058 }
00059 $this->server = ILIAS_HTTP_PATH.'/webservice/soap/server.php?wsdl';
00060 }
00061
00062 function getServer()
00063 {
00064 return $this->server;
00065 }
00066
00067 function setTimeout($a_timeout)
00068 {
00069 $this->timeout = $a_timeout;
00070 }
00071 function getTimeout()
00072 {
00073 return $this->timeout ? $this->timeout : DEFAULT_TIMEOUT;
00074 }
00075
00076 function setResponseTimeout($a_timeout)
00077 {
00078 $this->response_timeout = $a_timeout;
00079 }
00080 function getResponseTimeout()
00081 {
00082 return $this->response_timeout;
00083 }
00084
00085 function enableWSDL($a_status)
00086 {
00087 $this->use_wsdl = (bool) $a_status;
00088 }
00089 function enabledWSDL()
00090 {
00091 return (bool) $this->use_wsdl;
00092 }
00093
00094
00095 function init()
00096 {
00097 $this->client = new soap_client($this->getServer(),
00098 $this->enabledWSDL(),
00099 false,
00100 false,
00101 false,
00102 $this->getTimeout(),
00103 $this->getResponseTimeout());
00104
00105 if($error = $this->client->getError())
00106 {
00107 $this->log->write('Error calling soap server: '.$this->getServer().' Error: '.$error);
00108 }
00109 return true;
00110 }
00111
00112 function &call($a_operation,$a_params)
00113 {
00114 $res = $this->client->call($a_operation,$a_params);
00115
00116 return $res;
00117
00118 }
00119 }
00120
00121 ?>