Re: [SOAP] PEAR::SOAP SOAP_Fault not working or not documented

From: Date: Fri, 07 Mar 2003 22:52:29 +0000
Subject: Re: [SOAP] PEAR::SOAP SOAP_Fault not working or not documented
References: 1  Groups: php.soap 
Request: Send a blank email to php-soap+get-456@lists.php.net to get a copy of this message
Jonathan Schilling wrote:
I'm using PEAR::SOAP 0.7.1 for a web service, and the SOAP_Fault mechanism is not working for me. Clients are interpreting the fault return as a regular, string-typed result, whose value is all the returning SOAP XML, rather than as an actual fault.
The correct way to return a fault from your function is to return an instance of the SOAP_Fault class.
function helloWorld($inmessage) {
      if ($inmessage == 'foo') {
#         $fault = new SOAP_Fault('Do not pass me foo!', '12345');
#         return $fault->message();
return new SOAP_Fault('Do not pass me foo!', '12345');
      } else {
        return "Hello $inmessage";
      }
} }
Shane

« previous php.soap (#456) next »