Ignore:
Timestamp:
2011/10/31 13:54:41 (12 years ago)
Author:
kotani
Message:

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

  • 新しいバージョンの配布ファイルを上書きすることで解決
  • →2.11.4には含めないため一旦コミットキャンセル

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

  • 0.11.0 -> 0.12.0
  • →2.11.4には含めないため一旦コミットキャンセル
File:
1 edited

Legend:

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

    r21299 r21304  
    2323 */ 
    2424 
    25 /** SOAP_Value */ 
    2625require_once 'SOAP/Value.php'; 
    2726require_once 'SOAP/Base.php'; 
     
    3736// these two are BC/FC handlers for call in PHP4/5 
    3837 
    39 /** 
    40  * @package SOAP 
    41  */ 
    4238if (!class_exists('SOAP_Client_Overload')) { 
    4339    if (substr(zend_version(), 0, 1) > 1) { 
     
    297293     * placed in the options array.  This is done to provide backwards 
    298294     * compatibility with current clients, but may be removed in the future. 
    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 
     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> 
    316304     * 
    317305     * @access public 
     
    319307     * @param string $method           The method to call. 
    320308     * @param array $params            The method parameters. 
    321      * @param string|array $namespace  Namespace or hash with options. Note: 
    322      *                                 most options need to be repeated for 
    323      *                                 SOAP_Value instances. 
     309     * @param string|array $namespace  Namespace or hash with options. 
    324310     * @param string $soapAction 
    325311     * 
    326312     * @return mixed  The method result or a SOAP_Fault on error. 
    327313     */ 
    328     function call($method, $params, $namespace = false, $soapAction = false) 
     314    function &call($method, &$params, $namespace = false, $soapAction = false) 
    329315    { 
    330316        $this->headersIn = null; 
     
    347333        if (!$this->_soap_transport || 
    348334            $this->_endpoint != $this->_soap_transport->url) { 
    349             $this->_soap_transport = SOAP_Transport::getTransport($this->_endpoint); 
     335            $this->_soap_transport =& SOAP_Transport::getTransport($this->_endpoint); 
    350336            if (PEAR::isError($this->_soap_transport)) { 
    351                 $fault = $this->_raiseSoapFault($this->_soap_transport); 
     337                $fault =& $this->_soap_transport; 
    352338                $this->_soap_transport = null; 
     339                $fault = $this->_raiseSoapFault($fault); 
    353340                return $fault; 
    354341            } 
     
    379366        $this->__result_encoding = $this->_soap_transport->result_encoding; 
    380367 
    381         $result = $this->parseResponse($this->xml, $this->__result_encoding, 
    382                                        $this->_soap_transport->attachments); 
     368        $result = &$this->parseResponse($this->xml, $this->__result_encoding, 
     369                                        $this->_soap_transport->attachments); 
    383370        return $result; 
    384371    } 
     
    442429        } 
    443430 
    444         $return_value = $this->call($method, $params); 
     431        $return_value =& $this->call($method, $params); 
    445432 
    446433        return true; 
     
    448435 
    449436    /** 
     437     * @deprecated Use getLastRequest(). 
     438     */ 
     439    function &__getlastrequest() 
     440    { 
     441        $request = $this->getLastRequest(); 
     442        return $request; 
     443    } 
     444 
     445    /** 
    450446     * Returns the XML content of the last SOAP request. 
    451447     * 
     
    458454 
    459455    /** 
     456     * @deprecated Use getLastResponse(). 
     457     */ 
     458    function &__getlastresponse() 
     459    { 
     460        $response =& $this->getLastResponse; 
     461        return $response; 
     462    } 
     463 
     464    /** 
    460465     * Returns the XML content of the last SOAP response. 
    461466     * 
     
    468473 
    469474    /** 
     475     * @deprecated Use setUse(). 
     476     */ 
     477    function __use($use) 
     478    { 
     479        $this->setUse($use); 
     480    } 
     481 
     482    /** 
    470483     * Sets the SOAP encoding. 
    471484     * 
    472      * The default encoding is section 5 encoded. 
    473      * 
    474485     * @param string $use  Either 'literal' or 'encoded' (section 5). 
    475486     */ 
     
    480491 
    481492    /** 
     493     * @deprecated Use setStyle(). 
     494     */ 
     495    function __style($style) 
     496    { 
     497        $this->setStyle($style); 
     498    } 
     499 
     500    /** 
    482501     * Sets the SOAP encoding style. 
    483502     * 
    484      * The default style is rpc. 
    485      * 
    486503     * @param string $style  Either 'document' or 'rpc'. 
    487504     */ 
     
    492509 
    493510    /** 
     511     * @deprecated Use setTrace(). 
     512     */ 
     513    function __trace($level) 
     514    { 
     515        $this->setTrace($level); 
     516    } 
     517 
     518    /** 
    494519     * Sets whether to trace the traffic on the transport level. 
    495520     * 
     
    503528    } 
    504529 
    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, 
     530    function _generate($method, &$params, $namespace = false, 
    520531                       $soapAction = false) 
    521532    { 
    522533        $this->fault = null; 
    523         $this->_options['input'] = 'parse'; 
     534        $this->_options['input'] = 'parse';  
    524535        $this->_options['result'] = 'parse'; 
    525536        $this->_options['parameters'] = false; 
    526537 
    527         if ($params && !is_array($params)) { 
     538        if ($params && gettype($params) != 'array') { 
    528539            $params = array($params); 
    529540        } 
    530541 
    531         if (is_array($namespace)) { 
    532             // Options passed as a hash. 
     542        if (gettype($namespace) == 'array') { 
    533543            foreach ($namespace as $optname => $opt) { 
    534544                $this->_options[strtolower($optname)] = $opt; 
     545            } 
     546            if (isset($this->_options['namespace'])) { 
     547                $namespace = $this->_options['namespace']; 
     548            } else { 
     549                $namespace = false; 
    535550            } 
    536551        } else { 
    537552            // We'll place $soapAction into our array for usage in the 
    538553            // transport. 
    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; 
     554            $this->_options['soapaction'] = $soapAction; 
     555            $this->_options['namespace'] = $namespace; 
    550556        } 
    551557 
     
    573579                return $this->_raiseSoapFault($opData); 
    574580            } 
    575             $namespace                    = $opData['namespace']; 
    576             $this->_options['style']      = $opData['style']; 
    577             $this->_options['use']        = $opData['input']['use']; 
     581            $namespace = $opData['namespace']; 
     582            $this->_options['style'] = $opData['style']; 
     583            $this->_options['use'] = $opData['input']['use']; 
    578584            $this->_options['soapaction'] = $opData['soapAction']; 
    579585 
     
    643649            $this->docparams = true; 
    644650            $mqname = new QName($method, $namespace); 
    645             $methodValue = new SOAP_Value($mqname->fqn(), 'Struct', $params, 
    646                                           array(), $this->_options); 
     651            $methodValue = new SOAP_Value($mqname->fqn(), 'Struct', $params); 
    647652            $soap_msg = $this->makeEnvelope($methodValue, 
    648653                                            $this->headersOut, 
     
    652657            if (!$params) { 
    653658                $mqname = new QName($method, $namespace); 
    654                 $params = new SOAP_Value($mqname->fqn(), 'Struct', null); 
     659                $mynull = null; 
     660                $params = new SOAP_Value($mqname->fqn(), 'Struct', $mynull); 
    655661            } elseif ($this->_options['input'] == 'parse') { 
    656662                if (is_array($params)) { 
     
    680686                                            $this->_options); 
    681687        } 
    682         $this->headersOut = null; 
     688        unset($this->headersOut); 
    683689 
    684690        if (PEAR::isError($soap_msg)) { 
     
    722728 
    723729    /** 
     730     * @deprecated Use parseResponse(). 
     731     */ 
     732    function &__parse(&$response, $encoding, &$attachments) 
     733    { 
     734        return $this->parseResponse($response, $encoding, $attachments); 
     735    } 
     736 
     737    /** 
    724738     * Parses a SOAP response. 
    725739     * 
     
    730744     * @param array $attachments  List of attachments. 
    731745     */ 
    732     function parseResponse($response, $encoding, $attachments) 
     746    function &parseResponse($response, $encoding, &$attachments) 
    733747    { 
    734748        // Parse the response. 
    735         $response = new SOAP_Parser($response, $encoding, $attachments); 
     749        $response =& new SOAP_Parser($response, $encoding, $attachments); 
    736750        if ($response->fault) { 
    737             $fault = $this->_raiseSoapFault($response->fault); 
     751            $fault =& $this->_raiseSoapFault($response->fault); 
    738752            return $fault; 
    739753        } 
    740754 
    741755        // Return array of parameters. 
    742         $return = $response->getResponse(); 
    743         $headers = $response->getHeaders(); 
     756        $return =& $response->getResponse(); 
     757        $headers =& $response->getHeaders(); 
    744758        if ($headers) { 
    745             $this->headersIn = $this->_decodeResponse($headers, false); 
    746         } 
    747  
    748         $decoded = $this->_decodeResponse($return); 
     759            $this->headersIn =& $this->_decodeResponse($headers, false); 
     760        } 
     761 
     762        $decoded = &$this->_decodeResponse($return); 
    749763        return $decoded; 
    750764    } 
    751765 
    752766    /** 
    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) 
     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) 
    761774    { 
    762775        if (!$response) { 
     
    767780        // Check for valid response. 
    768781        if (PEAR::isError($response)) { 
    769             $fault = $this->_raiseSoapFault($response); 
     782            $fault =& $this->_raiseSoapFault($response); 
    770783            return $fault; 
    771784        } elseif (!is_a($response, 'soap_value')) { 
    772             $fault = $this->_raiseSoapFault("Didn't get SOAP_Value object back from client"); 
     785            $fault =& $this->_raiseSoapFault("Didn't get SOAP_Value object back from client"); 
    773786            return $fault; 
    774787        } 
    775788 
    776789        // Decode to native php datatype. 
    777         $returnArray = $this->_decode($response); 
     790        $returnArray =& $this->_decode($response); 
    778791 
    779792        // Fault? 
    780793        if (PEAR::isError($returnArray)) { 
    781             $fault = $this->_raiseSoapFault($returnArray); 
     794            $fault =& $this->_raiseSoapFault($returnArray); 
    782795            return $fault; 
    783796        } 
     
    787800            $returnArray = get_object_vars($returnArray); 
    788801        } 
    789  
    790802        if (is_array($returnArray)) { 
    791803            if (isset($returnArray['faultcode']) || 
    792                 isset($returnArray[SOAP_BASE::SOAPENVPrefix().':faultcode'])) { 
     804                isset($returnArray['SOAP-ENV:faultcode'])) { 
    793805                $faultcode = $faultstring = $faultdetail = $faultactor = ''; 
    794806                foreach ($returnArray as $k => $v) { 
     
    798810                    if (stristr($k, 'faultactor')) $faultactor = $v; 
    799811                } 
    800                 $fault = $this->_raiseSoapFault($faultstring, $faultdetail, 
    801                                                 $faultactor, $faultcode); 
     812                $fault =& $this->_raiseSoapFault($faultstring, $faultdetail, $faultactor, $faultcode); 
    802813                return $fault; 
    803814            } 
     
    809820            return $returnArray; 
    810821        } 
    811  
    812822        return $returnArray; 
     823    } 
     824 
     825    /** 
     826     * @deprecated Use getWire(). 
     827     */ 
     828    function __get_wire() 
     829    { 
     830        return $this->getWire(); 
    813831    } 
    814832 
Note: See TracChangeset for help on using the changeset viewer.