ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilSoapClient.php
Go to the documentation of this file.
1<?php
2/*
3 +-----------------------------------------------------------------------------+
4 | ILIAS open source |
5 +-----------------------------------------------------------------------------+
6 | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7 | |
8 | This program is free software; you can redistribute it and/or |
9 | modify it under the terms of the GNU General Public License |
10 | as published by the Free Software Foundation; either version 2 |
11 | of the License, or (at your option) any later version. |
12 | |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 +-----------------------------------------------------------------------------+
22*/
23
24// @deprecated
25define('DEFAULT_TIMEOUT',5);
26// @deprecated
27define('DEFAULT_RESPONSE_TIMEOUT',30);
28
29include_once './webservice/soap/lib/nusoap.php';
30
31
41{
44
45 var $server = '';
46 var $timeout = null;
48 var $use_wsdl = true;
49
50 function ilSoapClient($a_server = '')
51 {
52 global $ilLog;
53
54 $this->log =& $ilLog;
55 $this->__setServer($a_server);
56 }
57
58 function __setServer($a_server)
59 {
60 global $ilSetting;
61
62 if(strlen($a_server))
63 {
64 return $this->server = $a_server;
65 }
66
67 if(strlen(trim($ilSetting->get('soap_wsdl_path'))))
68 {
69 return $this->server = trim($ilSetting->get('soap_wsdl_path'));
70 }
71
72 $this->setTimeout($ilSetting->get('soap_connect_timeout', self::DEFAULT_CONNECT_TIMEOUT));
73
74 $this->server = ilUtil::_getHttpPath().'/webservice/soap/server.php?wsdl';
75 }
76
77 function getServer()
78 {
79 return $this->server;
80 }
81
82 function setTimeout($a_timeout)
83 {
84 $this->timeout = $a_timeout;
85 }
86 function getTimeout()
87 {
88 return $this->timeout ? $this->timeout : self::DEFAULT_CONNECT_TIMEOUT;
89 }
90
91 function setResponseTimeout($a_timeout)
92 {
93 $this->response_timeout = $a_timeout;
94 }
96 {
98 }
99
100 function enableWSDL($a_status)
101 {
102 $this->use_wsdl = (bool) $a_status;
103 }
104 function enabledWSDL()
105 {
106 return (bool) $this->use_wsdl;
107 }
108
109 function init()
110 {
111 $this->client = new nusoap_client($this->getServer(),
112 $this->enabledWSDL(),
113 false, // no proxy support in the moment
114 false,
115 false,
116 false,
117 $this->getTimeout(),
118 $this->getResponseTimeout());
119
120 if($error = $this->client->getError())
121 {
122 if(stristr($error, 'socket read of headers') === FALSE)
123 {
124 $this->log->write('Error calling soap server: '.$this->getServer().' Error: '.$error);
125 }
126 return false;
127 }
128 return true;
129 }
130
131 function &call($a_operation,$a_params)
132 {
133 $res = $this->client->call($a_operation,$a_params);
134
135 #$GLOBALS['ilLog']->write(__METHOD__.': '.$this->client->request);
136 #$GLOBALS['ilLog']->write(__METHOD__.': '.$this->client->response);
137
138 if($error = $this->client->getError())
139 {
140 if(stristr($error, 'socket read of headers') === FALSE)
141 {
142 $this->log->write('Error calling soap server: '.$this->getServer().' Error: '.$error);
143 }
144 }
145
146 return $res;
147 // Todo cannot check errors here since it's not possible to distinguish between 'timeout' and other errors.
148 }
149}
150?>
ilSoapClient($a_server='')
__setServer($a_server)
const DEFAULT_CONNECT_TIMEOUT
setResponseTimeout($a_timeout)
enableWSDL($a_status)
& call($a_operation, $a_params)
setTimeout($a_timeout)
const DEFAULT_RESPONSE_TIMEOUT
static _getHttpPath()
[nu]soapclient higher level class for easy usage.
Definition: nusoap.php:7059
global $ilSetting
Definition: privfeed.php:40