Ignore:
Timestamp:
2012/01/17 16:32:25 (14 years ago)
Author:
Seasoft
Message:

2.12系へマイルストーン変更となったチケット分を差し戻し
r21326 #1536
r21325 #1528
r21324 #1547,#1546
r21323 #1546
r21322 #1543
r21321 #1536
r21320 #1536
r21319 #1544
r21318 #1521,#1522
r21317 #1431

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_11-dev/data/module/SOAP/Base.php

    r21318 r21410  
    2525 */ 
    2626 
    27 /** Define linebreak sequence for the Mail_Mime package. */ 
    2827define('MAIL_MIMEPART_CRLF', "\r\n"); 
    29  
    3028require_once 'PEAR.php'; 
    3129 
     
    3735} 
    3836 
    39 define('SOAP_LIBRARY_VERSION', '0.12.0'); 
    40 define('SOAP_LIBRARY_NAME',    'PEAR-SOAP 0.12.0-beta'); 
     37define('SOAP_LIBRARY_VERSION', '0.11.0'); 
     38define('SOAP_LIBRARY_NAME',    'PEAR-SOAP 0.11.0-beta'); 
    4139 
    4240// Set schema version. 
     
    6361define('SOAP_DEFAULT_ENCODING',  'UTF-8'); 
    6462 
    65 /** 
    66  * @package SOAP 
    67  */ 
    6863class SOAP_Base_Object extends PEAR 
    6964{ 
     
    121116        $is_instance = isset($this) && is_a($this, 'SOAP_Base_Object'); 
    122117        if (is_object($str)) { 
    123             $fault = $str; 
     118            $fault =& $str; 
    124119        } else { 
    125120            if (!$code) { 
     
    127122            } 
    128123            require_once 'SOAP/Fault.php'; 
    129             $fault = new SOAP_Fault($str, $code, $actorURI, $detail, $mode, 
    130                                     $options); 
     124            $fault =& new SOAP_Fault($str, 
     125                                     $code, 
     126                                     $actorURI, 
     127                                     $detail, 
     128                                     $mode, 
     129                                     $options); 
    131130        } 
    132131        if ($is_instance) { 
    133             $this->fault = $fault; 
     132            $this->fault =& $fault; 
    134133        } 
    135134 
     
    242241     * Hash with used namespaces. 
    243242     * 
    244      * @var array 
     243     * @array 
    245244     */ 
    246245    var $_namespaces; 
     
    249248     * The default namespace. 
    250249     * 
    251      * @var string 
     250     * @string 
    252251     */ 
    253252    var $_namespace; 
     
    288287 
    289288    /** 
    290      * Sets the SOAP-ENV prefix and returns the current value. 
    291      * 
    292      * @access public 
    293      * 
    294      * @param string SOAP-ENV prefix 
    295      * 
    296      * @return string current SOAP-ENV prefix. 
    297      */ 
    298     function SOAPENVPrefix($prefix = null) 
    299     { 
    300         static $_soapenv_prefix = 'SOAP-ENV'; 
    301         if (!is_null($prefix)) { 
    302             $_soapenv_prefix = $prefix; 
    303         } 
    304         return $_soapenv_prefix; 
    305     } 
    306  
    307     /** 
    308      * Sets the SOAP-ENC prefix and returns the current value. 
    309      * 
    310      * @access public 
    311      * 
    312      * @param string SOAP-ENC prefix 
    313      * 
    314      * @return string current SOAP-ENC prefix. 
    315      */ 
    316     function SOAPENCPrefix($prefix = null) 
    317     { 
    318         static $_soapenv_prefix = 'SOAP-ENC'; 
    319         if (!is_null($prefix)) { 
    320             $_soapenv_prefix = $prefix; 
    321         } 
    322         return $_soapenv_prefix; 
    323     } 
    324  
    325     /** 
    326289     * Sets the default namespace. 
    327290     * 
     
    336299    { 
    337300        $this->_namespaces = array( 
    338             'http://schemas.xmlsoap.org/soap/envelope/' => SOAP_BASE::SOAPENVPrefix(), 
     301            'http://schemas.xmlsoap.org/soap/envelope/' => 'SOAP-ENV', 
    339302            'http://www.w3.org/2001/XMLSchema' => 'xsd', 
    340303            'http://www.w3.org/2001/XMLSchema-instance' => 'xsi', 
    341             'http://schemas.xmlsoap.org/soap/encoding/' => SOAP_BASE::SOAPENCPrefix()); 
     304            'http://schemas.xmlsoap.org/soap/encoding/' => 'SOAP-ENC'); 
    342305    } 
    343306 
     
    384347    } 
    385348 
    386     /** 
    387      * Serializes a value, array or object according to the rules set by this 
    388      * object. 
    389      * 
    390      * @see SOAP_Value 
    391      * 
    392      * @param mixed $value       The actual value. 
    393      * @param QName $name        The value name. 
    394      * @param QName $type        The value type. 
    395      * @param array $options     A list of encoding and serialization options. 
    396      * @param array $attributes  A hash of additional attributes. 
    397      * @param string $artype     The type of any array elements. 
    398      */ 
    399     function _serializeValue($value, $name = null, $type = null, 
     349    function _isSoapValue(&$value) 
     350    { 
     351        return is_a($value, 'SOAP_Value'); 
     352    } 
     353 
     354    function _serializeValue(&$value, $name = '', $type = false, 
     355                             $elNamespace = null, $typeNamespace = null, 
    400356                             $options = array(), $attributes = array(), 
    401357                             $artype = '') 
    402358    { 
    403         $namespaces  = array(); 
    404         $arrayType   = $array_depth = $xmlout_value = null; 
    405         $typePrefix  = $elPrefix = $xmlout_arrayType = ''; 
     359        $namespaces = array(); 
     360        $arrayType = $array_depth = $xmlout_value = null; 
     361        $typePrefix = $elPrefix = $xmlout_offset = $xmlout_arrayType = ''; 
    406362        $xmlout_type = $xmlns = $ptype = $array_type_ns = ''; 
    407363 
    408         if (!$name->name || is_numeric($name->name)) { 
    409             $name->name = 'item'; 
     364        if (!$name || is_numeric($name)) { 
     365            $name = 'item'; 
    410366        } 
    411367 
    412368        if ($this->_wsdl) { 
    413369            list($ptype, $arrayType, $array_type_ns, $array_depth) 
    414                 = $this->_wsdl->getSchemaType($type, $name); 
     370                = $this->_wsdl->getSchemaType($type, $name, $typeNamespace); 
    415371        } 
    416372 
     
    422378        } 
    423379        if (!$type) { 
    424             $type = new QName($ptype); 
     380            $type = $ptype; 
    425381        } 
    426382 
    427383        if (strcasecmp($ptype, 'Struct') == 0 || 
    428             strcasecmp($type->name, 'Struct') == 0) { 
     384            strcasecmp($type, 'Struct') == 0) { 
    429385            // Struct 
    430             $vars = is_object($value) ? get_object_vars($value) : $value; 
     386            $vars = null; 
     387            if (is_object($value)) { 
     388                $vars = get_object_vars($value); 
     389            } else { 
     390                $vars = &$value; 
     391            } 
    431392            if (is_array($vars)) { 
    432393                foreach (array_keys($vars) as $k) { 
     
    435396                        continue; 
    436397                    } 
    437  
    438398                    if (is_object($vars[$k])) { 
    439399                        if (is_a($vars[$k], 'SOAP_Value')) { 
     
    443403                            // converting to an array is more overhead than we 
    444404                            // should really do. 
    445                             $xmlout_value .= $this->_serializeValue(get_object_vars($vars[$k]), new QName($k, $this->_section5 ? null : $name->namepace), null, $options); 
     405                            $xmlout_value .= $this->_serializeValue(get_object_vars($vars[$k]), $k, false, $this->_section5 ? null : $elNamespace); 
    446406                        } 
    447407                    } else { 
    448                         $xmlout_value .= $this->_serializeValue($vars[$k], new QName($k, $this->_section5 ? null : $name->namespace), false, $options); 
     408                        $xmlout_value .= $this->_serializeValue($vars[$k], $k, false, $this->_section5 ? null : $elNamespace); 
    449409                    } 
    450410                } 
    451411            } 
    452412        } elseif (strcasecmp($ptype, 'Array') == 0 || 
    453                   strcasecmp($type->name, 'Array') == 0) { 
     413                  strcasecmp($type, 'Array') == 0) { 
    454414            // Array. 
    455             $type = new QName('Array', SOAP_SCHEMA_ENCODING); 
     415            $typeNamespace = SOAP_SCHEMA_ENCODING; 
     416            $orig_type = $type; 
     417            $type = 'Array'; 
    456418            $numtypes = 0; 
    457419            $value = (array)$value; 
     
    477439                $ar_size = count($value); 
    478440                foreach ($value as $array_val) { 
    479                     if (is_a($array_val, 'SOAP_Value')) { 
     441                    if ($this->_isSoapValue($array_val)) { 
    480442                        $array_type = $array_val->type; 
    481443                        $array_types[$array_type] = 1; 
     
    485447                        $array_type = $this->_getType($array_val); 
    486448                        $array_types[$array_type] = 1; 
    487                         if (empty($options['keep_arrays_flat'])) { 
    488                             $xmlout_value .= $this->_serializeValue($array_val, new QName('item', $this->_section5 ? null : $name->namespace), new QName($array_type), $options); 
    489                         } else { 
    490                             $xmlout_value .= $this->_serializeValue($array_val, $name, new QName($array_type), $options, $attributes); 
    491                         } 
     449                        $xmlout_value .= $this->_serializeValue($array_val, 'item', $array_type, $this->_section5 ? null : $elNamespace); 
    492450                    } 
    493451                } 
    494452 
     453                $xmlout_offset = ' SOAP-ENC:offset="[0]"'; 
    495454                if (!$arrayType) { 
    496455                    $numtypes = count($array_types); 
     
    519478                } elseif (isset($this->_typemap[$this->_XMLSchemaVersion][$arrayType])) { 
    520479                    $array_type_prefix = $this->_namespaces[$this->_XMLSchemaVersion]; 
    521                 } elseif (isset($this->_typemap[SOAP_SCHEMA_ENCODING][$arrayType])) { 
    522                     $array_type_prefix = SOAP_BASE::SOAPENCPrefix(); 
    523480                } 
    524481                if ($array_type_prefix) { 
     
    527484            } 
    528485 
    529             $xmlout_arrayType = ' ' . SOAP_BASE::SOAPENCPrefix() 
    530                 . ':arrayType="' . $arrayType; 
     486            $xmlout_arrayType = ' SOAP-ENC:arrayType="' . $arrayType; 
    531487            if ($array_depth != null) { 
    532488                for ($i = 0; $i < $array_depth; $i++) { 
     
    535491            } 
    536492            $xmlout_arrayType .= "[$ar_size]\""; 
    537         } elseif (is_a($value, 'SOAP_Value')) { 
     493        } elseif ($this->_isSoapValue($value)) { 
    538494            $xmlout_value = $value->serialize($this); 
    539         } elseif ($type->name == 'string') { 
     495        } elseif ($type == 'string') { 
    540496            $xmlout_value = htmlspecialchars($value); 
    541         } elseif ($type->name == 'rawstring') { 
    542             $xmlout_value = $value; 
    543         } elseif ($type->name == 'boolean') { 
     497        } elseif ($type == 'rawstring') { 
     498            $xmlout_value =& $value; 
     499        } elseif ($type == 'boolean') { 
    544500            $xmlout_value = $value ? 'true' : 'false'; 
    545501        } else { 
    546             $xmlout_value = $value; 
     502            $xmlout_value =& $value; 
    547503        } 
    548504 
    549505        // Add namespaces. 
    550         if ($name->namespace) { 
    551             $elPrefix = $this->_getNamespacePrefix($name->namespace); 
     506        if ($elNamespace) { 
     507            $elPrefix = $this->_getNamespacePrefix($elNamespace); 
    552508            if ($elPrefix) { 
    553                 $xmlout_name = $elPrefix . ':' . $name->name; 
    554             } else { 
    555                 $xmlout_name = $name->name; 
     509                $xmlout_name = "$elPrefix:$name"; 
     510            } else { 
     511                $xmlout_name = $name; 
    556512            } 
    557513        } else { 
    558             $xmlout_name = $name->name; 
    559         } 
    560  
    561         if ($type->namespace) { 
    562             $typePrefix = false; 
    563             if (empty($options['no_type_prefix'])) { 
    564                 $typePrefix = $this->_getNamespacePrefix($type->namespace); 
    565             } 
     514            $xmlout_name = $name; 
     515        } 
     516 
     517        if ($typeNamespace) { 
     518            $typePrefix = $this->_getNamespacePrefix($typeNamespace); 
    566519            if ($typePrefix) { 
    567                 $xmlout_type = $typePrefix . ':' . $type->name; 
    568             } else { 
    569                 $xmlout_type = $type->name; 
    570             } 
    571         } elseif ($type->name && 
    572                   isset($this->_typemap[$this->_XMLSchemaVersion][$type->name])) { 
     520                $xmlout_type = "$typePrefix:$type"; 
     521            } else { 
     522                $xmlout_type = $type; 
     523            } 
     524        } elseif ($type && 
     525                  isset($this->_typemap[$this->_XMLSchemaVersion][$type])) { 
    573526            $typePrefix = $this->_namespaces[$this->_XMLSchemaVersion]; 
    574527            if ($typePrefix) { 
    575                 $xmlout_type = $typePrefix . ':' . $type->name; 
    576             } else { 
    577                 $xmlout_type = $type->name; 
     528                $xmlout_type = "$typePrefix:$type"; 
     529            } else { 
     530                $xmlout_type = $type; 
    578531            } 
    579532        } 
     
    604557            } else { 
    605558                $xml = "\r\n<$xmlout_name$xmlout_type$xmlns$xmlout_arrayType" . 
    606                     "$xml_attr>$xmlout_value</$xmlout_name>"; 
    607             } 
    608         } elseif ($type->name == 'Array' && !empty($options['keep_arrays_flat'])) { 
    609             $xml = $xmlout_value; 
     559                    "$xmlout_offset$xml_attr>$xmlout_value</$xmlout_name>"; 
     560            } 
    610561        } else { 
    611562            if (is_null($xmlout_value)) { 
     
    623574     * Converts a PHP type to a SOAP type. 
    624575     * 
    625      * @param mixed $value  The value to inspect. 
     576     * @access   private 
     577     * 
     578     * @param string $value  The value to inspect. 
    626579     * 
    627580     * @return string  The value's SOAP type. 
    628581     */ 
    629     function _getType($value) 
     582    function _getType(&$value) 
    630583    { 
    631584        $type = gettype($value); 
     
    643596            if ($this->_isHash($value)) { 
    644597                $type = 'Struct'; 
    645                 break; 
    646             } 
    647             if (count($value) > 1) { 
    648                 // For non-wsdl structs that are all the same type 
     598            } else { 
     599                $ar_size = count($value); 
    649600                reset($value); 
    650                 $value1 = next($value); 
    651                 $value2 = next($value); 
    652                 if (is_a($value1, 'SOAP_Value') && 
    653                     is_a($value2, 'SOAP_Value') && 
    654                     $value1->name != $value2->name) { 
    655                     // This is a struct, not an array. 
    656                     $type = 'Struct'; 
    657                     break; 
     601                $key1 = key($value); 
     602                if ($ar_size > 0 && is_a($key1, 'SOAP_Value')) { 
     603                    // FIXME: for non-wsdl structs that are all the same type 
     604                    $key2 = key($value); 
     605                    if ($ar_size > 1 && 
     606                        $this->_isSoapValue($key1) && 
     607                        $this->_isSoapValue($key2) && 
     608                        $key1->name != $key2->name) { 
     609                        // This is a struct, not an array. 
     610                        $type = 'Struct'; 
     611                    } else { 
     612                        $type = 'Array'; 
     613                    } 
     614                } else { 
     615                    $type = 'Array'; 
    658616                } 
    659617            } 
    660             $type = 'Array'; 
    661618            break; 
    662619 
     
    707664        } else { 
    708665            $type = $this->_getType($value); 
    709             $xml .= $this->_serializeValue($value, new QName('item'), new QName($type)); 
     666            $xml .= $this->_serializeValue($value, 'item', $type); 
    710667        } 
    711668        $size = null; 
     
    733690     * @return boolean  True if the specified array is a hash. 
    734691     */ 
    735     function _isHash($a) 
    736     { 
    737         foreach (array_keys($a) as $k) { 
     692    function _isHash(&$a) 
     693    { 
     694        // I really dislike having to loop through this in PHP code, really 
     695        // large arrays will be slow.  We need a C function to do this. 
     696        $it = 0; 
     697        foreach ($a as $k => $v) { 
    738698            // Checking the type is faster than regexp. 
    739699            if (!is_int($k)) { 
    740700                return true; 
    741701            } 
     702            // If someone has a large hash they should really be defining the 
     703            // type. 
     704            if ($it++ > 10) { 
     705                $this->_raiseSoapFault('Large associative array passed where a SOAP_Value was expected'); 
     706                return false; 
     707            } 
    742708        } 
    743709        return false; 
     
    752718 
    753719    /** 
    754      * Converts a SOAP_Value object into a PHP value. 
    755      */ 
    756     function _decode($soapval) 
    757     { 
    758         if (!is_a($soapval, 'SOAP_Value')) { 
     720    *   Converts a SOAP_Value object into a StdClass PHP object 
     721    */ 
     722    function &_decode(&$soapval) 
     723    { 
     724        if (!$this->_isSoapValue($soapval)) { 
    759725            return $soapval; 
    760         } 
    761  
    762         if (is_array($soapval->value)) { 
    763             $isstruct = $soapval->type != 'Array'; 
    764             if ($isstruct) { 
     726        } elseif (is_array($soapval->value)) { 
     727            if ($soapval->type != 'Array') { 
    765728                $classname = $this->_defaultObjectClassname; 
    766729                if (isset($this->_type_translation[$soapval->tqn->fqn()])) { 
     
    782745                    } 
    783746                } 
    784                 $return = new $classname; 
     747                $return =& new $classname; 
    785748            } else { 
    786749                $return = array(); 
    787750            } 
    788751 
     752            $counter = 1; 
     753            $isstruct = !is_array($return); 
    789754            foreach ($soapval->value as $item) { 
    790                 if ($isstruct) { 
     755                if (is_object($return)) { 
    791756                    if ($this->_wsdl) { 
    792757                        // Get this child's WSDL information. 
     
    801766                        } 
    802767                    } 
    803                     if ($item->type == 'Array') { 
     768                    if (!$isstruct || $item->type == 'Array') { 
    804769                        if (isset($return->{$item->name}) && 
    805770                            is_object($return->{$item->name})) { 
    806                             $return->{$item->name} = $this->_decode($item); 
     771                            $return->{$item->name} =& $this->_decode($item); 
    807772                        } elseif (isset($return->{$item->name}) && 
    808773                                  is_array($return->{$item->name})) { 
     
    814779                            ); 
    815780                        } elseif (is_array($return)) { 
    816                             $return[] = $this->_decode($item); 
     781                            $return[] =& $this->_decode($item); 
    817782                        } else { 
    818                             $return->{$item->name} = $this->_decode($item); 
     783                            $return->{$item->name} =& $this->_decode($item); 
    819784                        } 
    820785                    } elseif (isset($return->{$item->name})) { 
    821                         $d = $this->_decode($item); 
     786                        //$isstruct = false; 
    822787                        if (count(get_object_vars($return)) == 1) { 
    823                             $isstruct = false; 
     788                            $d =& $this->_decode($item); 
    824789                            $return = array($return->{$item->name}, $d); 
    825790                        } else { 
     791                            $d =& $this->_decode($item); 
    826792                            $return->{$item->name} = array($return->{$item->name}, $d); 
    827793                        } 
    828794                    } else { 
    829                         $return->{$item->name} = $this->_decode($item); 
     795                        $return->{$item->name} =& $this->_decode($item); 
    830796                    } 
    831797                    // Set the attributes as members in the class. 
     
    838804                    } 
    839805                } else { 
    840                     if ($soapval->arrayType && is_a($item, 'SOAP_Value')) { 
     806                    if ($soapval->arrayType && $this->_isSoapValue($item)) { 
    841807                        if ($this->_isBase64Type($item->type) && 
    842808                            !$this->_isBase64Type($soapval->arrayType)) { 
     
    847813                        $item->type = $soapval->arrayType; 
    848814                    } 
    849                     $return[] = $this->_decode($item); 
     815                    if (!$isstruct) { 
     816                        $return[] = $this->_decode($item); 
     817                    } elseif (isset($return[$item->name])) { 
     818                        $isstruct = false; 
     819                        $d =& $this->_decode($item); 
     820                        $return = array($return[$item->name], $d); 
     821                    } else { 
     822                        $return[$item->name] = $this->_decode($item); 
     823                    } 
    850824                } 
    851825            } 
     
    866840            settype($soapval->value, 
    867841                    $this->_typemap[SOAP_XML_SCHEMA_VERSION][$soapval->type]); 
    868         } elseif ($soapval->type == 'Struct') { 
    869             $soapval->value = null; 
    870842        } 
    871843 
     
    876848     * Creates the SOAP envelope with the SOAP envelop data. 
    877849     * 
    878      * @param SOAP_Value $method  SOAP_Value instance with the method name as 
    879      *                            the name, and the method arguments as the 
    880      *                            value. 
    881      * @param array $headers      A list of additional SOAP_Header objects. 
    882      * @param string $encoding    The charset of the SOAP message. 
    883      * @param array $options      A list of encoding/serialization options. 
    884      * 
    885      * @return string  The complete SOAP message. 
    886      */ 
    887     function makeEnvelope($method, $headers, $encoding = SOAP_DEFAULT_ENCODING, 
     850     * @param mixed $method 
     851     * @param array $headers 
     852     * @param string $encoding 
     853     * @param array $options 
     854     * 
     855     * @return string 
     856     */ 
     857    function makeEnvelope(&$method, &$headers, 
     858                          $encoding = SOAP_DEFAULT_ENCODING, 
    888859                          $options = array()) 
    889860    { 
     
    891862 
    892863        if ($headers) { 
    893             for ($i = 0, $c = count($headers); $i < $c; $i++) { 
     864            $c = count($headers); 
     865            for ($i = 0; $i < $c; $i++) { 
    894866                $header_xml .= $headers[$i]->serialize($this); 
    895867            } 
    896             $header_xml = sprintf("<%s:Header>\r\n%s\r\n</%s:Header>\r\n", 
    897                                   SOAP_BASE::SOAPENVPrefix(), $header_xml, 
    898                                   SOAP_BASE::SOAPENVPrefix()); 
     868            $header_xml = "<SOAP-ENV:Header>\r\n$header_xml\r\n</SOAP-ENV:Header>\r\n"; 
    899869        } 
    900870 
    901871        if (!isset($options['input']) || $options['input'] == 'parse') { 
    902872            if (is_array($method)) { 
    903                 for ($i = 0, $c = count($method); $i < $c; $i++) { 
     873                $c = count($method); 
     874                for ($i = 0; $i < $c; $i++) { 
    904875                    $smsg .= $method[$i]->serialize($this); 
    905876                } 
     
    910881            $smsg = $method; 
    911882        } 
    912         $body = sprintf("<%s:Body>%s\r\n</%s:Body>\r\n", 
    913                         SOAP_BASE::SOAPENVPrefix(), $smsg, 
    914                         SOAP_BASE::SOAPENVPrefix()); 
     883        $body = "<SOAP-ENV:Body>\r\n" . $smsg . "\r\n</SOAP-ENV:Body>\r\n"; 
    915884 
    916885        foreach ($this->_namespaces as $k => $v) { 
    917             $ns_string .= "\r\n " . sprintf('xmlns:%s="%s"', $v, $k); 
     886            $ns_string .= " xmlns:$v=\"$k\"\r\n"; 
    918887        } 
    919888        if ($this->_namespace) { 
    920             $ns_string .= "\r\n " . sprintf('xmlns="%s"', $this->_namespace); 
    921         } 
    922  
    923         /* If 'use' == 'literal', do not put in the encodingStyle.  This is 
     889            $ns_string .= " xmlns=\"{$this->_namespace}\"\r\n"; 
     890        } 
     891 
     892        /* If 'use' == 'literal', we do not put in the encodingStyle.  This is 
    924893         * denoted by $this->_section5 being false.  'use' can be defined at a 
    925894         * more granular level than we are dealing with here, so this does not 
    926895         * work for all services. */ 
    927         $xml = sprintf('<?xml version="1.0" encoding="%s"?>%s<%s:Envelope%s', 
    928                        $encoding, "\r\n", SOAP_BASE::SOAPENVPrefix(), 
    929                        $ns_string); 
    930         if ($this->_section5) { 
    931             $xml .= "\r\n " . sprintf('%s:encodingStyle="%s"', 
    932                                       SOAP_BASE::SOAPENVPrefix(), 
    933                                       SOAP_SCHEMA_ENCODING); 
    934         } 
    935         $xml .= sprintf('>%s%s%s</%s:Envelope>' . "\r\n", 
    936                         "\r\n", $header_xml, $body, SOAP_BASE::SOAPENVPrefix()); 
     896        $xml = "<?xml version=\"1.0\" encoding=\"$encoding\"?>\r\n\r\n". 
     897            "<SOAP-ENV:Envelope $ns_string". 
     898            ($this->_section5 ? ' SOAP-ENV:encodingStyle="' . SOAP_SCHEMA_ENCODING . '"' : ''). 
     899            ">\r\n". 
     900            "$header_xml$body</SOAP-ENV:Envelope>\r\n"; 
    937901 
    938902        return $xml; 
     
    953917        $params['content_type'] = 'text/xml'; 
    954918        $params['charset'] = $encoding; 
     919        $params['encoding'] = 'base64'; 
    955920        $msg->addSubPart($xml, $params); 
    956921 
     
    1001966 
    1002967        // Lame thing to have to do for decoding. 
    1003         $decoder = new Mail_mimeDecode($data); 
     968        $decoder =& new Mail_mimeDecode($data); 
    1004969        $structure = $decoder->decode($params); 
    1005970 
     
    1013978            $headers = array_merge($structure->headers, 
    1014979                                   $structure->parts[0]->headers); 
    1015             if (count($structure->parts) <= 1) { 
    1016                 return; 
    1017             } 
    1018  
    1019             $mime_parts = array_splice($structure->parts, 1); 
    1020             // Prepare the parts for the SOAP parser. 
    1021             for ($i = 0, $c = count($mime_parts); $i < $c; $i++) { 
    1022                 $p = $mime_parts[$i]; 
    1023                 if (isset($p->headers['content-location'])) { 
    1024                     // TODO: modify location per SwA note section 3 
    1025                     // http://www.w3.org/TR/SOAP-attachments 
    1026                     $attachments[$p->headers['content-location']] = $p->body; 
    1027                 } else { 
    1028                     $cid = 'cid:' . substr($p->headers['content-id'], 1, -1); 
    1029                     $attachments[$cid] = $p->body; 
     980            if (count($structure->parts) > 1) { 
     981                $mime_parts = array_splice($structure->parts,1); 
     982                // Prepare the parts for the SOAP parser. 
     983 
     984                $c = count($mime_parts); 
     985                for ($i = 0; $i < $c; $i++) { 
     986                    $p =& $mime_parts[$i]; 
     987                    if (isset($p->headers['content-location'])) { 
     988                        // TODO: modify location per SwA note section 3 
     989                        // http://www.w3.org/TR/SOAP-attachments 
     990                        $attachments[$p->headers['content-location']] = $p->body; 
     991                    } else { 
     992                        $cid = 'cid:' . substr($p->headers['content-id'], 1, -1); 
     993                        $attachments[$cid] = $p->body; 
     994                    } 
    1030995                } 
    1031996            } 
     
    10451010        // This SHOULD be moved to the transport layer, e.g. PHP itself should 
    10461011        // handle parsing DIME ;) 
    1047         $dime = new Net_DIME_Message(); 
     1012        $dime =& new Net_DIME_Message(); 
    10481013        $err = $dime->decodeData($data); 
    10491014        if (PEAR::isError($err)) { 
     
    10711036 
    10721037    /** 
     1038     * @deprecated Use setTypeTranslation(). 
     1039     */ 
     1040    function __set_type_translation($type, $class = null) 
     1041    { 
     1042        $this->setTypeTranslation($type, $class); 
     1043    } 
     1044 
     1045    /** 
    10731046     * Explicitly sets the translation for a specific class. 
    10741047     * 
     
    10931066 * Class used to handle QNAME values in XML. 
    10941067 * 
     1068 * @access   public 
    10951069 * @package  SOAP 
    10961070 * @author   Shane Caraveo <[email protected]> Conversion to PEAR and updates 
     
    11001074    var $name = ''; 
    11011075    var $ns = ''; 
    1102     var $namespace = ''; 
     1076    var $namespace=''; 
    11031077 
    11041078    function QName($name, $namespace = '') 
Note: See TracChangeset for help on using the changeset viewer.