47 require_once 
'PEAR.php';
 
   48 require_once dirname(__FILE__).
'/Type/class.ilBMFType_dateTime.php';
 
   49 require_once dirname(__FILE__).
'/Type/class.ilBMFType_hexBinary.php';
 
   54 @include_once 
'Mail/mimePart.php';
 
   55 @include_once 
'Mail/mimeDecode.php';
 
   56 if (class_exists(
'Mail_mimePart')) {
 
   57     $GLOBALS[
'SOAP_options'][
'Mime'] = 1;
 
   58     define(
'MAIL_MIMEPART_CRLF', 
"\r\n");
 
   61 @include_once 
'Net/DIME.php';
 
   62 if (class_exists(
'Net_DIME_Message')) {
 
   63     $GLOBALS[
'SOAP_options'][
'DIME'] = 1;
 
   74 if (!function_exists(
'version_compare') ||
 
   75     version_compare(phpversion(), 
'4.1', 
'<')) {
 
   76     die(
"requires PHP 4.1 or higher\n");
 
   78 if (version_compare(phpversion(), 
'4.1', 
'>=') &&
 
   79     version_compare(phpversion(), 
'4.2', 
'<')) {
 
   80     define(
'FLOAT', 
'double');
 
   82     define(
'FLOAT', 
'float');
 
   85 if (!defined(
'INF')) {
 
   86     define(
'INF', 1.8e307);
 
   88 if (!defined(
'NAN')) {
 
   92 define(
'SOAP_LIBRARY_VERSION', 
'0.8.0RC4');
 
   93 define(
'SOAP_LIBRARY_NAME',    
'PEAR-SOAP 0.8.0RC4-devel');
 
   96 define(
'SOAP_XML_SCHEMA_VERSION',  
'http://www.w3.org/2001/XMLSchema');
 
   97 define(
'SOAP_XML_SCHEMA_INSTANCE', 
'http://www.w3.org/2001/XMLSchema-instance');
 
   98 define(
'SOAP_XML_SCHEMA_1999',     
'http://www.w3.org/1999/XMLSchema');
 
   99 define(
'SOAP_SCHEMA',              
'http://schemas.xmlsoap.org/wsdl/soap/');
 
  100 define(
'SOAP_SCHEMA_ENCODING',     
'http://schemas.xmlsoap.org/soap/encoding/');
 
  101 define(
'SOAP_ENVELOP',             
'http://schemas.xmlsoap.org/soap/envelope/');
 
  103 define(
'SCHEMA_DISCO',             
'http://schemas.xmlsoap.org/disco/');
 
  104 define(
'SCHEMA_DISCO_SCL',         
'http://schemas.xmlsoap.org/disco/scl/');
 
  106 define(
'SCHEMA_SOAP',              
'http://schemas.xmlsoap.org/wsdl/soap/');
 
  107 define(
'SCHEMA_SOAP_HTTP',         
'http://schemas.xmlsoap.org/soap/http');
 
  108 define(
'SCHEMA_WSDL_HTTP',         
'http://schemas.xmlsoap.org/wsdl/http/');
 
  109 define(
'SCHEMA_MIME',              
'http://schemas.xmlsoap.org/wsdl/mime/');
 
  110 define(
'SCHEMA_WSDL',              
'http://schemas.xmlsoap.org/wsdl/');
 
  111 define(
'SCHEMA_DIME',              
'http://schemas.xmlsoap.org/ws/2002/04/dime/wsdl/');
 
  112 define(
'SCHEMA_CONTENT',           
'http://schemas.xmlsoap.org/ws/2002/04/content-type/');
 
  113 define(
'SCHEMA_REF',               
'http://schemas.xmlsoap.org/ws/2002/04/reference/');
 
  116 #define('SOAP_DEFAULT_ENCODING',  'UTF-8'); 
  117 define(
'SOAP_DEFAULT_ENCODING',  
'ISO-8859-1');
 
  168         $this->_myfaultcode = $faultcode;
 
  169         $this->_debug_flag = 
$GLOBALS[
'SOAP_DEBUG'];
 
  192                               $mode = null, $options = null, $skipmsg = 
false)
 
  195         $is_instance = isset($this);
 
  196         if (is_object($str)) {
 
  200                 $code = $is_instance ? $this->_myfaultcode : 
'Client';
 
  218         return $this->fault != null;
 
  233         if ($this->_debug_flag) {
 
  234             $this->_debug_data .= get_class($this) . 
': ' .
 
  235                 str_replace(
'>', 
">\r\n", $string) . 
"\n";
 
  251                             'http://www.w3.org/1999/XMLSchema');
 
  256         'http://www.w3.org/2001/XMLSchema' => array(
 
  257             'string' => 
'string',
 
  258             'boolean' => 
'boolean',
 
  262             'duration' => 
'integer',
 
  263             'dateTime' => 
'string',
 
  266             'gYearMonth' => 
'integer',
 
  267             'gYear' => 
'integer',
 
  268             'gMonthDay' => 
'integer',
 
  270             'gMonth' => 
'integer',
 
  271             'hexBinary' => 
'string',
 
  272             'base64Binary' => 
'string',
 
  274             'normalizedString' => 
'string',
 
  276             'language' => 
'string',
 
  277             'NMTOKEN' => 
'string',
 
  278             'NMTOKENS' => 
'string',
 
  280             'NCName' => 
'string',
 
  283             'IDREFS' => 
'string',
 
  284             'ENTITY' => 
'string',
 
  285             'ENTITIES' => 
'string',
 
  286             'integer' => 
'integer',
 
  287             'nonPositiveInteger' => 
'integer',
 
  288             'negativeInteger' => 
'integer',
 
  291             'short' => 
'integer',
 
  293             'nonNegativeInteger' => 
'integer',
 
  294             'unsignedLong' => 
'integer',
 
  295             'unsignedInt' => 
'integer',
 
  296             'unsignedShort' => 
'integer',
 
  297             'unsignedByte' => 
'integer',
 
  298             'positiveInteger'  => 
'integer',
 
  299             'anyType' => 
'string',
 
  300             'anyURI' => 
'string',
 
  303         'http://www.w3.org/1999/XMLSchema' => array(
 
  306             'boolean' => 
'boolean',
 
  307             'string' => 
'string',
 
  310             'dateTime' => 
'string',
 
  311             'timeInstant' => 
'string',
 
  312             'base64Binary' => 
'string',
 
  313             'base64' => 
'string',
 
  314             'ur-type' => 
'string' 
  316         'http://schemas.xmlsoap.org/soap/encoding/' => array(
 
  317             'base64' => 
'string',
 
  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');
 
  389         if (!in_array($schemaVersion, $this->_XMLSchema)) {
 
  392         $this->_XMLSchemaVersion = $schemaVersion;
 
  393         $tmpNS = array_flip($this->_namespaces);
 
  395         $tmpNS[
'xsi'] = $this->_XMLSchemaVersion . 
'-instance';
 
  396         $this->_namespaces = array_flip($tmpNS);
 
  401         if ($this->_namespace && $ns == $this->_namespace) {
 
  404         if (isset($this->_namespaces[$ns])) {
 
  405             return $this->_namespaces[$ns];
 
  407         $prefix = 
'ns' . count($this->_namespaces);
 
  408         $this->_namespaces[$ns] = $prefix;
 
  414         $flipped = array_flip($this->_namespaces);
 
  415         if (isset($flipped[$prefix])) {
 
  416             return $flipped[$prefix];
 
  423         return is_a($value, 
'ilBMFValue');
 
  426     function _serializeValue(&$value, $name = 
'', $type = 
false, $elNamespace = NULL, $typeNamespace=NULL, $options=array(), $attributes = array(), $artype=
'', $OBJTypeNS = array())
 
  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 = 
'';
 
  433         if (!$name || is_numeric($name)) {
 
  438             list($ptype, $arrayType, $array_type_ns, $array_depth)
 
  439                     = $this->_wsdl->getSchemaType($type, $name, $typeNamespace);
 
  441         if (!$arrayType) $arrayType = $artype;
 
  442         if (!$ptype) $ptype = $this->
_getType($value);
 
  443         if (!$type) $type = $ptype;
 
  445         if (strcasecmp($ptype,
'Struct') == 0 || strcasecmp($type,
'Struct') == 0) {
 
  448             if (is_object($value)) {
 
  449                 $vars = get_object_vars($value);
 
  453             if (is_array($vars)) {
 
  454                 foreach (array_keys($vars) as $k) {
 
  455                     if ($k[0]==
'_') 
continue; 
 
  456                     if (is_object($vars[$k])) {
 
  457                         if (is_a($vars[$k],
'ilbmfvalue')) {
 
  458                             $xmlout_value .= $vars[$k]->serialize($this);
 
  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);
 
  467                                 $xmlout_value .= $this->
_serializeValue(get_object_vars($vars[$k]), $k, 
false, $this->_section5?NULL:$elNamespace, NULL, NULL, NULL, NULL, $objarr[
'OBJTypeNS']);
 
  471                         if ($k != 
'OBJTypeNS') {
 
  472                             $xmlout_value .= $this->
_serializeValue($vars[$k],$k, 
false, $this->_section5?NULL:$elNamespace);
 
  477         } 
else if (strcasecmp($ptype,
'Array')==0 || strcasecmp($type,
'Array')==0) {
 
  486             if (isset($options[
'flatten']) || ($arrayType && (strchr($arrayType,
',') || strstr($arrayType,
'][')))) {
 
  487                 $numtypes = $this->
_multiArrayType($value, $arrayType, $ar_size, $xmlout_value);
 
  490             $array_type = $array_type_prefix = 
'';
 
  491             if ($numtypes != 1) {
 
  492                 $arrayTypeQName =& 
new QName($arrayType);
 
  493                 $arrayType = $arrayTypeQName->name;
 
  494                 $array_types = array();
 
  498                 $ar_size = count($value);
 
  499                 foreach ($value as $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);
 
  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);
 
  513                             $xmlout_value .= $this->
_serializeValue($array_val,
'item', $array_type, $elNamespace);
 
  518                 $xmlout_offset = 
" SOAP-ENC:offset=\"[0]\"";
 
  520                     $numtypes = count($array_types);
 
  521                     if ($numtypes == 1) $arrayType = $array_type;
 
  523                     if ($array_type == 
'Struct') {
 
  525                     } 
else if ($array_type == 
'Array') {
 
  526                         $arrayType = 
'anyType';
 
  527                         $array_type_prefix = 
'xsd';
 
  529                     if (!$arrayType) $arrayType = $array_type;
 
  532             if (!$arrayType || $numtypes > 1) {
 
  533                 $arrayType = 
'xsd:anyType'; 
 
  535                 if ($array_type_ns) {
 
  537                 } 
else if (array_key_exists($arrayType, $this->_typemap[$this->_XMLSchemaVersion])) {
 
  540                 if ($array_type_prefix)
 
  541                     $arrayType = $array_type_prefix.
':'.$arrayType;
 
  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 = 
'';
 
  548                  $xmlout_arrayType = 
" SOAP-ENC:arrayType=\"" . $arrayType;
 
  550             if ($array_depth != null) {
 
  551                 for ($i = 0; $i < $array_depth; $i++) {
 
  552                     $xmlout_arrayType .= 
'[]';
 
  555             $xmlout_arrayType .= 
"[$ar_size]\"";
 
  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';
 
  565             $xmlout_value =& $value;
 
  571             $xmlout_name = 
"$elPrefix:$name";
 
  573             $xmlout_name = $name;
 
  576         if ($typeNamespace) {
 
  578             $xmlout_type = 
"$typePrefix:$type";
 
  579         } 
else if ($type && array_key_exists($type, $this->_typemap[$this->_XMLSchemaVersion])) {
 
  581             $xmlout_type = 
"$typePrefix:$type";
 
  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().
'"';
 
  595         if (isset($options[
'attachment']))
 
  596             $this->__attachments[] = $options[
'attachment'];
 
  598         if ($this->_section5) {
 
  599             if ($name == 
'item' && isset($OBJTypeNS[
'item'])) {
 
  600                 $xmlout_type = $OBJTypeNS[
'item'];
 
  603             if ($xmlout_type) $xmlout_type = 
" xsi:type=\"$xmlout_type\"";
 
  604             if (is_null($xmlout_value)) {
 
  607                 if (is_array($value) && isset ($value[0]->OBJTypeNS)) {
 
  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'] != 
'') {
 
  615                            if ( isset($OBJTypeNS[
'nsPrefix']))
 
  616                               $xml .= $OBJTypeNS[
'nsPrefix'];
 
  619                            $xml .= 
'="' . $OBJTypeNS[
'namespace'] . 
'"';
 
  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'] . 
':';
 
  629                            $xml .= $OBJTypeNS[
'type'] . 
'"';
 
  633                 $xml .= 
">" . $xmlout_value . 
"</$xmlout_name>";
 
  636             if (is_null($xmlout_value)) {
 
  639                 $xml = 
"\r\n<$xmlout_name$xmlns$xml_attr>".
 
  640                     $xmlout_value.
"</$xmlout_name>";
 
  875         global $SOAP_OBJECT_STRUCT, $SOAP_RAW_CONVERT;
 
  877         $type = gettype($value);
 
  880             if (is_a($value, 
'ilbmfvalue')) {
 
  881                 $type = $value->type;
 
  892                 $ar_size = count($value);
 
  895                 if ($ar_size > 0 && is_a($key1, 
'ilBMFValue')) {
 
  901                         $key1->name != $key2->name) {
 
  955             if ($SOAP_RAW_CONVERT) {
 
  956                 if (is_numeric($value)) {
 
  957                     if (strstr($value,
'.')) $type = 
'float';
 
  964                     $type = 
'base64Binary';
 
  967                     if ($dt->toUnixtime() != -1) {
 
  969                         #$value = $dt->toSOAP(); 
  974                 if ($dt->toUnixtime() != -1) {
 
  976                     #$value = $dt->toSOAP(); 
  990         if (is_array($value)) {
 
  994             for ($i = 0; $i < $c; $i++) {
 
 1006             if (is_object($value)) {
 
 1007                 $type = $value->type;
 
 1008                 $xml .= $value->serialize($this);
 
 1028         $l = strlen($value);
 
 1030             return $value[$l - 1] == 
'=' &&
 
 1031                 preg_match(
'/[A-Za-z=\/\+]+/', $value);
 
 1045         return $type == 
'base64' || $type == 
'base64Binary';
 
 1061         foreach ($a as $k => $v) {
 
 1064             if (
$t != 
'integer') {
 
 1067                 $names[$v->name] = 1;
 
 1075         return count($names)>1;
 
 1080         $trans_tbl = get_html_translation_table(HTML_ENTITIES);
 
 1081         $trans_tbl = array_flip($trans_tbl);
 
 1082         return strtr($string, $trans_tbl);
 
 1087         global $SOAP_OBJECT_STRUCT;
 
 1091         } elseif (is_array($soapval->value)) {
 
 1092             if ($SOAP_OBJECT_STRUCT && $soapval->type != 
'Array') {
 
 1094                 if (isset($this->_type_translation[$soapval->tqn->fqn()])) {
 
 1097                     $classname = $this->_type_translation[$soapval->tqn->fqn()];
 
 1098                 } elseif (isset($this->_type_translation[$soapval->type])) {
 
 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)) {
 
 1112                 $return =& 
new $classname;
 
 1118             $isstruct = !$SOAP_OBJECT_STRUCT || !is_array($return);
 
 1119             foreach ($soapval->value as $item) {
 
 1120                 if (is_object($return)) {
 
 1124                         $child_type = $this->_wsdl->getComplexTypeChildType(
 
 1125                             $soapval->namespace,
 
 1130                             $item->type = $child_type;
 
 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);
 
 1143                             $return->{$item->name} =& $this->_decode($item);
 
 1145                     } elseif (isset($return->{$item->name})) {
 
 1147                         if (count(get_object_vars($return)) == 1) {
 
 1148                             $d =& $this->_decode($item);
 
 1149                             $return = array($return->{$item->name}, 
$d);
 
 1151                             $d =& $this->_decode($item);
 
 1152                             $return->{$item->name} = array($return->{$item->name}, 
$d);
 
 1155                         $return->{$item->name} =& $this->_decode($item);
 
 1158                     if (method_exists($return, 
'__set_attribute')) {
 
 1159                         foreach ($soapval->attributes as $key => $value) {
 
 1160                             call_user_func_array(array(&$return,
 
 1162                                                  array($key, $value));
 
 1166                     if ($soapval->arrayType && $this->_isSoapValue($item)) {
 
 1167                         if ($this->_isBase64Type($item->type) &&
 
 1168                             !$this->_isBase64Type($soapval->arrayType)) {
 
 1171                             $item->value = base64_decode($item->value);
 
 1173                         $item->type = $soapval->arrayType;
 
 1176                         $return[] = $this->_decode($item);
 
 1177                     } elseif (isset($return[$item->name])) {
 
 1179                         $d =& $this->_decode($item);
 
 1180                         $return = array($return[$item->name], 
$d);
 
 1182                         $return[$item->name] = $this->_decode($item);
 
 1190         if ($soapval->type == 
'boolean') {
 
 1191             if ($soapval->value != 
'0' &&
 
 1192                 strcasecmp($soapval->value, 
'false') != 0) {
 
 1193                 $soapval->value = 
true;
 
 1195                 $soapval->value = 
false;
 
 1197         } elseif ($soapval->type &&
 
 1200             settype($soapval->value,
 
 1201                     $this->_typemap[SOAP_XML_SCHEMA_VERSION][$soapval->type]);
 
 1204         if ($this->_isBase64Type($soapval->type)) {
 
 1205             return base64_decode($soapval->value);
 
 1207             return $soapval->value;
 
 1223     function _makeEnvelope(&$method, &$headers,
 
 1227         $smsg = $header_xml = $ns_string = 
'';
 
 1230             $c = count($headers);
 
 1231             for ($i = 0; $i < $c; $i++) {
 
 1232                 $header_xml .= $headers[$i]->serialize($this);
 
 1234             $header_xml = 
"<SOAP-ENV:Header>\r\n$header_xml\r\n</SOAP-ENV:Header>\r\n";
 
 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);
 
 1244                 $smsg = $method->serialize($this);
 
 1249         $body = 
"<SOAP-ENV:Body>\r\n" . $smsg . 
"\r\n</SOAP-ENV:Body>\r\n";
 
 1251         foreach ($this->_namespaces as $k => $v) {
 
 1252             $ns_string .= 
" xmlns:$v=\"$k\"\r\n";
 
 1254         if ($this->_namespace) {
 
 1255             $ns_string .= 
" xmlns=\"{$this->_namespace}\"\r\n";
 
 1262         $xml = 
"<?xml version=\"1.0\" encoding=\"$encoding\"?>\r\n\r\n".
 
 1263             "<SOAP-ENV:Envelope $ns_string".
 
 1266             "$header_xml$body</SOAP-ENV:Envelope>\r\n";
 
 1273         global $SOAP_options;
 
 1275         if (!isset($SOAP_options[
'Mime'])) {
 
 1276             return $this->_raiseSoapFault(
'Mime is not installed');
 
 1282         $params = array(
'content_type' => 
'multipart/related; type=text/xml');
 
 1283         $msg =& 
new Mail_mimePart(
'', $params);
 
 1286         $params[
'content_type'] = 
'text/xml';
 
 1287         $params[
'charset'] = $encoding;
 
 1288         $params[
'encoding'] = 
'base64';
 
 1289         $msg->addSubPart($xml, $params);
 
 1292         $c = count($this->__attachments);
 
 1293         for ($i = 0; $i < $c; $i++) {
 
 1294             $attachment =& $this->__attachments[$i];
 
 1295             $msg->addSubPart($attachment[
'body'], $attachment);
 
 1298         return $msg->encode();
 
 1302     function _makeDIMEMessage($xml)
 
 1304         global $SOAP_options;
 
 1306         if (!isset($SOAP_options[
'DIME'])) {
 
 1307             return $this->_raiseSoapFault(
'DIME is not installed');
 
 1313         $dime =& 
new Net_DIME_Message();
 
 1314         $msg = $dime->encodeData($xml, 
SOAP_ENVELOP, null, NET_DIME_TYPE_URI);
 
 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'],
 
 1323                                       NET_DIME_TYPE_MEDIA);
 
 1325         $msg .= $dime->endMessage();
 
 1330     function _decodeMimeMessage(&
$data, &$headers, &$attachments)
 
 1332         global $SOAP_options;
 
 1334         if (!isset($SOAP_options[
'Mime'])) {
 
 1335             $this->_raiseSoapFault(
'Mime Unsupported, install PEAR::Mail::Mime', 
'', 
'', 
'Server');
 
 1339         $params[
'include_bodies'] = 
true;
 
 1340         $params[
'decode_bodies']  = 
true;
 
 1341         $params[
'decode_headers'] = 
true;
 
 1344         $decoder =& 
new Mail_mimeDecode(
$data);
 
 1345         $structure = $decoder->decode($params);
 
 1347         if (isset($structure->body)) {
 
 1348             $data = $structure->body;
 
 1349             $headers = $structure->headers;
 
 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);
 
 1360                 $c = count($mime_parts);
 
 1361                 for ($i = 0; $i < $c; $i++) {
 
 1362                     $p =& $mime_parts[$i];
 
 1363                     if (isset($p->headers[
'content-location'])) {
 
 1366                         $attachments[$p->headers[
'content-location']] = $p->body;
 
 1368                         $cid = 
'cid:' . substr($p->headers[
'content-id'], 1, -1);
 
 1369                         $attachments[$cid] = $p->body;
 
 1377         $this->_raiseSoapFault(
'Mime parsing error', 
'', 
'', 
'Server');
 
 1380     function _decodeDIMEMessage(&
$data, &$headers, &$attachments)
 
 1382         global $SOAP_options;
 
 1384         if (!isset($SOAP_options[
'DIME'])) {
 
 1385             $this->_raiseSoapFault(
'DIME Unsupported, install PEAR::Net::DIME', 
'', 
'', 
'Server');
 
 1391         $dime =& 
new Net_DIME_Message();
 
 1392         $err = $dime->decodeData(
$data);
 
 1394             $this->_raiseSoapFault(
'Failed to decode the DIME message!', 
'', 
'', 
'Server');
 
 1397         if (strcasecmp($dime->parts[0][
'type'], 
SOAP_ENVELOP) != 0) {
 
 1398             $this->_raiseSoapFault(
'DIME record 1 is not a SOAP envelop!', 
'', 
'', 
'Server');
 
 1402         $data = $dime->parts[0][
'data'];
 
 1404         $headers[
'content-type'] = 
'text/xml';
 
 1405         $c = count($dime->parts);
 
 1406         for ($i = 0; $i < $c; $i++) {
 
 1407             $part =& $dime->parts[$i];
 
 1409             $id = strncmp($part[
'id'], 
'cid:', 4)
 
 1410                 ? 
'cid:' . $part[
'id']
 
 1412             $attachments[$id] = $part[
'data'];
 
 1416     function __set_type_translation($type, $class = null)
 
 1418         $tq =& 
new QName($type);
 
 1422         $this->_type_translation[$type]=$class;
 
 1443             preg_match(
'/\{(.*?)\}(.*)/', 
$name, $m);
 
 1444             $this->name = $m[2];
 
 1445             $this->
namespace = $m[1];
 
 1446         } elseif (substr_count(
$name, 
':') == 1) {
 
 1447             $s = explode(
':', 
$name);
 
 1448             $s = array_reverse($s);
 
 1449             $this->name = $s[0];
 
 1453             $this->name = 
$name;
 
 1458         $p = strpos($this->name, 
'[');
 
 1462             $this->arraySize = explode(
',', substr($this->name, $p + 1, -$p - 2));
 
 1463             $this->arrayInfo = substr($this->name, $p);
 
 1464             $this->name = substr($this->name, 0, $p);
 
 1470         if ($this->
namespace) {
 
 1471             return '{' . $this->
namespace . '}' . $this->name;
 
 1472         } elseif ($this->ns) {