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

Source for file Fault.php

Documentation is available at Fault.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: Fault.php,v 1.13 2003/04/13 21:38:58 shane Exp $
  21. //
  22. require_once('PEAR.php');
  23.  
  24. /**
  25.  * SOAP_Fault
  26.  * PEAR::Error wrapper used to match SOAP Faults to PEAR Errors
  27.  *
  28.  * @package  SOAP
  29.  * @access   public
  30.  * @author   Shane Caraveo <Shane@Caraveo.com>   Port to PEAR and more
  31.  * @author   Dietrich Ayala <dietrich@ganx4.com> Original Author
  32.  * @version  $Id: Fault.php,v 1.13 2003/04/13 21:38:58 shane Exp $
  33.  */
  34. class SOAP_Fault extends PEAR_Error
  35. {
  36.     
  37.     /**
  38.      * Constructor
  39.      * 
  40.      * @param    string  message string for fault
  41.      * @param    mixed   the faultcode
  42.      * @param    mixed   see PEAR::ERROR
  43.      * @param    mixed   see PEAR::ERROR
  44.      * @param    array   the userinfo array is used to pass in the
  45.      *                    SOAP actor and detail for the fault
  46.      */
  47.     function SOAP_Fault($faultstring 'unknown error'$faultcode 'Client'$faultactor=NULL$detail=NULL$mode = null$options = null)
  48.     {
  49.         parent::PEAR_Error($faultstring$faultcode$mode$options$detail);
  50.         if ($faultactor$this->error_message_prefix $faultactor;
  51.     }
  52.     
  53.     /**
  54.      * message
  55.      *
  56.      * returns a SOAP_Message class that can be sent as a server response
  57.      *
  58.      * @return SOAP_Message 
  59.      * @access public
  60.      */
  61.     function message()
  62.     {
  63.         $msg =new SOAP_Base();
  64.         $params = array();
  65.         $params[=new SOAP_Value('faultcode''QName''SOAP-ENV:'.$this->code);
  66.         $params[=new SOAP_Value('faultstring''string'$this->message);
  67.         $params[=new SOAP_Value('faultactor''anyURI'$this->error_message_prefix);
  68.         if (isset($this->backtrace)) {
  69.             $params[=new SOAP_Value('detail''string'$this->backtrace);
  70.         else {
  71.             $params[=new SOAP_Value('detail''string'$this->userinfo);
  72.         }
  73.         
  74.         $methodValue =new SOAP_Value('{'.SOAP_ENVELOP.'}Fault''Struct'$params);
  75.         $headers = NULL;
  76.         return $msg->_makeEnvelope($methodValue$headers);
  77.     }
  78.     
  79.     /**
  80.      * getFault
  81.      *
  82.      * returns a simple native php array containing the fault data
  83.      *
  84.      * @return array 
  85.      * @access public
  86.      */
  87.     function getFault()
  88.     {
  89.         global $SOAP_OBJECT_STRUCT;
  90.         if ($SOAP_OBJECT_STRUCT{
  91.             $fault =new stdClass();
  92.             $fault->faultcode = $this->code;
  93.             $fault->faultstring = $this->message;
  94.             $fault->faultactor = $this->error_message_prefix;
  95.             $fault->detail = $this->userinfo;
  96.             return $fault;
  97.         }
  98.         return array(
  99.                 'faultcode' => $this->code,
  100.                 'faultstring' => $this->message,
  101.                 'faultactor' => $this->error_message_prefix,
  102.                 'detail' => $this->userinfo
  103.             );
  104.     }
  105.     
  106.     /**
  107.      * getActor
  108.      *
  109.      * returns the SOAP actor for the fault
  110.      *
  111.      * @return string 
  112.      * @access public
  113.      */
  114.     function getActor()
  115.     {
  116.         return $this->error_message_prefix;
  117.     }
  118.     
  119.     /**
  120.      * getDetail
  121.      *
  122.      * returns the fault detail
  123.      *
  124.      * @return string 
  125.      * @access public
  126.      */
  127.     function getDetail()
  128.     {
  129.         return $this->userinfo;
  130.     }
  131.     
  132. }
  133. ?>

Documentation generated on Mon, 11 Mar 2019 13:59:46 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.