SOAP--Client
[ class tree: SOAP--Client ] [ index: SOAP--Client ] [ all elements ]

Source for file Client.php

Documentation is available at Client.php

  1. <?php
  2. //
  3. // +----------------------------------------------------------------------+
  4. // | PHP Version 4                                                        |
  5. // +----------------------------------------------------------------------+
  6. // | Copyright (c) 1997-2003 The PHP Group                                |
  7. // +----------------------------------------------------------------------+
  8. // | This source file is subject to version 2.02 of the PHP license,      |
  9. // | that is bundled with this package in the file LICENSE, and is        |
  10. // | available at through the world-wide-web at                           |
  11. // | http://www.php.net/license/2_02.txt.                                 |
  12. // | If you did not receive a copy of the PHP license and are unable to   |
  13. // | obtain it through the world-wide-web, please send a note to          |
  14. // | license@php.net so we can mail you a copy immediately.               |
  15. // +----------------------------------------------------------------------+
  16. // | Authors: Shane Caraveo <Shane@Caraveo.com>   Port to PEAR and more   |
  17. // | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author         |
  18. // +----------------------------------------------------------------------+
  19. //
  20. // $Id: Client.php,v 1.73 2005/05/28 17:36:41 yunosh Exp $
  21. //
  22.  
  23. require_once 'SOAP/Value.php';
  24. require_once 'SOAP/Base.php';
  25. require_once 'SOAP/Transport.php';
  26. require_once 'SOAP/WSDL.php';
  27. require_once 'SOAP/Fault.php';
  28. require_once 'SOAP/Parser.php';
  29.  
  30. // Arnaud: the following code was taken from DataObject and adapted to suit
  31.  
  32. // this will be horrifically slow!!!!
  33. // NOTE: Overload SEGFAULTS ON PHP4 + Zend Optimizer
  34. // these two are BC/FC handlers for call in PHP4/5
  35.  
  36. if (!class_exists('SOAP_Client_Overload')) {
  37.     if (substr(phpversion()01== 5{
  38.         class SOAP_Client_Overload extends SOAP_Base {
  39.             function __call($method$args)
  40.             {
  41.                 $return = null;
  42.                 $this->_call($method$args$return);
  43.                 return $return;
  44.             }
  45.         }
  46.     else {
  47.         if (!function_exists('clone')) {
  48.             eval('function clone($t) { return $t; }');
  49.         }
  50.         eval('
  51.             class SOAP_Client_Overload extends SOAP_Base {
  52.                 function __call($method, $args, &$return)
  53.                 {
  54.                     return $this->_call($method, $args, $return);
  55.                 }
  56.             }');
  57.     }
  58. }
  59.  
  60. /**
  61.  * SOAP Client Class
  62.  *
  63.  * This class is the main interface for making soap requests.
  64.  *
  65.  * basic usage:<code>
  66.  *   $soapclient = new SOAP_Client( string path [ , boolean wsdl] );
  67.  *   echo $soapclient->call( string methodname [ , array parameters] );
  68.  * </code>
  69.  *
  70.  * Originally based on SOAPx4 by Dietrich Ayala
  71.  * http://dietrich.ganx4.com/soapx4
  72.  *
  73.  * @access   public
  74.  * @package  SOAP::Client
  75.  * @author   Shane Caraveo <shane@php.net> Conversion to PEAR and updates
  76.  * @author   Stig Bakken <ssb@fast.no> Conversion to PEAR
  77.  * @author   Dietrich Ayala <dietrich@ganx4.com> Original Author
  78.  */
  79. {
  80.     /**
  81.      * Communication endpoint.
  82.      *
  83.      * Currently the following transport formats are supported:
  84.      *  - HTTP
  85.      *  - SMTP
  86.      *
  87.      * Example endpoints:
  88.      *   http://www.example.com/soap/server.php
  89.      *   https://www.example.com/soap/server.php
  90.      *   mailto:soap@example.com
  91.      *
  92.      * @see  SOAP_Client()
  93.      * @var $_endpoint string
  94.      */
  95.     var $_endpoint '';
  96.  
  97.     /**
  98.      * The SOAP PORT name that is used by the client.
  99.      *
  100.      * @var $_portName string
  101.      */
  102.     var $_portName '';
  103.  
  104.     /**
  105.      * Endpoint type e.g. 'wdsl'.
  106.      *
  107.      * @var $__endpointType string
  108.      */
  109.     var $__endpointType '';
  110.  
  111.     /**
  112.      * The received xml.
  113.      *
  114.      * @var $xml string
  115.      */
  116.     var $xml;
  117.  
  118.     /**
  119.      * The outgoing and incoming data stream for debugging.
  120.      *
  121.      * @var $wire string
  122.      */
  123.     var $wire;
  124.     var $__last_request = null;
  125.     var $__last_response = null;
  126.  
  127.     /**
  128.      * Options.
  129.      *
  130.      * @var $__options array
  131.      */
  132.     var $__options = array('trace'=>0);
  133.  
  134.     /**
  135.      * The character encoding used for XML parser, etc.
  136.      *
  137.      * @var $_encoding string
  138.      */
  139.     var $_encoding = SOAP_DEFAULT_ENCODING;
  140.  
  141.     /**
  142.      * The array of SOAP_Headers that we are sending.
  143.      *
  144.      * @var $headersOut array
  145.      */
  146.     var $headersOut = null;
  147.  
  148.     /**
  149.      * The headers we recieved back in the response.
  150.      *
  151.      * @var $headersIn array
  152.      */
  153.     var $headersIn = null;
  154.  
  155.     /**
  156.      * Options for the HTTP_Request class (see HTTP/Request.php).
  157.      *
  158.      * @var $__proxy_params array
  159.      */
  160.     var $__proxy_params = array();
  161.  
  162.     var $_soap_transport = null;
  163.  
  164.     /**
  165.      * Constructor.
  166.      *
  167.      * @access public
  168.      *
  169.      * @param string $endpoint     An URL.
  170.      * @param boolean $wsdl        Whether the endpoint is a WSDL file.
  171.      * @param string $portName 
  172.      * @param array $proxy_params  Options for the HTTP_Request class (see
  173.      *                              HTTP/Request.php)
  174.      */
  175.     function SOAP_Client($endpoint$wsdl = false$portName = false,
  176.                          $proxy_params = array())
  177.     {
  178.         parent::SOAP_Base('Client');
  179.  
  180.         $this->_endpoint $endpoint;
  181.         $this->_portName $portName;
  182.         $this->__proxy_params $proxy_params;
  183.  
  184.         // This hack should perhaps be removed as it might cause unexpected
  185.         // behaviour.
  186.         $wsdl $wsdl
  187.             ? $wsdl
  188.             : strtolower(substr($endpoint-4)) == 'wsdl';
  189.  
  190.         // make values
  191.         if ($wsdl{
  192.             $this->__endpointType 'wsdl';
  193.             // instantiate wsdl class
  194.             $this->_wsdl =new SOAP_WSDL($this->_endpoint,
  195.                                           $this->__proxy_params);
  196.             if ($this->_wsdl->fault{
  197.                 $this->_raiseSoapFault($this->_wsdl->fault);
  198.             }
  199.         }
  200.     }
  201.  
  202.     function _reset()
  203.     {
  204.         $this->xml = null;
  205.         $this->wire = null;
  206.         $this->__last_request = null;
  207.         $this->__last_response = null;
  208.         $this->headersIn = null;
  209.         $this->headersOut = null;
  210.     }
  211.  
  212.     /**
  213.      * Sets the character encoding.
  214.      *
  215.      * Limited to 'UTF-8', 'US_ASCII' and 'ISO-8859-1'.
  216.      *
  217.      * @access public
  218.      *
  219.      * @param string encoding
  220.      *
  221.      * @return mixed  SOAP_Fault on error.
  222.      */
  223.     function setEncoding($encoding)
  224.     {
  225.         if (in_array($encoding$this->_encodings)) {
  226.             $this->_encoding $encoding;
  227.             return;
  228.         }
  229.         return $this->_raiseSoapFault('Invalid Encoding');
  230.     }
  231.  
  232.     /**
  233.      * Adds a header to the envelope.
  234.      *
  235.      * @access public
  236.      *
  237.      * @param SOAP_Header $soap_value  A SOAP_Header or an array with the
  238.      *                                  elements 'name', 'namespace',
  239.      *                                  'mustunderstand', and 'actor' to send
  240.      *                                  as a header.
  241.      */
  242.     function addHeader(&$soap_value)
  243.     {
  244.         // Add a new header to the message.
  245.         if (is_a($soap_value'SOAP_Header')) {
  246.             $this->headersOut[=$soap_value;
  247.         elseif (is_array($soap_value)) {
  248.             // name, value, namespace, mustunderstand, actor
  249.             $this->headersOut[=new SOAP_Header($soap_value[0],
  250.                                                    null,
  251.                                                    $soap_value[1],
  252.                                                    $soap_value[2],
  253.                                                    $soap_value[3]);;
  254.         else {
  255.             $this->_raiseSoapFault('Invalid parameter provided to addHeader().  Must be an array or a SOAP_Header.');
  256.         }
  257.     }
  258.  
  259.     /**
  260.      * Calls a method on the SOAP endpoint.
  261.      *
  262.      * The namespace parameter is overloaded to accept an array of options
  263.      * that can contain data necessary for various transports if it is used as
  264.      * an array, it MAY contain a namespace value and a soapaction value.  If
  265.      * it is overloaded, the soapaction parameter is ignored and MUST be
  266.      * placed in the options array.  This is done to provide backwards
  267.      * compatibility with current clients, but may be removed in the future.
  268.      * The currently supported values are:<pre>
  269.      *   namespace
  270.      *   soapaction
  271.      *   timeout (HTTP socket timeout)
  272.      *   transfer-encoding (SMTP, Content-Transfer-Encoding: header)
  273.      *   from (SMTP, From: header)
  274.      *   subject (SMTP, Subject: header)
  275.      *   headers (SMTP, hash of extra SMTP headers)
  276.      * </pre>
  277.      *
  278.      * @access public
  279.      *
  280.      * @param string $method           The method to call.
  281.      * @param array $params            The method parameters.
  282.      * @param string|array$namespace  Namespace or hash with options.
  283.      * @param string $soapAction 
  284.      *
  285.      * @return mixed  The method result or a SOAP_Fault on error.
  286.      */
  287.     function &call($method&$params$namespace = false$soapAction = false)
  288.     {
  289.         $this->headersIn = null;
  290.         $this->__last_request = null;
  291.         $this->__last_response = null;
  292.         $this->wire = null;
  293.         $this->xml = null;
  294.  
  295.         $soap_data =$this->__generate($method$params$namespace$soapAction);
  296.         if (PEAR::isError($soap_data)) {
  297.             return $this->_raiseSoapFault($soap_data);
  298.         }
  299.  
  300.         // __generate() may have changed the endpoint if the WSDL has more
  301.         // than one service, so we need to see if we need to generate a new
  302.         // transport to hook to a different URI.  Since the transport protocol
  303.         // can also change, we need to get an entirely new object.  This could
  304.         // probably be optimized.
  305.         if (!$this->_soap_transport ||
  306.             $this->_endpoint != $this->_soap_transport->url{
  307.             $this->_soap_transport =SOAP_Transport::getTransport($this->_endpoint);
  308.             if (PEAR::isError($this->_soap_transport)) {
  309.                 $fault =$this->_soap_transport;
  310.                 $this->_soap_transport = null;
  311.                 return $this->_raiseSoapFault($fault);
  312.             }
  313.         }
  314.         $this->_soap_transport->encoding = $this->_encoding;
  315.  
  316.         // Send the message.
  317.         $transport_options array_merge_recursive($this->__proxy_params,
  318.                                                    $this->__options);
  319.         $this->xml =$this->_soap_transport->send($soap_data$transport_options);
  320.  
  321.         // Save the wire information for debugging.
  322.         if ($this->__options['trace'> 0{
  323.             $this->__last_request =$this->_soap_transport->outgoing_payload;
  324.             $this->__last_response =$this->_soap_transport->incoming_payload;
  325.             $this->wire =$this->__get_wire();
  326.         }
  327.         if ($this->_soap_transport->fault{
  328.             return $this->_raiseSoapFault($this->xml);
  329.         }
  330.  
  331.         $this->__attachments =$this->_soap_transport->attachments;
  332.         $this->__result_encoding $this->_soap_transport->result_encoding;
  333.  
  334.         if (isset($this->__options['result']&&
  335.             $this->__options['result'!= 'parse'{
  336.             return $this->xml;
  337.         }
  338.  
  339.         return $this->__parse($this->xml$this->__result_encoding$this->__attachments);
  340.     }
  341.  
  342.     /**
  343.      * Sets an option to use with the transport layers.
  344.      *
  345.      * For example:
  346.      * <code>
  347.      * $soapclient->setOpt('curl', CURLOPT_VERBOSE, 1)
  348.      * </code>
  349.      * to pass a specific option to curl if using an SSL connection.
  350.      *
  351.      * @access public
  352.      *
  353.      * @param string $category  Category to which the option applies or option
  354.      *                           name.
  355.      * @param string $option    An option name if $category is a category name,
  356.      *                           an option value if $category is an option name.
  357.      * @param string $value     An option value if $category is a category
  358.      *                           name.
  359.      */
  360.     function setOpt($category$option$value = null)
  361.     {
  362.         if (!is_null($value)) {
  363.             if (!isset($this->__options[$category])) {
  364.                 $this->__options[$category= array();
  365.             }
  366.             $this->__options[$category][$option$value;
  367.         else {
  368.             $this->__options[$category$option;
  369.         }
  370.     }
  371.  
  372.     /**
  373.      * Call method supporting the overload extension.
  374.      *
  375.      * If the overload extension is loaded, you can call the client class with
  376.      * a soap method name:
  377.      * <code>
  378.      * $soap = new SOAP_Client(....);
  379.      * $value = $soap->getStockQuote('MSFT');
  380.      * </code>
  381.      *
  382.      * @access public
  383.      *
  384.      * @param string $method        The method to call.
  385.      * @param array $params         The method parameters.
  386.      * @param string $return_value  Will get the method's return value
  387.      *                               assigned.
  388.      *
  389.      * @return boolean  Always true.
  390.      */
  391.     function _call($method$params&$return_value)
  392.     {
  393.         // Overloading lowercases the method name, we need to look into the
  394.         // wsdl and try to find the correct method name to get the correct
  395.         // case for the call.
  396.         if ($this->_wsdl{
  397.             $this->_wsdl->matchMethod($method);
  398.         }
  399.  
  400.         $return_value =$this->call($method$params);
  401.  
  402.         return true;
  403.     }
  404.  
  405.     function &__getlastrequest()
  406.     {
  407.         return $this->__last_request;
  408.     }
  409.  
  410.     function &__getlastresponse()
  411.     {
  412.         return $this->__last_response;
  413.     }
  414.  
  415.     function __use($use)
  416.     {
  417.         $this->__options['use'$use;
  418.     }
  419.  
  420.     function __style($style)
  421.     {
  422.         $this->__options['style'$style;
  423.     }
  424.  
  425.     function __trace($level)
  426.     {
  427.         $this->__options['trace'$level;
  428.     }
  429.  
  430.     function &__generate($method&$params$namespace = false,
  431.                          $soapAction = false)
  432.     {
  433.         $this->fault = null;
  434.         $this->__options['input']='parse';
  435.         $this->__options['result']='parse';
  436.         $this->__options['parameters'= false;
  437.  
  438.         if ($params && gettype($params!= 'array'{
  439.             $params = array($params);
  440.         }
  441.  
  442.         if (gettype($namespace== 'array'{
  443.             foreach ($namespace as $optname => $opt{
  444.                 $this->__options[strtolower($optname)$opt;
  445.             }
  446.             if (isset($this->__options['namespace'])) {
  447.                 $namespace $this->__options['namespace'];
  448.             else {
  449.                 $namespace = false;
  450.             }
  451.         else {
  452.             // We'll place $soapAction into our array for usage in the
  453.             // transport.
  454.             $this->__options['soapaction'$soapAction;
  455.             $this->__options['namespace'$namespace;
  456.         }
  457.  
  458.         if ($this->__endpointType == 'wsdl'{
  459.             $this->_setSchemaVersion($this->_wsdl->xsd);
  460.  
  461.             // Get port name.
  462.             if (!$this->_portName{
  463.                 $this->_portName $this->_wsdl->getPortName($method);
  464.             }
  465.             if (PEAR::isError($this->_portName)) {
  466.                 return $this->_raiseSoapFault($this->_portName);
  467.             }
  468.  
  469.             // Get endpoint.
  470.             $this->_endpoint $this->_wsdl->getEndpoint($this->_portName);
  471.             if (PEAR::isError($this->_endpoint)) {
  472.                 return $this->_raiseSoapFault($this->_endpoint);
  473.             }
  474.  
  475.             // Get operation data.
  476.             $opData $this->_wsdl->getOperationData($this->_portName$method);
  477.  
  478.             if (PEAR::isError($opData)) {
  479.                 return $this->_raiseSoapFault($opData);
  480.             }
  481.             $namespace $opData['namespace'];
  482.             $this->__options['style'$opData['style'];
  483.             $this->__options['use'$opData['input']['use'];
  484.             $this->__options['soapaction'$opData['soapAction'];
  485.  
  486.             // Set input parameters.
  487.             if ($this->__options['input'== 'parse'{
  488.                 $this->__options['parameters'$opData['parameters'];
  489.                 $nparams = array();
  490.                 if (isset($opData['input']['parts']&&
  491.                     count($opData['input']['parts'])) {
  492.                     $i = 0;
  493.                     foreach ($opData['input']['parts'as $name => $part{
  494.                         $xmlns '';
  495.                         $attrs = array();
  496.                         // Is the name a complex type?
  497.                         if (isset($part['element'])) {
  498.                             $xmlns $this->_wsdl->namespaces[$part['namespace']];
  499.                             $part $this->_wsdl->elements[$part['namespace']][$part['type']];
  500.                             $name $part['name'];
  501.                         }
  502.                         if (isset($params[$name]||
  503.                             $this->_wsdl->getDataHandler($name$part['namespace'])) {
  504.                             $nparams[$name=$params[$name];
  505.                         else {
  506.                             // We now force an associative array for
  507.                             // parameters if using WSDL.
  508.                             return $this->_raiseSoapFault("The named parameter $name is not in the call parameters.");
  509.                         }
  510.                         if (gettype($nparams[$name]!= 'object' ||
  511.                             !is_a($nparams[$name]'SOAP_Value')) {
  512.                             // Type is likely a qname, split it apart, and get
  513.                             // the type namespace from WSDL.
  514.                             $qname =new QName($part['type']);
  515.                             if ($qname->ns{
  516.                                 $type_namespace $this->_wsdl->namespaces[$qname->ns];
  517.                             elseif (isset($part['namespace'])) {
  518.                                 $type_namespace $this->_wsdl->namespaces[$part['namespace']];
  519.                             else {
  520.                                 $type_namespace = null;
  521.                             }
  522.                             $qname->namespace = $type_namespace;
  523.                             $type $qname->name;
  524.                             $pqname $name;
  525.                             if ($xmlns{
  526.                                 $pqname '{' $xmlns '}' $name;
  527.                             }
  528.                             $nparams[$name=new SOAP_Value($pqname,
  529.                                                               $qname->fqn(),
  530.                                                               $nparams[$name],
  531.                                                               $attrs);
  532.                         else {
  533.                             // WSDL fixups to the SOAP value.
  534.                         }
  535.                     }
  536.                 }
  537.                 $params =$nparams;
  538.                 unset($nparams);
  539.             }
  540.         else {
  541.             $this->_setSchemaVersion(SOAP_XML_SCHEMA_VERSION);
  542.         }
  543.  
  544.         // Serialize the message.
  545.         $this->_section5 (isset($this->__options['use']&&
  546.                             $this->__options['use'== 'literal');
  547.  
  548.         if (!isset($this->__options['style']||
  549.             $this->__options['style'== 'rpc'{
  550.             $this->__options['style''rpc';
  551.             $this->docparams = true;
  552.             $mqname =new QName($method$namespace);
  553.             $methodValue =new SOAP_Value($mqname->fqn()'Struct'$params);
  554.             $soap_msg =$this->_makeEnvelope($methodValue,
  555.                                               $this->headersOut,
  556.                                               $this->_encoding,
  557.                                               $this->__options);
  558.         else {
  559.             if (!$params{
  560.                 $mqname =new QName($method$namespace);
  561.                 $mynull = null;
  562.                 $params =new SOAP_Value($mqname->fqn()'Struct'$mynull);
  563.             elseif ($this->__options['input'== 'parse'{
  564.                 if (is_array($params)) {
  565.                     $nparams = array();
  566.                     $keys array_keys($params);
  567.                     foreach ($keys as $k{
  568.                         if (gettype($params[$k]!= 'object'{
  569.                             $nparams[=new SOAP_Value($k,
  570.                                                          false,
  571.                                                          $params[$k]);
  572.                         else {
  573.                             $nparams[=$params[$k];
  574.                         }
  575.                     }
  576.                     $params =$nparams;
  577.                 }
  578.                 if ($this->__options['parameters']{
  579.                     $mqname =new QName($method$namespace);
  580.                     $params =new SOAP_Value($mqname->fqn(),
  581.                                               'Struct',
  582.                                               $params);
  583.                 }
  584.             }
  585.             $soap_msg =$this->_makeEnvelope($params,
  586.                                               $this->headersOut,
  587.                                               $this->_encoding,
  588.                                               $this->__options);
  589.         }
  590.         unset($this->headersOut);
  591.  
  592.         if (PEAR::isError($soap_msg)) {
  593.             return $this->_raiseSoapFault($soap_msg);
  594.         }
  595.  
  596.         // Handle MIME or DIME encoding.
  597.         // TODO: DIME encoding should move to the transport, do it here for
  598.         // now and for ease of getting it done.
  599.         if (count($this->__attachments)) {
  600.             if ((isset($this->__options['attachments']&&
  601.                  $this->__options['attachments'== 'Mime'||
  602.                 isset($this->__options['Mime'])) {
  603.                 $soap_msg =$this->_makeMimeMessage($soap_msg,
  604.                                                      $this->_encoding);
  605.             else {
  606.                 // default is dime
  607.                 $soap_msg =$this->_makeDIMEMessage($soap_msg,
  608.                                                      $this->_encoding);
  609.                 $this->__options['headers']['Content-Type''application/dime';
  610.             }
  611.             if (PEAR::isError($soap_msg)) {
  612.                 return $this->_raiseSoapFault($soap_msg);
  613.             }
  614.         }
  615.  
  616.         // Instantiate client.
  617.         if (is_array($soap_msg)) {
  618.             $soap_data =$soap_msg['body'];
  619.             if (count($soap_msg['headers'])) {
  620.                 if (isset($this->__options['headers'])) {
  621.                     $this->__options['headers'array_merge($this->__options['headers']$soap_msg['headers']);
  622.                 else {
  623.                     $this->__options['headers'$soap_msg['headers'];
  624.                 }
  625.             }
  626.         else {
  627.             $soap_data =$soap_msg;
  628.         }
  629.  
  630.         return $soap_data;
  631.     }
  632.  
  633.     function &__parse(&$response$encoding&$attachments)
  634.     {
  635.         // Parse the response.
  636.         $response =new SOAP_Parser($response$encoding$attachments);
  637.         if ($response->fault{
  638.             return $this->_raiseSoapFault($response->fault);
  639.         }
  640.  
  641.         // Return array of parameters.
  642.         $return =$response->getResponse();
  643.         $headers =$response->getHeaders();
  644.         if ($headers{
  645.             $this->headersIn =$this->__decodeResponse($headersfalse);
  646.         }
  647.  
  648.         return $this->__decodeResponse($return);
  649.     }
  650.  
  651.     function &__decodeResponse(&$response$shift = true)
  652.     {
  653.         if (!$response{
  654.             return null;
  655.         }
  656.  
  657.         // Check for valid response.
  658.         if (PEAR::isError($response)) {
  659.             return $this->_raiseSoapFault($response);
  660.         elseif (!is_a($response'soap_value')) {
  661.             return $this->_raiseSoapFault("Didn't get SOAP_Value object back from client");
  662.         }
  663.  
  664.         // Decode to native php datatype.
  665.         $returnArray =$this->_decode($response);
  666.  
  667.         // Fault?
  668.         if (PEAR::isError($returnArray)) {
  669.             return $this->_raiseSoapFault($returnArray);
  670.         }
  671.  
  672.         if (is_object($returnArray&&
  673.             strcasecmp(get_class($returnArray)'stdClass'== 0{
  674.             $returnArray get_object_vars($returnArray);
  675.         }
  676.         if (is_array($returnArray)) {
  677.             if (isset($returnArray['faultcode']||
  678.                 isset($returnArray['SOAP-ENV:faultcode'])) {
  679.                 $faultcode $faultstring $faultdetail $faultactor '';
  680.                 foreach ($returnArray as $k => $v{
  681.                     if (stristr($k'faultcode')) $faultcode $v;
  682.                     if (stristr($k'faultstring')) $faultstring $v;
  683.                     if (stristr($k'detail')) $faultdetail $v;
  684.                     if (stristr($k'faultactor')) $faultactor $v;
  685.                 }
  686.                 return $this->_raiseSoapFault($faultstring$faultdetail$faultactor$faultcode);
  687.             }
  688.             // Return array of return values.
  689.             if ($shift && count($returnArray== 1{
  690.                 return array_shift($returnArray);
  691.             }
  692.             return $returnArray;
  693.         }
  694.         return $returnArray;
  695.     }
  696.  
  697.     function __get_wire()
  698.     {
  699.         if ($this->__options['trace'> 0 &&
  700.             ($this->__last_request || $this->__last_response)) {
  701.             return "OUTGOING:\n\n" .
  702.                 $this->__last_request .
  703.                 "\n\nINCOMING\n\n" .
  704.                 preg_replace("/></",">\r\n<"$this->__last_response);
  705.         }
  706.  
  707.         return null;
  708.     }
  709.  
  710. }

Documentation generated on Mon, 11 Mar 2019 14:20:02 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.