ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilBMFBase Class Reference
+ Inheritance diagram for ilBMFBase:
+ Collaboration diagram for ilBMFBase:

Public Member Functions

 ilBMFBase ($faultcode='Client')
 Constructor. More...
 
 _resetNamespaces ()
 
 _setSchemaVersion ($schemaVersion)
 Sets the schema version used in the SOAP message. More...
 
 _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. More...
 
 _multiArrayType (&$value, &$type, &$size, &$xml)
 
 _isBase64 (&$value)
 Returns whether a string is base64 encoded data. More...
 
 _isBase64Type ($type)
 Returns whether a type is a base64 type. More...
 
 _isHash (&$a)
 Returns whether an array is a hash. More...
 
 _un_htmlentities ($string)
 
_decode (&$soapval)
 
 _makeEnvelope (&$method, &$headers, $encoding=SOAP_DEFAULT_ENCODING, $options=array())
 Creates the SOAP envelope with the SOAP envelop data. More...
 
 _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. More...
 
_raiseSoapFault ($str, $detail='', $actorURI='', $code=null, $mode=null, $options=null, $skipmsg=false)
 Raises a SOAP error. More...
 
 __isfault ()
 
__getfault ()
 
 _debug ($string)
 Adds a string to the debug data. More...
 
- Public Member Functions inherited from PEAR
 PEAR ($error_class=null)
 Constructor. More...
 
 _PEAR ()
 Destructor (the emulated type of...). More...
 
getStaticProperty ($class, $var)
 If you have a class that's mostly/entirely static, and you need static properties, you can use this method to simulate them. More...
 
 registerShutdownFunc ($func, $args=array())
 Use this function to register a shutdown method for static classes. More...
 
 isError ($data, $code=null)
 Tell whether a value is a PEAR error. More...
 
 setErrorHandling ($mode=null, $options=null)
 Sets how errors generated by this object should be handled. More...
 
 expectError ($code=' *')
 This method is used to tell which errors you expect to get. More...
 
 popExpect ()
 This method pops one element off the expected error codes stack. More...
 
 _checkDelExpect ($error_code)
 This method checks unsets an error code if available. More...
 
 delExpect ($error_code)
 This method deletes all occurences of the specified element from the expected error codes stack. More...
 
raiseError ($message=null, $code=null, $mode=null, $options=null, $userinfo=null, $error_class=null, $skipmsg=false)
 This method is a wrapper that returns an instance of the configured error class with this object's default error handling applied. More...
 
throwError ($message=null, $code=null, $userinfo=null)
 Simpler form of raiseError with fewer options. More...
 
 staticPushErrorHandling ($mode, $options=null)
 
 staticPopErrorHandling ()
 
 pushErrorHandling ($mode, $options=null)
 Push a new error handler on top of the error handler options stack. More...
 
 popErrorHandling ()
 Pop the last error handler used. More...
 
 loadExtension ($ext)
 OS independant PHP extension load. More...
 

Data Fields

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

Detailed Description

Definition at line 248 of file class.ilBMFBase.php.

Member Function Documentation

◆ __set_type_translation()

ilBMFBase::__set_type_translation (   $type,
  $class = null 
)

Definition at line 1416 of file class.ilBMFBase.php.

1417 {
1418 $tq =& new QName($type);
1419 if (!$class) {
1420 $class = $tq->name;
1421 }
1422 $this->_type_translation[$type]=$class;
1423 }

◆ _decode()

& ilBMFBase::_decode ( $soapval)

Definition at line 1085 of file class.ilBMFBase.php.

1086 {
1087 global $SOAP_OBJECT_STRUCT;
1088
1089 if (!$this->_isSoapValue($soapval)) {
1090 return $soapval;
1091 } elseif (is_array($soapval->value)) {
1092 if ($SOAP_OBJECT_STRUCT && $soapval->type != 'Array') {
1093 $classname = $this->_defaultObjectClassname;
1094 if (isset($this->_type_translation[$soapval->tqn->fqn()])) {
1095 // This will force an error in PHP if the class does not
1096 // exist.
1097 $classname = $this->_type_translation[$soapval->tqn->fqn()];
1098 } elseif (isset($this->_type_translation[$soapval->type])) {
1099 // This will force an error in PHP if the class does not
1100 // exist.
1101 $classname = $this->_type_translation[$soapval->type];
1102 } elseif ($this->_auto_translation) {
1103 if (class_exists($soapval->type)) {
1104 $classname = $soapval->type;
1105 } elseif ($this->_wsdl) {
1106 $t = $this->_wsdl->getComplexTypeNameForElement($soapval->name, $soapval->namespace);
1107 if ($t && class_exists($t)) {
1108 $classname = $t;
1109 }
1110 }
1111 }
1112 $return =& new $classname;
1113 } else {
1114 $return = array();
1115 }
1116
1117 $counter = 1;
1118 $isstruct = !$SOAP_OBJECT_STRUCT || !is_array($return);
1119 foreach ($soapval->value as $item) {
1120 if (is_object($return)) {
1121 if ($this->_wsdl) {
1122 // Get this child's WSDL information.
1123 // /$soapval->ns/$soapval->type/$item->ns/$item->name
1124 $child_type = $this->_wsdl->getComplexTypeChildType(
1125 $soapval->namespace,
1126 $soapval->name,
1127 $item->namespace,
1128 $item->name);
1129 if ($child_type) {
1130 $item->type = $child_type;
1131 }
1132 }
1133 if (!$isstruct || $item->type == 'Array') {
1134 if (isset($return->{$item->name}) &&
1135 is_object($return->{$item->name})) {
1136 $return->{$item->name} =& $this->_decode($item);
1137 } elseif (isset($return->{$item->name}) &&
1138 is_array($return->{$item->name})) {
1139 $return->{$item->name}[] = $this->_decode($item);
1140 } elseif (is_array($return)) {
1141 $return[] =& $this->_decode($item);
1142 } else {
1143 $return->{$item->name} =& $this->_decode($item);
1144 }
1145 } elseif (isset($return->{$item->name})) {
1146 $isstruct = false;
1147 if (count(get_object_vars($return)) == 1) {
1148 $d =& $this->_decode($item);
1149 $return = array($return->{$item->name}, $d);
1150 } else {
1151 $d =& $this->_decode($item);
1152 $return->{$item->name} = array($return->{$item->name}, $d);
1153 }
1154 } else {
1155 $return->{$item->name} =& $this->_decode($item);
1156 }
1157 // Set the attributes as members in the class.
1158 if (method_exists($return, '__set_attribute')) {
1159 foreach ($soapval->attributes as $key => $value) {
1160 call_user_func_array(array(&$return,
1161 '__set_attribute'),
1162 array($key, $value));
1163 }
1164 }
1165 } else {
1166 if ($soapval->arrayType && $this->_isSoapValue($item)) {
1167 if ($this->_isBase64Type($item->type) &&
1168 !$this->_isBase64Type($soapval->arrayType)) {
1169 // Decode the value if we're losing the base64
1170 // type information.
1171 $item->value = base64_decode($item->value);
1172 }
1173 $item->type = $soapval->arrayType;
1174 }
1175 if (!$isstruct) {
1176 $return[] = $this->_decode($item);
1177 } elseif (isset($return[$item->name])) {
1178 $isstruct = false;
1179 $d =& $this->_decode($item);
1180 $return = array($return[$item->name], $d);
1181 } else {
1182 $return[$item->name] = $this->_decode($item);
1183 }
1184 }
1185 }
1186
1187 return $return;
1188 }
1189
1190 if ($soapval->type == 'boolean') {
1191 if ($soapval->value != '0' &&
1192 strcasecmp($soapval->value, 'false') != 0) {
1193 $soapval->value = true;
1194 } else {
1195 $soapval->value = false;
1196 }
1197 } elseif ($soapval->type &&
1198 isset($this->_typemap[SOAP_XML_SCHEMA_VERSION][$soapval->type])) {
1199 // If we can, set variable type.
1200 settype($soapval->value,
1201 $this->_typemap[SOAP_XML_SCHEMA_VERSION][$soapval->type]);
1202 }
1203
1204 if ($this->_isBase64Type($soapval->type)) {
1205 return base64_decode($soapval->value);
1206 } else {
1207 return $soapval->value;
1208 }
1209 }
const SOAP_XML_SCHEMA_VERSION
_isBase64Type($type)
Returns whether a type is a base64 type.
$_defaultObjectClassname
Default class name to use for decoded response objects.
_isSoapValue(&$value)
& _decode(&$soapval)

References $_defaultObjectClassname, $t, _decode(), and _isSoapValue().

Referenced by _decode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _decodeDIMEMessage()

ilBMFBase::_decodeDIMEMessage ( $data,
$headers,
$attachments 
)

Definition at line 1380 of file class.ilBMFBase.php.

1381 {
1382 global $SOAP_options;
1383
1384 if (!isset($SOAP_options['DIME'])) {
1385 $this->_raiseSoapFault('DIME Unsupported, install PEAR::Net::DIME', '', '', 'Server');
1386 return;
1387 }
1388
1389 // This SHOULD be moved to the transport layer, e.g. PHP itself should
1390 // handle parsing DIME ;)
1391 $dime =& new Net_DIME_Message();
1392 $err = $dime->decodeData($data);
1393 if (PEAR::isError($err)) {
1394 $this->_raiseSoapFault('Failed to decode the DIME message!', '', '', 'Server');
1395 return;
1396 }
1397 if (strcasecmp($dime->parts[0]['type'], SOAP_ENVELOP) != 0) {
1398 $this->_raiseSoapFault('DIME record 1 is not a SOAP envelop!', '', '', 'Server');
1399 return;
1400 }
1401
1402 $data = $dime->parts[0]['data'];
1403 // Fake it for now.
1404 $headers['content-type'] = 'text/xml';
1405 $c = count($dime->parts);
1406 for ($i = 0; $i < $c; $i++) {
1407 $part =& $dime->parts[$i];
1408 // We need to handle URI's better.
1409 $id = strncmp($part['id'], 'cid:', 4)
1410 ? 'cid:' . $part['id']
1411 : $part['id'];
1412 $attachments[$id] = $part['data'];
1413 }
1414 }
isError($data, $code=null)
Tell whether a value is a PEAR error.
Definition: PEAR.php:279
const SOAP_ENVELOP
& _raiseSoapFault($str, $detail='', $actorURI='', $code=null, $mode=null, $options=null, $skipmsg=false)
Raises a SOAP error.
$data

References $data, PEAR\isError(), and SOAP_ENVELOP.

Referenced by ilBMFTransport_HTTP\_parseResponse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _decodeMimeMessage()

ilBMFBase::_decodeMimeMessage ( $data,
$headers,
$attachments 
)

Definition at line 1330 of file class.ilBMFBase.php.

1331 {
1332 global $SOAP_options;
1333
1334 if (!isset($SOAP_options['Mime'])) {
1335 $this->_raiseSoapFault('Mime Unsupported, install PEAR::Mail::Mime', '', '', 'Server');
1336 return;
1337 }
1338
1339 $params['include_bodies'] = true;
1340 $params['decode_bodies'] = true;
1341 $params['decode_headers'] = true;
1342
1343 // Lame thing to have to do for decoding.
1344 $decoder =& new Mail_mimeDecode($data);
1345 $structure = $decoder->decode($params);
1346
1347 if (isset($structure->body)) {
1348 $data = $structure->body;
1349 $headers = $structure->headers;
1350
1351 return;
1352 } elseif (isset($structure->parts)) {
1353 $data = $structure->parts[0]->body;
1354 $headers = array_merge($structure->headers,
1355 $structure->parts[0]->headers);
1356 if (count($structure->parts) > 1) {
1357 $mime_parts = array_splice($structure->parts,1);
1358 // Prepare the parts for the SOAP parser.
1359
1360 $c = count($mime_parts);
1361 for ($i = 0; $i < $c; $i++) {
1362 $p =& $mime_parts[$i];
1363 if (isset($p->headers['content-location'])) {
1364 // TODO: modify location per SwA note section 3
1365 // http://www.w3.org/TR/SOAP-attachments
1366 $attachments[$p->headers['content-location']] = $p->body;
1367 } else {
1368 $cid = 'cid:' . substr($p->headers['content-id'], 1, -1);
1369 $attachments[$cid] = $p->body;
1370 }
1371 }
1372 }
1373
1374 return;
1375 }
1376
1377 $this->_raiseSoapFault('Mime parsing error', '', '', 'Server');
1378 }
$params
Definition: example_049.php:96

References $data, and $params.

Referenced by ilBMFTransport_HTTP\_parseResponse().

+ Here is the caller graph for this function:

◆ _getNamespaceForPrefix()

ilBMFBase::_getNamespaceForPrefix (   $prefix)

Definition at line 412 of file class.ilBMFBase.php.

413 {
414 $flipped = array_flip($this->_namespaces);
415 if (isset($flipped[$prefix])) {
416 return $flipped[$prefix];
417 }
418 return null;
419 }

Referenced by ilBMFParser\startElement().

+ Here is the caller graph for this function:

◆ _getNamespacePrefix()

ilBMFBase::_getNamespacePrefix (   $ns)

Definition at line 399 of file class.ilBMFBase.php.

400 {
401 if ($this->_namespace && $ns == $this->_namespace) {
402 return '';
403 }
404 if (isset($this->_namespaces[$ns])) {
405 return $this->_namespaces[$ns];
406 }
407 $prefix = 'ns' . count($this->_namespaces);
408 $this->_namespaces[$ns] = $prefix;
409 return $prefix;
410 }

Referenced by _serializeValue(), and ilBMFParser\startElement().

+ Here is the caller graph for this function:

◆ _getType()

ilBMFBase::_getType ( $value)

Converts a PHP type to a SOAP type.

@access private

Parameters
string$valueThe value to inspect.
Returns
string The value's SOAP type.

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

874 {
875 global $SOAP_OBJECT_STRUCT, $SOAP_RAW_CONVERT;
876
877 $type = gettype($value);
878 switch ($type) {
879 case 'object':
880 if (is_a($value, 'ilbmfvalue')) {
881 $type = $value->type;
882 } else {
883 $type = 'Struct';
884 }
885 break;
886
887 case 'array':
888 // Hashes are always handled as structs.
889 if ($this->_isHash($value)) {
890 $type = 'Struct';
891 } else {
892 $ar_size = count($value);
893 reset($value);
894 $key1 = key($value);
895 if ($ar_size > 0 && is_a($key1, 'ilBMFValue')) {
896 // FIXME: for non-wsdl structs that are all the same type
897 $key2 = key($value);
898 if ($ar_size > 1 &&
899 $this->_isSoapValue($key1) &&
900 $this->_isSoapValue($key2) &&
901 $key1->name != $key2->name) {
902 // This is a struct, not an array.
903 $type = 'Struct';
904 } else {
905 $type = 'Array';
906 }
907 } else {
908 $type = 'Array';
909 }
910 }
911 break;
912
913 case 'integer':
914 case 'long':
915 $type = 'int';
916 break;
917
918 case 'boolean':
919 break;
920
921 case 'double':
922 // double is deprecated in PHP 4.2 and later.
923 $type = 'decimal';
924 break;
925
926 case 'null':
927 $type = '';
928 break;
929
930 case 'string':
931/* Databay: Changes for BMF */
932/* if ($SOAP_RAW_CONVERT) {
933 if (is_numeric($value)) {
934 if (strstr($value, '.')) {
935 $type = 'float';
936 } else {
937 $type = 'int';
938 }
939 } else {
940 if (ilBMFType_hexBinary::is_hexbin($value)) {
941 $type = 'hexBinary';
942 } else {
943 if ($this->_isBase64($value)) {
944 $type = 'base64Binary';
945 } else {
946 $dt =& new ilBMFType_dateTime($value);
947 if ($dt->toUnixtime() != -1) {
948 $type = 'dateTime';
949 }
950 }
951 }
952 }
953 }
954 break;*/
955 if ($SOAP_RAW_CONVERT) {
956 if (is_numeric($value)) {
957 if (strstr($value,'.')) $type = 'float';
958 else $type = 'int';
959 } else
960 if (ilBMFType_hexBinary::is_hexbin($value)) {
961 $type = 'hexBinary';
962 } else
963 if ($this->_isBase64($value)) {
964 $type = 'base64Binary';
965 } else {
966 $dt =& new ilBMFType_dateTime($value);
967 if ($dt->toUnixtime() != -1) {
968 $type = 'dateTime';
969 #$value = $dt->toSOAP();
970 }
971 }
972 } else {
973 $dt =& new ilBMFType_dateTime($value);
974 if ($dt->toUnixtime() != -1) {
975 $type = 'dateTime';
976 #$value = $dt->toSOAP();
977 }
978 }
979
980 default:
981 break;
982 }
983
984 return $type;
985 }
_isBase64(&$value)
Returns whether a string is base64 encoded data.
_isHash(&$a)
Returns whether an array is a hash.

References _isBase64(), _isHash(), _isSoapValue(), and ilBMFType_hexBinary\is_hexbin().

Referenced by _multiArrayType(), and _serializeValue().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _isBase64()

ilBMFBase::_isBase64 ( $value)

Returns whether a string is base64 encoded data.

Parameters
string$valueThe string to check.
Returns
boolean True if the specified value seems to be base64 encoded.

Definition at line 1026 of file class.ilBMFBase.php.

1027 {
1028 $l = strlen($value);
1029 if ($l) {
1030 return $value[$l - 1] == '=' &&
1031 preg_match('/[A-Za-z=\/\+]+/', $value);
1032 }
1033 return false;
1034 }
global $l
Definition: afr.php:30

References $l.

Referenced by _getType().

+ Here is the caller graph for this function:

◆ _isBase64Type()

ilBMFBase::_isBase64Type (   $type)

Returns whether a type is a base64 type.

Parameters
string$typeA type name.
Returns
boolean True if the type name is a base64 type.

Definition at line 1043 of file class.ilBMFBase.php.

1044 {
1045 return $type == 'base64' || $type == 'base64Binary';
1046 }

◆ _isHash()

ilBMFBase::_isHash ( $a)

Returns whether an array is a hash.

Parameters
array$aAn array to check.
Returns
boolean True if the specified array is a hash.

Definition at line 1055 of file class.ilBMFBase.php.

1056 {
1057 // I really dislike having to loop through this in PHP code, really
1058 // large arrays will be slow. We need a C function to do this.
1059 $names = array();
1060 $it = 0;
1061 foreach ($a as $k => $v) {
1062 // Checking the type is faster than regexp.
1063 $t = gettype($k);
1064 if ($t != 'integer') {
1065 return true;
1066 } elseif ($this->_isSoapValue($v)) {
1067 $names[$v->name] = 1;
1068 }
1069 // If someone has a large hash they should really be defining the
1070 // type.
1071 if ($it++ > 10) {
1072 return false;
1073 }
1074 }
1075 return count($names)>1;
1076 }

References $t, and _isSoapValue().

Referenced by _getType().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _isSoapValue()

ilBMFBase::_isSoapValue ( $value)

Definition at line 421 of file class.ilBMFBase.php.

422 {
423 return is_a($value, 'ilBMFValue');
424 }

Referenced by _decode(), _getType(), _isHash(), and _serializeValue().

+ Here is the caller graph for this function:

◆ _makeDIMEMessage()

ilBMFBase::_makeDIMEMessage (   $xml)

Definition at line 1302 of file class.ilBMFBase.php.

1303 {
1304 global $SOAP_options;
1305
1306 if (!isset($SOAP_options['DIME'])) {
1307 return $this->_raiseSoapFault('DIME is not installed');
1308 }
1309
1310 // Encode any attachments.
1311 // See http://search.ietf.org/internet-drafts/draft-nielsen-dime-soap-00.txt
1312 // Now we have to DIME encode the message
1313 $dime =& new Net_DIME_Message();
1314 $msg = $dime->encodeData($xml, SOAP_ENVELOP, null, NET_DIME_TYPE_URI);
1315
1316 // Add the attachments.
1317 $c = count($this->__attachments);
1318 for ($i = 0; $i < $c; $i++) {
1319 $attachment =& $this->__attachments[$i];
1320 $msg .= $dime->encodeData($attachment['body'],
1321 $attachment['content_type'],
1322 $attachment['cid'],
1323 NET_DIME_TYPE_MEDIA);
1324 }
1325 $msg .= $dime->endMessage();
1326
1327 return $msg;
1328 }

References SOAP_ENVELOP.

◆ _makeEnvelope()

ilBMFBase::_makeEnvelope ( $method,
$headers,
  $encoding = SOAP_DEFAULT_ENCODING,
  $options = array() 
)

Creates the SOAP envelope with the SOAP envelop data.

@access private

Parameters

param array $headers

Parameters
string$encoding
array$options
Returns
string

Definition at line 1223 of file class.ilBMFBase.php.

1226 {
1227 $smsg = $header_xml = $ns_string = '';
1228
1229 if ($headers) {
1230 $c = count($headers);
1231 for ($i = 0; $i < $c; $i++) {
1232 $header_xml .= $headers[$i]->serialize($this);
1233 }
1234 $header_xml = "<SOAP-ENV:Header>\r\n$header_xml\r\n</SOAP-ENV:Header>\r\n";
1235 }
1236
1237 if (!isset($options['input']) || $options['input'] == 'parse') {
1238 if (is_array($method)) {
1239 $c = count($method);
1240 for ($i = 0; $i < $c; $i++) {
1241 $smsg .= $method[$i]->serialize($this);
1242 }
1243 } else {
1244 $smsg = $method->serialize($this);
1245 }
1246 } else {
1247 $smsg = $method;
1248 }
1249 $body = "<SOAP-ENV:Body>\r\n" . $smsg . "\r\n</SOAP-ENV:Body>\r\n";
1250
1251 foreach ($this->_namespaces as $k => $v) {
1252 $ns_string .= " xmlns:$v=\"$k\"\r\n";
1253 }
1254 if ($this->_namespace) {
1255 $ns_string .= " xmlns=\"{$this->_namespace}\"\r\n";
1256 }
1257
1258 /* If 'use' == 'literal', we do not put in the encodingStyle. This is
1259 * denoted by $this->_section5 being false. 'use' can be defined at a
1260 * more granular level than we are dealing with here, so this does not
1261 * work for all services. */
1262 $xml = "<?xml version=\"1.0\" encoding=\"$encoding\"?>\r\n\r\n".
1263 "<SOAP-ENV:Envelope $ns_string".
1264 ($this->_section5 ? ' SOAP-ENV:encodingStyle="' . SOAP_SCHEMA_ENCODING . '"' : '').
1265 ">\r\n".
1266 "$header_xml$body</SOAP-ENV:Envelope>\r\n";
1267
1268 return $xml;
1269 }
const SOAP_SCHEMA_ENCODING
if(!is_array($argv)) $options

References $options, and SOAP_SCHEMA_ENCODING.

Referenced by ilBMFTransport_SMTP\send().

+ Here is the caller graph for this function:

◆ _makeMimeMessage()

ilBMFBase::_makeMimeMessage ( $xml,
  $encoding = SOAP_DEFAULT_ENCODING 
)

Definition at line 1271 of file class.ilBMFBase.php.

1272 {
1273 global $SOAP_options;
1274
1275 if (!isset($SOAP_options['Mime'])) {
1276 return $this->_raiseSoapFault('Mime is not installed');
1277 }
1278
1279 // Encode any attachments.
1280 // See http://www.w3.org/TR/SOAP-attachments
1281 // Now we have to mime encode the message.
1282 $params = array('content_type' => 'multipart/related; type=text/xml');
1283 $msg =& new Mail_mimePart('', $params);
1284
1285 // Add the xml part.
1286 $params['content_type'] = 'text/xml';
1287 $params['charset'] = $encoding;
1288 $params['encoding'] = 'base64';
1289 $msg->addSubPart($xml, $params);
1290
1291 // Add the attachements
1292 $c = count($this->__attachments);
1293 for ($i = 0; $i < $c; $i++) {
1294 $attachment =& $this->__attachments[$i];
1295 $msg->addSubPart($attachment['body'], $attachment);
1296 }
1297
1298 return $msg->encode();
1299 }

References $params.

◆ _multiArrayType()

ilBMFBase::_multiArrayType ( $value,
$type,
$size,
$xml 
)

Definition at line 987 of file class.ilBMFBase.php.

988 {
989 $sz = count($value);
990 if (is_array($value)) {
991 // Seems we have a multi dimensional array, figure it out if we
992 // do.
993 $c = count($value);
994 for ($i = 0; $i < $c; $i++) {
995 $this->_multiArrayType($value[$i], $type, $size, $xml);
996 }
997
998 if ($size) {
999 $size = $sz. ',' . $size;
1000 } else {
1001 $size = $sz;
1002 }
1003
1004 return 1;
1005 } else {
1006 if (is_object($value)) {
1007 $type = $value->type;
1008 $xml .= $value->serialize($this);
1009 } else {
1010 $type = $this->_getType($value);
1011 $xml .= $this->_serializeValue($value, 'item', $type);
1012 }
1013 }
1014 $size = null;
1015
1016 return 1;
1017 }
$size
Definition: RandomTest.php:79
_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)

References $size, _getType(), _multiArrayType(), and _serializeValue().

Referenced by _multiArrayType(), and _serializeValue().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _resetNamespaces()

ilBMFBase::_resetNamespaces ( )

Definition at line 370 of file class.ilBMFBase.php.

371 {
372 $this->_namespaces = array(
373 'http://schemas.xmlsoap.org/soap/envelope/' => 'SOAP-ENV',
374 'http://www.w3.org/2001/XMLSchema' => 'xsd',
375 'http://www.w3.org/2001/XMLSchema-instance' => 'xsi',
376 'http://schemas.xmlsoap.org/soap/encoding/' => 'SOAP-ENC');
377 }

Referenced by ilBMFBase().

+ Here is the caller graph for this function:

◆ _serializeValue()

ilBMFBase::_serializeValue ( $value,
  $name = '',
  $type = false,
  $elNamespace = NULL,
  $typeNamespace = NULL,
  $options = array(),
  $attributes = array(),
  $artype = '',
  $OBJTypeNS = array() 
)

Definition at line 426 of file class.ilBMFBase.php.

427 {
428 $namespaces = array();
429 $arrayType = $array_depth = $xmlout_value = null;
430 $typePrefix = $elPrefix = $xmlout_offset = $xmlout_arrayType = $xmlout_type = $xmlns = '';
431 $ptype = $array_type_ns = '';
432
433 if (!$name || is_numeric($name)) {
434 $name = 'item';
435 }
436
437 if ($this->_wsdl)
438 list($ptype, $arrayType, $array_type_ns, $array_depth)
439 = $this->_wsdl->getSchemaType($type, $name, $typeNamespace);
440
441 if (!$arrayType) $arrayType = $artype;
442 if (!$ptype) $ptype = $this->_getType($value);
443 if (!$type) $type = $ptype;
444
445 if (strcasecmp($ptype,'Struct') == 0 || strcasecmp($type,'Struct') == 0) {
446 // struct
447 $vars = NULL;
448 if (is_object($value)) {
449 $vars = get_object_vars($value);
450 } else {
451 $vars = &$value;
452 }
453 if (is_array($vars)) {
454 foreach (array_keys($vars) as $k) {
455 if ($k[0]=='_') continue; // hide private vars
456 if (is_object($vars[$k])) {
457 if (is_a($vars[$k],'ilbmfvalue')) {
458 $xmlout_value .= $vars[$k]->serialize($this);
459 } else {
460 // XXX get the members and serialize them instead
461 // converting to an array is more overhead than we
462 // should realy do, but php-soap is on it's way.
463 $objarr = get_object_vars ( $vars[$k] );
464 if (!isset ($objarr['OBJTypeNS'])) {
465 $xmlout_value .= $this->_serializeValue(get_object_vars($vars[$k]), $k, false, $this->_section5?NULL:$elNamespace, NULL, NULL, NULL, NULL);
466 } else {
467 $xmlout_value .= $this->_serializeValue(get_object_vars($vars[$k]), $k, false, $this->_section5?NULL:$elNamespace, NULL, NULL, NULL, NULL, $objarr['OBJTypeNS']);
468 }
469 }
470 } else {
471 if ($k != 'OBJTypeNS') {
472 $xmlout_value .= $this->_serializeValue($vars[$k],$k, false, $this->_section5?NULL:$elNamespace);
473 }
474 }
475 }
476 }
477 } else if (strcasecmp($ptype,'Array')==0 || strcasecmp($type,'Array')==0) {
478 // array
479 $typeNamespace = SOAP_SCHEMA_ENCODING;
480 $orig_type = $type;
481 $type = 'Array';
482 $numtypes = 0;
483 // XXX this will be slow on larger array's. Basicly, it flattens array's to allow us
484 // to serialize multi-dimensional array's. We only do this if arrayType is set,
485 // which will typicaly only happen if we are using WSDL
486 if (isset($options['flatten']) || ($arrayType && (strchr($arrayType,',') || strstr($arrayType,'][')))) {
487 $numtypes = $this->_multiArrayType($value, $arrayType, $ar_size, $xmlout_value);
488 }
489
490 $array_type = $array_type_prefix = '';
491 if ($numtypes != 1) {
492 $arrayTypeQName =& new QName($arrayType);
493 $arrayType = $arrayTypeQName->name;
494 $array_types = array();
495 $array_val = NULL;
496
497 // serialize each array element
498 $ar_size = count($value);
499 foreach ($value as $array_val) {
500 if ($this->_isSoapValue($array_val)) {
501 $array_type = $array_val->type;
502 $array_types[$array_type] = 1;
503 $array_type_ns = $array_val->type_namespace;
504 $xmlout_value .= $array_val->serialize($this);
505 } else {
506 $array_type = $this->_getType($array_val);
507 $array_types[$array_type] = 1;
508 $objarr = get_object_vars ( $array_val );
509 if (isset($objarr['OBJTypeNS'])) {
510 $tmp_arr['item'] = $objarr['OBJTypeNS']['item'];
511 $xmlout_value .= $this->_serializeValue($array_val,'item', $array_type, $elNamespace, NULL, NULL, NULL, NULL, $tmp_arr);
512 } else {
513 $xmlout_value .= $this->_serializeValue($array_val,'item', $array_type, $elNamespace);
514 }
515 }
516 }
517
518 $xmlout_offset = " SOAP-ENC:offset=\"[0]\"";
519 if (!$arrayType) {
520 $numtypes = count($array_types);
521 if ($numtypes == 1) $arrayType = $array_type;
522 // using anyType is more interoperable
523 if ($array_type == 'Struct') {
524 $array_type = '';
525 } else if ($array_type == 'Array') {
526 $arrayType = 'anyType';
527 $array_type_prefix = 'xsd';
528 } else
529 if (!$arrayType) $arrayType = $array_type;
530 }
531 }
532 if (!$arrayType || $numtypes > 1) {
533 $arrayType = 'xsd:anyType'; // should reference what schema we're using
534 } else {
535 if ($array_type_ns) {
536 $array_type_prefix = $this->_getNamespacePrefix($array_type_ns);
537 } else if (array_key_exists($arrayType, $this->_typemap[$this->_XMLSchemaVersion])) {
538 $array_type_prefix = $this->_namespaces[$this->_XMLSchemaVersion];
539 }
540 if ($array_type_prefix)
541 $arrayType = $array_type_prefix.':'.$arrayType;
542 }
543
544 if (isset($value[0]->OBJTypeNS)) {
545 $xmlout_arrayType = ' xmlns:' . $value[0]->OBJTypeNS['nsPrefix'] . '="' . $value[0]->OBJTypeNS['namespace'] . '" xsi:type="' . $value[0]->OBJTypeNS['nsPrefix'] . ':Array" ' . $value[0]->OBJTypeNS['nsPrefix'] . ':arrayType="' . $value[0]->OBJTypeNS['pnsPrefix'] . ':' . get_class($value[0]);
546 $xmlout_type = $xmlns = $xmlout_offset = $xml_attr = $arrayType = '';
547 } else {
548 $xmlout_arrayType = " SOAP-ENC:arrayType=\"" . $arrayType;
549 }
550 if ($array_depth != null) {
551 for ($i = 0; $i < $array_depth; $i++) {
552 $xmlout_arrayType .= '[]';
553 }
554 }
555 $xmlout_arrayType .= "[$ar_size]\"";
556 } else if ($this->_isSoapValue($value)) {
557 $xmlout_value =& $value->serialize($this);
558 } else if ($type == 'string') {
559 $xmlout_value = htmlspecialchars($value);
560 } else if ($type == 'rawstring') {
561 $xmlout_value =& $value;
562 } else if ($type == 'boolean') {
563 $xmlout_value = $value?'true':'false';
564 } else {
565 $xmlout_value =& $value;
566 }
567
568 // add namespaces
569 if ($elNamespace) {
570 $elPrefix = $this->_getNamespacePrefix($elNamespace);
571 $xmlout_name = "$elPrefix:$name";
572 } else {
573 $xmlout_name = $name;
574 }
575
576 if ($typeNamespace) {
577 $typePrefix = $this->_getNamespacePrefix($typeNamespace);
578 $xmlout_type = "$typePrefix:$type";
579 } else if ($type && array_key_exists($type, $this->_typemap[$this->_XMLSchemaVersion])) {
580 $typePrefix = $this->_namespaces[$this->_XMLSchemaVersion];
581 $xmlout_type = "$typePrefix:$type";
582 }
583
584 // handle additional attributes
585 $xml_attr = '';
586 if (count($attributes) > 0) {
587 foreach ($attributes as $k => $v) {
588 $kqn =& new QName($k);
589 $vqn =& new QName($v);
590 $xml_attr .= ' '.$kqn->fqn().'="'.$vqn->fqn().'"';
591 }
592 }
593
594 // store the attachement for mime encoding
595 if (isset($options['attachment']))
596 $this->__attachments[] = $options['attachment'];
597
598 if ($this->_section5) {
599 if ($name == 'item' && isset($OBJTypeNS['item'])) {
600 $xmlout_type = $OBJTypeNS['item'];
601 }
602
603 if ($xmlout_type) $xmlout_type = " xsi:type=\"$xmlout_type\"";
604 if (is_null($xmlout_value)) {
605 $xml = "";
606 } else {
607 if (is_array($value) && isset ($value[0]->OBJTypeNS)) {
608 $xmlout_type = '';
609 }
610 $xml = "\r\n<$xmlout_name$xmlout_type$xmlns$xmlout_arrayType$xmlout_offset$xml_attr ";
611 if (isset($OBJTypeNS['namespace']) && isset($OBJTypeNS['type'])) {
612 if (trim($OBJTypeNS['namespace']) != '' || trim($OBJTypeNS['type']) != '') {
613 if (isset($OBJTypeNS['namespace']) && $OBJTypeNS['namespace'] != '') {
614 $xml .= ' xmlns:';
615 if ( isset($OBJTypeNS['nsPrefix']))
616 $xml .= $OBJTypeNS['nsPrefix'];
617 else
618 $xml .= 'intf';
619 $xml .= '="' . $OBJTypeNS['namespace'] . '"';
620 }
621 if (isset($OBJTypeNS['type']) && $OBJTypeNS['type'] != '') {
622 $xml .= ' xsi:type="';
623 if (strpos($OBJTypeNS['type'], "xsd:") === false){
624 if (isset($OBJTypeNS['nsPrefix']))
625 $xml .= $OBJTypeNS['nsPrefix'] . ':';
626 else
627 $xml .= 'intf:';
628 }
629 $xml .= $OBJTypeNS['type'] . '"';
630 }
631 }
632 }
633 $xml .= ">" . $xmlout_value . "</$xmlout_name>";
634 }
635 } else {
636 if (is_null($xmlout_value)) {
637 $xml = "";
638 } else {
639 $xml = "\r\n<$xmlout_name$xmlns$xml_attr>".
640 $xmlout_value."</$xmlout_name>";
641 }
642 }
643 return $xml;
644 }
_getNamespacePrefix($ns)

References $_XMLSchemaVersion, $options, _getNamespacePrefix(), _getType(), _isSoapValue(), _multiArrayType(), _serializeValue(), and SOAP_SCHEMA_ENCODING.

Referenced by _multiArrayType(), and _serializeValue().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _setSchemaVersion()

ilBMFBase::_setSchemaVersion (   $schemaVersion)

Sets the schema version used in the SOAP message.

@access private

See also
$_XMLSchema
Parameters
string$schemaVersionThe schema version.

Definition at line 387 of file class.ilBMFBase.php.

388 {
389 if (!in_array($schemaVersion, $this->_XMLSchema)) {
390 return $this->_raiseSoapFault("unsuported XMLSchema $schemaVersion");
391 }
392 $this->_XMLSchemaVersion = $schemaVersion;
393 $tmpNS = array_flip($this->_namespaces);
394 $tmpNS['xsd'] = $this->_XMLSchemaVersion;
395 $tmpNS['xsi'] = $this->_XMLSchemaVersion . '-instance';
396 $this->_namespaces = array_flip($tmpNS);
397 }

References $_XMLSchemaVersion, and ilBMFBase_Object\_raiseSoapFault().

Referenced by ilBMFParser\ilBMFParser(), and ilBMFParser\startElement().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _un_htmlentities()

ilBMFBase::_un_htmlentities (   $string)

Definition at line 1078 of file class.ilBMFBase.php.

1079 {
1080 $trans_tbl = get_html_translation_table(HTML_ENTITIES);
1081 $trans_tbl = array_flip($trans_tbl);
1082 return strtr($string, $trans_tbl);
1083 }

◆ ilBMFBase()

ilBMFBase::ilBMFBase (   $faultcode = 'Client')

Constructor.

See also
$debug_data, _debug()
Parameters
string$faultcodeError code.

Definition at line 364 of file class.ilBMFBase.php.

365 {
366 parent::ilBMFBase_Object($faultcode);
367 $this->_resetNamespaces();
368 }

References _resetNamespaces().

+ Here is the call graph for this function:

Field Documentation

◆ $__attachments

ilBMFBase::$__attachments = array()

Definition at line 342 of file class.ilBMFBase.php.

◆ $_auto_translation

ilBMFBase::$_auto_translation = false

Definition at line 354 of file class.ilBMFBase.php.

◆ $_defaultObjectClassname

string ilBMFBase::$_defaultObjectClassname = 'stdClass'

Default class name to use for decoded response objects.

Definition at line 328 of file class.ilBMFBase.php.

Referenced by _decode().

◆ $_doconversion

ilBMFBase::$_doconversion = false

Definition at line 340 of file class.ilBMFBase.php.

◆ $_namespace

ilBMFBase::$_namespace

Definition at line 332 of file class.ilBMFBase.php.

◆ $_namespaces

ilBMFBase::$_namespaces

Definition at line 331 of file class.ilBMFBase.php.

◆ $_section5

boolean ilBMFBase::$_section5 = true

True if we use section 5 encoding, or false if this is literal.

Definition at line 351 of file class.ilBMFBase.php.

◆ $_type_translation

ilBMFBase::$_type_translation = array()

Definition at line 355 of file class.ilBMFBase.php.

◆ $_typemap

ilBMFBase::$_typemap

Definition at line 255 of file class.ilBMFBase.php.

◆ $_wsdl

ilBMFBase::$_wsdl = null

Definition at line 344 of file class.ilBMFBase.php.

◆ $_xmlEntities

ilBMFBase::$_xmlEntities
Initial value:
= array('&' => '&amp;',
'<' => '&lt;',
'>' => '&gt;',
"'" => '&apos;',
'"' => '&quot;')

Definition at line 334 of file class.ilBMFBase.php.

◆ $_XMLSchema

ilBMFBase::$_XMLSchema
Initial value:
= array('http://www.w3.org/2001/XMLSchema',
'http://www.w3.org/1999/XMLSchema')

Definition at line 250 of file class.ilBMFBase.php.

◆ $_XMLSchemaVersion

ilBMFBase::$_XMLSchemaVersion = 'http://www.w3.org/2001/XMLSchema'

Definition at line 252 of file class.ilBMFBase.php.

Referenced by _serializeValue(), and _setSchemaVersion().


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