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

From: Date: Sun, 09 Mar 2003 14:32:00 +0000
Subject: Re: [SOAP] PEAR::SOAP SOAP_Fault not working or not documented
Groups: php.soap 
Request: Send a blank email to php-soap+get-457@lists.php.net to get a copy of this message
> From shane@caraveo.com Fri Mar 7 17:54:02 2003 > > 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'); OK, thanks very much for the response. (I was led astray by the article at http://www.evolt.org/article/The_PEAR_SOAP_Implementation/21/49993/, which you have no control over but which is the second hit on Google for PEAR::SOAP.) Two more questions: 1. For a PHP PEAR::SOAP client, is $ret = $soapclient->something ... if (is_object($ret) && get_class($ret) == 'soap_fault') { ... the proper way to test for a fault coming back from the call, or is there something simpler? 2. With your correction above, Java Apache Axis clients are now interpreting faults correctly. But Perl SOAP::Lite clients are still not; they give a diagnostic and then the full XML fault packet: [jls@oshea perl]$ perl hello2-php.pl foo Unrecognized type '{http://www.w3.org/2001/XMLSchema}QName' <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> <SOAP-ENV:Fault> <faultcode xsi:type="xsd:QName">SOAP-ENV:12345</faultcode> <faultstring xsi:type="xsd:string">Do not pass me foo!</faultstring> <faultactor xsi:type="xsd:anyURI"></faultactor> <detail xsi:type="xsd:string"></detail></SOAP-ENV:Fault> </SOAP-ENV:Body> </SOAP-ENV:Envelope> at hello2-php.pl line 10 Do you know what the "Unrecognized type '{http://www.w3.org/2001/XMLSchema}QName'" diagnostic is about? Is this a known interop problem? Thanks again, Jonathan Schilling Caldera/SCO

« previous php.soap (#457) next »