nusoap_fault

Contains information for a SOAP fault.

Defined (2)

The class is defined in the following location(s).

/lib/class.soap_fault.php  
  1. class nusoap_fault extends nusoap_base { 
  2. /** 
  3. * The fault code (client|server) 
  4. * @var string 
  5. * @access private 
  6. */ 
  7. var $faultcode; 
  8. /** 
  9. * The fault actor 
  10. * @var string 
  11. * @access private 
  12. */ 
  13. var $faultactor; 
  14. /** 
  15. * The fault string, a description of the fault 
  16. * @var string 
  17. * @access private 
  18. */ 
  19. var $faultstring; 
  20. /** 
  21. * The fault detail, typically a string or array of string 
  22. * @var mixed 
  23. * @access private 
  24. */ 
  25. var $faultdetail; 
  26.  
  27. /** 
  28. * constructor 
  29. * @param string $faultcode (SOAP-ENV:Client | SOAP-ENV:Server) 
  30. * @param string $faultactor only used when msg routed between multiple actors 
  31. * @param string $faultstring human readable error message 
  32. * @param mixed $faultdetail detail, typically a string or array of string 
  33. */ 
  34. function nusoap_fault($faultcode, $faultactor='', $faultstring='', $faultdetail='') { 
  35. parent::nusoap_base(); 
  36. $this->faultcode = $faultcode; 
  37. $this->faultactor = $faultactor; 
  38. $this->faultstring = $faultstring; 
  39. $this->faultdetail = $faultdetail; 
  40.  
  41. /** 
  42. * serialize a fault 
  43. * @return string The serialization of the fault instance. 
  44. * @access public 
  45. */ 
  46. function serialize() { 
  47. $ns_string = ''; 
  48. foreach($this->namespaces as $k => $v) { 
  49. $ns_string .= "\n xmlns:$k=\"$v\""; 
  50. $return_msg = 
  51. '<?xml version="1.0" encoding="'.$this->soap_defencoding.'"?>'. 
  52. '<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"'.$ns_string.">\n". 
  53. '<SOAP-ENV:Body>'. 
  54. '<SOAP-ENV:Fault>'. 
  55. $this->serialize_val($this->faultcode, 'faultcode'). 
  56. $this->serialize_val($this->faultactor, 'faultactor'). 
  57. $this->serialize_val($this->faultstring, 'faultstring'). 
  58. $this->serialize_val($this->faultdetail, 'detail'). 
  59. '</SOAP-ENV:Fault>'. 
  60. '</SOAP-ENV:Body>'. 
  61. '</SOAP-ENV:Envelope>'; 
  62. return $return_msg; 
/lib/nusoap.php  
  1. class nusoap_fault extends nusoap_base { 
  2. /** 
  3. * The fault code (client|server) 
  4. * @var string 
  5. * @access private 
  6. */ 
  7. var $faultcode; 
  8. /** 
  9. * The fault actor 
  10. * @var string 
  11. * @access private 
  12. */ 
  13. var $faultactor; 
  14. /** 
  15. * The fault string, a description of the fault 
  16. * @var string 
  17. * @access private 
  18. */ 
  19. var $faultstring; 
  20. /** 
  21. * The fault detail, typically a string or array of string 
  22. * @var mixed 
  23. * @access private 
  24. */ 
  25. var $faultdetail; 
  26.  
  27. /** 
  28. * constructor 
  29. * @param string $faultcode (SOAP-ENV:Client | SOAP-ENV:Server) 
  30. * @param string $faultactor only used when msg routed between multiple actors 
  31. * @param string $faultstring human readable error message 
  32. * @param mixed $faultdetail detail, typically a string or array of string 
  33. */ 
  34. function nusoap_fault($faultcode, $faultactor='', $faultstring='', $faultdetail='') { 
  35. parent::nusoap_base(); 
  36. $this->faultcode = $faultcode; 
  37. $this->faultactor = $faultactor; 
  38. $this->faultstring = $faultstring; 
  39. $this->faultdetail = $faultdetail; 
  40.  
  41. /** 
  42. * serialize a fault 
  43. * @return string The serialization of the fault instance. 
  44. * @access public 
  45. */ 
  46. function serialize() { 
  47. $ns_string = ''; 
  48. foreach($this->namespaces as $k => $v) { 
  49. $ns_string .= "\n xmlns:$k=\"$v\""; 
  50. $return_msg = 
  51. '<?xml version="1.0" encoding="'.$this->soap_defencoding.'"?>'. 
  52. '<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"'.$ns_string.">\n". 
  53. '<SOAP-ENV:Body>'. 
  54. '<SOAP-ENV:Fault>'. 
  55. $this->serialize_val($this->faultcode, 'faultcode'). 
  56. $this->serialize_val($this->faultactor, 'faultactor'). 
  57. $this->serialize_val($this->faultstring, 'faultstring'). 
  58. $this->serialize_val($this->faultdetail, 'detail'). 
  59. '</SOAP-ENV:Fault>'. 
  60. '</SOAP-ENV:Body>'. 
  61. '</SOAP-ENV:Envelope>'; 
  62. return $return_msg;