Forums / Developer / eZSOAP... Generating Fault error for client
Björn X
Monday 02 June 2003 7:05:58 pm
I played around with the helloworld example of ezsoap.
Actually I didn't figure out how to produce custom fault messages (code&string).
I had a function similar to this(http://ez.no/sdk/ref/view/class/eZSOAPServer/)
function addNumbers( $valueA, $valueB ) { $return = $valueA + $valueB; settype( $return, "integer" ); return $return;}
Whenever my $return was $return=true; or $return=false; the client programm stalled on a null object(Fatal error: Call to a member function on a non-object) on line 111 in lib/ezsoap/classes/ezsoapresponse.php
How do I get the fault thing to work(eZSOAPResponse::isFault())? Or isn't SOAPFault the right way to send custom error messages back to the client?
THX a lot Björn
Bård Farstad
Tuesday 03 June 2003 12:58:23 am
Actually the SOAP faults only work on internal error messages for now. eZ soap does not yet support sending custom faults.
Faults is designed to send error messages like you describe.
I'm working on the SOAP interface now and it will be continually improved.
I think the system should generate a fault if you return an eZSOAPFault object from the function.
-bård
Documentation: http://ez.no/doc
Tuesday 03 June 2003 2:32:55 am
I just commited support for SOAP faults ( revision nr 2634 ).
You can now do: function addNumbers( $valueA, $valueB ) { if ( $valueA == 42 ) return new eZSOAPFault( "Server Error", "This does not work like expected" );
$return = $valueA + $valueB; settype( $return, "integer" ); return $return;}
--bård
Tuesday 03 June 2003 3:00:12 am
I thought so too that this should be the way how it should work. Thanks for the update. I will get the lastest revision from SVN now.
Brad you are da man :-)
Tuesday 03 June 2003 3:40:46 am
Yes definitly works
look that this beautiful error message..
SOAP fault: Server Error - Can't read from Client. HOST: 192.168.0.1 PORT: 8080
THX again