Ignore:
Timestamp:
2011/10/25 00:02:55 (13 years ago)
Author:
Seasoft
Message:

#1521 (PEAR::SOAP 配布と異なる部分がある)

  • 新しいバージョンの配布ファイルを上書きすることで解決

#1522 (PEAR::SOAP をバージョンアップ)

  • 0.11.0 -> 0.12.0
File:
1 edited

Legend:

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

    r20119 r21299  
    2323 */ 
    2424 
     25/** SOAP_Value */ 
    2526require_once 'SOAP/Value.php'; 
    2627require_once 'SOAP/Base.php'; 
     
    3637// these two are BC/FC handlers for call in PHP4/5 
    3738 
     39/** 
     40 * @package SOAP 
     41 */ 
    3842if (!class_exists('SOAP_Client_Overload')) { 
    3943    if (substr(zend_version(), 0, 1) > 1) { 
     
    293297     * placed in the options array.  This is done to provide backwards 
    294298     * compatibility with current clients, but may be removed in the future. 
    295      * The currently supported values are:<pre> 
    296      *   namespace 
    297      *   soapaction 
    298      *   timeout (HTTP socket timeout) 
    299      *   transfer-encoding (SMTP, Content-Transfer-Encoding: header) 
    300      *   from (SMTP, From: header) 
    301      *   subject (SMTP, Subject: header) 
    302      *   headers (SMTP, hash of extra SMTP headers) 
    303      * </pre> 
     299     * The currently supported values are: 
     300     * - 'namespace' 
     301     * - 'soapaction' 
     302     * - 'timeout': HTTP socket timeout 
     303     * - 'transfer-encoding': SMTP transport, Content-Transfer-Encoding: header 
     304     * - 'from': SMTP transport, From: header 
     305     * - 'subject': SMTP transport, Subject: header 
     306     * - 'headers': SMTP transport, hash of extra SMTP headers 
     307     * - 'attachments': what encoding to use for attachments (Mime, Dime) 
     308     * - 'trace': whether to trace the SOAP communication 
     309     * - 'style': 'document' or 'rpc'; when set to 'document' the parameters 
     310     *   are not wrapped inside a tag with the SOAP action name 
     311     * - 'use': 'literal' for literal encoding, anything else for section 5 
     312     *   encoding; when set to 'literal' SOAP types will be omitted. 
     313     * - 'keep_arrays_flat': use the tag name multiple times for each element 
     314     *   when passing in an array in literal mode 
     315     * - 'no_type_prefix': supress adding of the namespace prefix 
    304316     * 
    305317     * @access public 
     
    307319     * @param string $method           The method to call. 
    308320     * @param array $params            The method parameters. 
    309      * @param string|array $namespace  Namespace or hash with options. 
     321     * @param string|array $namespace  Namespace or hash with options. Note: 
     322     *                                 most options need to be repeated for 
     323     *                                 SOAP_Value instances. 
    310324     * @param string $soapAction 
    311325     * 
    312326     * @return mixed  The method result or a SOAP_Fault on error. 
    313327     */ 
    314     function &call($method, &$params, $namespace = false, $soapAction = false) 
     328    function call($method, $params, $namespace = false, $soapAction = false) 
    315329    { 
    316330        $this->headersIn = null; 
     
    333347        if (!$this->_soap_transport || 
    334348            $this->_endpoint != $this->_soap_transport->url) { 
    335             $this->_soap_transport =& SOAP_Transport::getTransport($this->_endpoint); 
     349            $this->_soap_transport = SOAP_Transport::getTransport($this->_endpoint); 
    336350            if (PEAR::isError($this->_soap_transport)) { 
    337                 $fault =& $this->_soap_transport; 
     351                $fault = $this->_raiseSoapFault($this->_soap_transport); 
    338352                $this->_soap_transport = null; 
    339                 $fault = $this->_raiseSoapFault($fault); 
    340353                return $fault; 
    341354            } 
     
    366379        $this->__result_encoding = $this->_soap_transport->result_encoding; 
    367380 
    368         $result = &$this->parseResponse($this->xml, $this->__result_encoding, 
    369                                         $this->_soap_transport->attachments); 
     381        $result = $this->parseResponse($this->xml, $this->__result_encoding, 
     382                                       $this->_soap_transport->attachments); 
    370383        return $result; 
    371384    } 
     
    429442        } 
    430443 
    431         $return_value =& $this->call($method, $params); 
     444        $return_value = $this->call($method, $params); 
    432445 
    433446        return true; 
     
    435448 
    436449    /** 
    437      * @deprecated Use getLastRequest(). 
    438      */ 
    439     function &__getlastrequest() 
    440     { 
    441         $request = $this->getLastRequest(); 
    442         return $request; 
    443     } 
    444  
    445     /** 
    446450     * Returns the XML content of the last SOAP request. 
    447451     * 
     
    454458 
    455459    /** 
    456      * @deprecated Use getLastResponse(). 
    457      */ 
    458     function &__getlastresponse() 
    459     { 
    460         $response =& $this->getLastResponse; 
    461         return $response; 
    462     } 
    463  
    464     /** 
    465460     * Returns the XML content of the last SOAP response. 
    466461     * 
     
    473468 
    474469    /** 
    475      * @deprecated Use setUse(). 
    476      */ 
    477     function __use($use) 
    478     { 
    479         $this->setUse($use); 
    480     } 
    481  
    482     /** 
    483470     * Sets the SOAP encoding. 
    484471     * 
     472     * The default encoding is section 5 encoded. 
     473     * 
    485474     * @param string $use  Either 'literal' or 'encoded' (section 5). 
    486475     */ 
     
    491480 
    492481    /** 
    493      * @deprecated Use setStyle(). 
    494      */ 
    495     function __style($style) 
    496     { 
    497         $this->setStyle($style); 
    498     } 
    499  
    500     /** 
    501482     * Sets the SOAP encoding style. 
    502483     * 
     484     * The default style is rpc. 
     485     * 
    503486     * @param string $style  Either 'document' or 'rpc'. 
    504487     */ 
     
    509492 
    510493    /** 
    511      * @deprecated Use setTrace(). 
    512      */ 
    513     function __trace($level) 
    514     { 
    515         $this->setTrace($level); 
    516     } 
    517  
    518     /** 
    519494     * Sets whether to trace the traffic on the transport level. 
    520495     * 
     
    528503    } 
    529504 
    530     function _generate($method, &$params, $namespace = false, 
     505    /** 
     506     * Generates the complete XML SOAP message for an RPC call. 
     507     * 
     508     * @see call() 
     509     * 
     510     * @param string $method           The method to call. 
     511     * @param array $params            The method parameters. 
     512     * @param string|array $namespace  Namespace or hash with options. Note: 
     513     *                                 most options need to be repeated for 
     514     *                                 SOAP_Value instances. 
     515     * @param string $soapAction 
     516     * 
     517     * @return string  The SOAP message including envelope. 
     518     */ 
     519    function _generate($method, $params, $namespace = false, 
    531520                       $soapAction = false) 
    532521    { 
    533522        $this->fault = null; 
    534         $this->_options['input'] = 'parse';  
     523        $this->_options['input'] = 'parse'; 
    535524        $this->_options['result'] = 'parse'; 
    536525        $this->_options['parameters'] = false; 
    537526 
    538         if ($params && gettype($params) != 'array') { 
     527        if ($params && !is_array($params)) { 
    539528            $params = array($params); 
    540529        } 
    541530 
    542         if (gettype($namespace) == 'array') { 
     531        if (is_array($namespace)) { 
     532            // Options passed as a hash. 
    543533            foreach ($namespace as $optname => $opt) { 
    544534                $this->_options[strtolower($optname)] = $opt; 
    545             } 
    546             if (isset($this->_options['namespace'])) { 
    547                 $namespace = $this->_options['namespace']; 
    548             } else { 
    549                 $namespace = false; 
    550535            } 
    551536        } else { 
    552537            // We'll place $soapAction into our array for usage in the 
    553538            // transport. 
    554             $this->_options['soapaction'] = $soapAction; 
    555             $this->_options['namespace'] = $namespace; 
     539            if ($soapAction) { 
     540                $this->_options['soapaction'] = $soapAction; 
     541            } 
     542            if ($namespace) { 
     543                $this->_options['namespace'] = $namespace; 
     544            } 
     545        } 
     546        if (isset($this->_options['namespace'])) { 
     547            $namespace = $this->_options['namespace']; 
     548        } else { 
     549            $namespace = false; 
    556550        } 
    557551 
     
    579573                return $this->_raiseSoapFault($opData); 
    580574            } 
    581             $namespace = $opData['namespace']; 
    582             $this->_options['style'] = $opData['style']; 
    583             $this->_options['use'] = $opData['input']['use']; 
     575            $namespace                    = $opData['namespace']; 
     576            $this->_options['style']      = $opData['style']; 
     577            $this->_options['use']        = $opData['input']['use']; 
    584578            $this->_options['soapaction'] = $opData['soapAction']; 
    585579 
     
    649643            $this->docparams = true; 
    650644            $mqname = new QName($method, $namespace); 
    651             $methodValue = new SOAP_Value($mqname->fqn(), 'Struct', $params); 
     645            $methodValue = new SOAP_Value($mqname->fqn(), 'Struct', $params, 
     646                                          array(), $this->_options); 
    652647            $soap_msg = $this->makeEnvelope($methodValue, 
    653648                                            $this->headersOut, 
     
    657652            if (!$params) { 
    658653                $mqname = new QName($method, $namespace); 
    659                 $mynull = null; 
    660                 $params = new SOAP_Value($mqname->fqn(), 'Struct', $mynull); 
     654                $params = new SOAP_Value($mqname->fqn(), 'Struct', null); 
    661655            } elseif ($this->_options['input'] == 'parse') { 
    662656                if (is_array($params)) { 
     
    686680                                            $this->_options); 
    687681        } 
    688         unset($this->headersOut); 
     682        $this->headersOut = null; 
    689683 
    690684        if (PEAR::isError($soap_msg)) { 
     
    728722 
    729723    /** 
    730      * @deprecated Use parseResponse(). 
    731      */ 
    732     function &__parse(&$response, $encoding, &$attachments) 
    733     { 
    734         return $this->parseResponse($response, $encoding, $attachments); 
    735     } 
    736  
    737     /** 
    738724     * Parses a SOAP response. 
    739725     * 
     
    744730     * @param array $attachments  List of attachments. 
    745731     */ 
    746     function &parseResponse($response, $encoding, &$attachments) 
     732    function parseResponse($response, $encoding, $attachments) 
    747733    { 
    748734        // Parse the response. 
    749         $response =& new SOAP_Parser($response, $encoding, $attachments); 
     735        $response = new SOAP_Parser($response, $encoding, $attachments); 
    750736        if ($response->fault) { 
    751             $fault =& $this->_raiseSoapFault($response->fault); 
     737            $fault = $this->_raiseSoapFault($response->fault); 
    752738            return $fault; 
    753739        } 
    754740 
    755741        // Return array of parameters. 
    756         $return =& $response->getResponse(); 
    757         $headers =& $response->getHeaders(); 
     742        $return = $response->getResponse(); 
     743        $headers = $response->getHeaders(); 
    758744        if ($headers) { 
    759             $this->headersIn =& $this->_decodeResponse($headers, false); 
    760         } 
    761  
    762         $decoded = &$this->_decodeResponse($return); 
     745            $this->headersIn = $this->_decodeResponse($headers, false); 
     746        } 
     747 
     748        $decoded = $this->_decodeResponse($return); 
    763749        return $decoded; 
    764750    } 
    765751 
    766752    /** 
    767     *   Converts a complex SOAP_Value into a PHP Array 
    768     * 
    769     *   @param SOAP_Value   $response   value object 
    770     *   @param boolean      $shift      FIXME 
    771     *   @return Array 
    772     */ 
    773     function &_decodeResponse($response, $shift = true) 
     753     * Converts a complex SOAP_Value into a PHP Array 
     754     * 
     755     * @param SOAP_Value $response  Value object. 
     756     * @param boolean $shift 
     757     * 
     758     * @return array 
     759     */ 
     760    function _decodeResponse($response, $shift = true) 
    774761    { 
    775762        if (!$response) { 
     
    780767        // Check for valid response. 
    781768        if (PEAR::isError($response)) { 
    782             $fault =& $this->_raiseSoapFault($response); 
     769            $fault = $this->_raiseSoapFault($response); 
    783770            return $fault; 
    784771        } elseif (!is_a($response, 'soap_value')) { 
    785             $fault =& $this->_raiseSoapFault("Didn't get SOAP_Value object back from client"); 
     772            $fault = $this->_raiseSoapFault("Didn't get SOAP_Value object back from client"); 
    786773            return $fault; 
    787774        } 
    788775 
    789776        // Decode to native php datatype. 
    790         $returnArray =& $this->_decode($response); 
     777        $returnArray = $this->_decode($response); 
    791778 
    792779        // Fault? 
    793780        if (PEAR::isError($returnArray)) { 
    794             $fault =& $this->_raiseSoapFault($returnArray); 
     781            $fault = $this->_raiseSoapFault($returnArray); 
    795782            return $fault; 
    796783        } 
     
    800787            $returnArray = get_object_vars($returnArray); 
    801788        } 
     789 
    802790        if (is_array($returnArray)) { 
    803791            if (isset($returnArray['faultcode']) || 
    804                 isset($returnArray['SOAP-ENV:faultcode'])) { 
     792                isset($returnArray[SOAP_BASE::SOAPENVPrefix().':faultcode'])) { 
    805793                $faultcode = $faultstring = $faultdetail = $faultactor = ''; 
    806794                foreach ($returnArray as $k => $v) { 
     
    810798                    if (stristr($k, 'faultactor')) $faultactor = $v; 
    811799                } 
    812                 $fault =& $this->_raiseSoapFault($faultstring, $faultdetail, $faultactor, $faultcode); 
     800                $fault = $this->_raiseSoapFault($faultstring, $faultdetail, 
     801                                                $faultactor, $faultcode); 
    813802                return $fault; 
    814803            } 
     
    820809            return $returnArray; 
    821810        } 
     811 
    822812        return $returnArray; 
    823     } 
    824  
    825     /** 
    826      * @deprecated Use getWire(). 
    827      */ 
    828     function __get_wire() 
    829     { 
    830         return $this->getWire(); 
    831813    } 
    832814 
Note: See TracChangeset for help on using the changeset viewer.