Re: [SOAP] Proper SOAP_Fault Usage

From: Date: Sun, 18 May 2003 01:48:31 +0000
Subject: Re: [SOAP] Proper SOAP_Fault Usage
References: 1  Groups: php.soap 
Request: Send a blank email to php-soap+get-599@lists.php.net to get a copy of this message
Rob Booth wrote:
So I've been trying to figure out what is the proper way to use SOAP_Fault in PEAR::SOAP. I can easily send back a message and the side that I feel the fault was caused by, but what I want to do is start categorizing my faults with a standard set of error codes, while still sending the message and the side that I feel caused the fault. Here's what I'm doing now:
    return new SOAP_Fault("You need to send a valid ID", "Client");
This is all well and good, but what I want is to send along an error code that the client can read and decide what to send to the user. So say 101 = missing/invalid parameter then someone could code to this number instead of having to parse my string which could be different for each SOAP call. So what is the proper way to do this? Does anyone have a good description of what the various fields in the SOAP_Faut constructor are used for? Any help is appreciated.
The soap_fault constructor takes a bunch of additional stuff, but basicly you have to use the 4th argument to the constructor, which is the detail. detail can be whatever you want it to be. Shane

« previous php.soap (#599) next »