ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilBMFWSDL_Cache Class Reference
+ Inheritance diagram for ilBMFWSDL_Cache:
+ Collaboration diagram for ilBMFWSDL_Cache:

Public Member Functions

 ilBMFWSDL_Cache ($cacheUse=WSDL_CACHE_USE, $cacheMaxAge=WSDL_CACHE_MAX_AGE)
 ilBMFWSDL_Cache constructor
 _cacheDir ()
 _cacheDir return the path to the cache, if it doesn't exist, make it
 get ($wsdl_fname, $proxy_params=array(), $cache=0)
 Retrieves a file from cache if it exists, otherwise retreive from net, add to cache, and return from cache.
- Public Member Functions inherited from ilBMFBase
 ilBMFBase ($faultcode= 'Client')
 Constructor.
 _resetNamespaces ()
 _setSchemaVersion ($schemaVersion)
 Sets the schema version used in the SOAP message.
 _getNamespacePrefix ($ns)
 _getNamespaceForPrefix ($prefix)
 _isSoapValue (&$value)
 _serializeValue (&$value, $name= '', $type=false, $elNamespace=NULL, $typeNamespace=NULL, $options=array(), $attributes=array(), $artype='', $OBJTypeNS=array())
 _getType (&$value)
 Converts a PHP type to a SOAP type.
 _multiArrayType (&$value, &$type, &$size, &$xml)
 _isBase64 (&$value)
 Returns whether a string is base64 encoded data.
 _isBase64Type ($type)
 Returns whether a type is a base64 type.
 _isHash (&$a)
 Returns whether an array is a hash.
 _un_htmlentities ($string)
_decode (&$soapval)
 _makeEnvelope (&$method, &$headers, $encoding=SOAP_DEFAULT_ENCODING, $options=array())
 Creates the SOAP envelope with the SOAP envelop data.
 _makeMimeMessage (&$xml, $encoding=SOAP_DEFAULT_ENCODING)
 _makeDIMEMessage ($xml)
 _decodeMimeMessage (&$data, &$headers, &$attachments)
 _decodeDIMEMessage (&$data, &$headers, &$attachments)
 __set_type_translation ($type, $class=null)
- Public Member Functions inherited from ilBMFBase_Object
 ilBMFBase_Object ($faultcode= 'Client')
 Constructor.
_raiseSoapFault ($str, $detail= '', $actorURI= '', $code=null, $mode=null, $options=null, $skipmsg=false)
 Raises a SOAP error.
 __isfault ()
__getfault ()
 _debug ($string)
 Adds a string to the debug data.

Data Fields

 $_cacheUse = null
 $_cacheMaxAge = null
- Data Fields inherited from ilBMFBase
 $_XMLSchema
 $_XMLSchemaVersion = 'http://www.w3.org/2001/XMLSchema'
 $_typemap
 $_defaultObjectClassname = 'stdClass'
 Default class name to use for decoded response objects.
 $_namespaces
 $_namespace
 $_xmlEntities
 $_doconversion = false
 $__attachments = array()
 $_wsdl = null
 $_section5 = true
 True if we use section 5 encoding, or false if this is literal.
 $_auto_translation = false
 $_type_translation = array()
- Data Fields inherited from ilBMFBase_Object
 $_debug_flag = false
 Store debugging information in $_debug_data?
 $_debug_data = ''
 String containing debugging information if $_debug_flag is true.
 $_encodings = array('ISO-8859-1', 'US-ASCII', 'UTF-8')
 Supported encodings, limited by XML extension.
 $_myfaultcode = ''
 Fault code.
 $fault = null
 Recent PEAR_Error object.

Detailed Description

Definition at line 873 of file class.ilBMFWSDL.php.

Member Function Documentation

ilBMFWSDL_Cache::_cacheDir ( )

_cacheDir return the path to the cache, if it doesn't exist, make it

Definition at line 910 of file class.ilBMFWSDL.php.

References $dir.

Referenced by get().

{
$dir = getenv("WSDLCACHE");
if (!$dir) $dir = " ./wsdlcache";
@mkdir($dir, 0700);
return $dir;
}

+ Here is the caller graph for this function:

ilBMFWSDL_Cache::get (   $wsdl_fname,
  $proxy_params = array(),
  $cache = 0 
)

Retrieves a file from cache if it exists, otherwise retreive from net, add to cache, and return from cache.

Parameters
stringURL to WSDL
arrayproxy parameters
intexpected MD5 of WSDL URL public
Returns
string data

Definition at line 928 of file class.ilBMFWSDL.php.

References $result, _cacheDir(), and ilBMFBase_Object\_raiseSoapFault().

{
$cachename = $md5_wsdl = $file_data = '';
if ($this->_cacheUse) {
// Try to retrieve WSDL from cache
$cachename = ilBMFWSDL_Cache::_cacheDir() . '/' . md5($wsdl_fname). ' .wsdl';
if (file_exists($cachename)) {
$wf = fopen($cachename, 'rb');
if ($wf) {
// Reading cached file
$file_data = fread($wf, filesize($cachename));
$md5_wsdl = md5($file_data);
fclose($wf);
}
if ($cache) {
if ($cache != $md5_wsdl) {
return $this->_raiseSoapFault('WSDL Checksum error!', $wsdl_fname);
}
} else {
$fi = stat($cachename);
$cache_mtime = $fi[8];
//print cache_mtime, time()
if ($cache_mtime + $this->_cacheMaxAge < time()) {
// expired
$md5_wsdl = ''; // refetch
}
}
}
}
if (!$md5_wsdl) {
// Not cached or not using cache. Retrieve WSDL from URL
// is it a local file?
// this section should be replace by curl at some point
if (!preg_match('/^(https?|file):\/\//', $wsdl_fname)) {
if (!file_exists($wsdl_fname)) {
return $this->_raiseSoapFault("Unable to read local WSDL $wsdl_fname", $wsdl_fname);
}
if (function_exists('file_get_contents')) {
$file_data = file_get_contents($wsdl_fname);
} else {
$file_data = implode('',file($wsdl_fname));
}
} else {
$uri = explode('?', $wsdl_fname);
$rq =& new HTTP_Request($uri[0], $proxy_params);
// the user agent HTTP_Request uses fouls things up
if (isset($uri[1])) {
$rq->addRawQueryString($uri[1]);
}
if (isset($proxy_params['proxy_host']) &&
isset($proxy_params['proxy_port']) &&
isset($proxy_params['proxy_user']) &&
isset($proxy_params['proxy_pass'])) {
$rq->setProxy($proxy_params['proxy_host'], $proxy_params['proxy_port'],
$proxy_params['proxy_user'], $proxy_params['proxy_pass']);
} elseif (isset($proxy_params['proxy_host']) &&
isset($proxy_params['proxy_port'])) {
$rq->setProxy($proxy_params['proxy_host'], $proxy_params['proxy_port']);
}
$result = $rq->sendRequest();
if (PEAR::isError($result)) {
return $this->_raiseSoapFault("Unable to retrieve WSDL $wsdl_fname," . $rq->getResponseCode(), $wsdl_fname);
}
$file_data = $rq->getResponseBody();
if (!$file_data) {
return $this->_raiseSoapFault("Unable to retrieve WSDL $wsdl_fname, no http body", $wsdl_fname);
}
}
$md5_wsdl = md5($file_data);
if ($this->_cacheUse) {
$fp = fopen($cachename, "wb");
fwrite($fp, $file_data);
fclose($fp);
}
}
if ($this->_cacheUse && $cache && $cache != $md5_wsdl) {
return $this->_raiseSoapFault("WSDL Checksum error!", $wsdl_fname);
}
return $file_data;
}

+ Here is the call graph for this function:

ilBMFWSDL_Cache::ilBMFWSDL_Cache (   $cacheUse = WSDL_CACHE_USE,
  $cacheMaxAge = WSDL_CACHE_MAX_AGE 
)

ilBMFWSDL_Cache constructor

Parameters
booleanuse caching
intcache max lifetime (in seconds) public

Definition at line 898 of file class.ilBMFWSDL.php.

References ilBMFBase\ilBMFBase().

{
parent::ilBMFBase('WSDLCACHE');
$this->_cacheUse = $cacheUse;
$this->_cacheMaxAge = $cacheMaxAge;
}

+ Here is the call graph for this function:

Field Documentation

ilBMFWSDL_Cache::$_cacheMaxAge = null

Definition at line 889 of file class.ilBMFWSDL.php.

ilBMFWSDL_Cache::$_cacheUse = null

Definition at line 882 of file class.ilBMFWSDL.php.


The documentation for this class was generated from the following file: