1<?php 2 3 4 5 6/** 7* Contains information for a SOAP fault. 8* Mainly used for returning faults from deployed functions 9* in a server instance. 10* @author Dietrich Ayala <dietrich@ganx4.com> 11* @version $Id: class.soap_fault.php,v 1.14 2007/04/11 15:49:47 snichol Exp $ 12* @access public 13*/ 14class nusoap_fault extends nusoap_base { 15 /** 16 * The fault code (client|server) 17 * @var string 18 * @access private 19 */ 20 var $faultcode; 21 /** 22 * The fault actor 23 * @var string 24 * @access private 25 */ 26 var $faultactor; 27 /** 28 * The fault string, a description of the fault 29 * @var string 30 * @access private 31 */ 32 var $faultstring; 33 /** 34 * The fault detail, typically a string or array of string 35 * @var mixed 36 * @access private 37 */ 38 var $faultdetail; 39 40 /** 41 * constructor 42 * 43 * @param string $faultcode (SOAP-ENV:Client | SOAP-ENV:Server) 44 * @param string $faultactor only used when msg routed between multiple actors 45 * @param string $faultstring human readable error message 46 * @param mixed $faultdetail detail, typically a string or array of string 47 */ 48 function nusoap_fault($faultcode,$faultactor='',$faultstring='',$faultdetail=''){ 49 parent::nusoap_base(); 50 $this->faultcode = $faultcode; 51 $this->faultactor = $faultactor; 52 $this->faultstring = $faultstring; 53 $this->faultdetail = $faultdetail; 54 } 55 56 /** 57 * serialize a fault 58 * 59 * @return string The serialization of the fault instance. 60 * @access public 61 */ 62 function serialize(){ 63 $ns_string = ''; 64 foreach($this->namespaces as $k => $v){ 65 $ns_string .= "\n xmlns:$k=\"$v\""; 66 } 67 $return_msg = 68 '<?xml version="1.0" encoding="'.$this->soap_defencoding.'"?>'. 69 '<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"'.$ns_string.">\n". 70 '<SOAP-ENV:Body>'. 71 '<SOAP-ENV:Fault>'. 72 $this->serialize_val($this->faultcode, 'faultcode'). 73 $this->serialize_val($this->faultactor, 'faultactor'). 74 $this->serialize_val($this->faultstring, 'faultstring'). 75 $this->serialize_val($this->faultdetail, 'detail'). 76 '</SOAP-ENV:Fault>'. 77 '</SOAP-ENV:Body>'. 78 '</SOAP-ENV:Envelope>'; 79 return $return_msg; 80 } 81} 82 83/** 84 * Backward compatibility 85 */ 86class soap_fault extends nusoap_fault { 87} 88 89 90?>