power-media / prado3

Automatically exported from code.google.com/p/prado3
Other
0 stars 0 forks source link

enhance TSoapServer::run() exception handling #385

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
hi!

could you please enhance the exception handling of TSoapServer::run() so that 
one can pass more information regarding the exception to the client (most 
importantly the exception's code).

my current working hack passes the code via the $details parameter:

  $this->fault($e->getMessage(), $e->getCode());

however, i'm not familiar enough to judge what the SOAP way should be.

thanks,
raoul

Original issue reported on code.google.com by ra...@bhatia.at on 3 Feb 2012 at 4:42

GoogleCodeExporter commented 8 years ago
Currently the function signature is: TSoapServer::fault($title, $details='', 
$code='SERVER', $actor='', $name='');
The error code should be passed as the third parameter; thse are in turn passed 
to php's SoapServer class: http://it.php.net/manual/en/soapserver.fault.php  
(note that parameters are in different order).
Is this eough or am i missing something?

Original comment by ctrlal...@gmail.com on 5 Feb 2012 at 10:01

GoogleCodeExporter commented 8 years ago
according to a comment in 
http://php.net/manual/en/soapfault.soapfault.php#84426 the code must conform to 
the specification.

I quickly scanned http://www.w3.org/TR/soap12-part1/#faultcodes and thought 
that the most appropriate location for the actual error would be the detail 
part of a soap fault message, e.g. "<m:MaxTime>P5M</m:MaxTime>"

On the other side, PHP automatically uses "Server" or "Client" as the code, 
depending on where the error occured:
Server: e.g. SoapFault sent from the Server
Client: e.g. parse error on the client side because of an invalid XML document.

however, i do not find myself qualified enough to judge the "correct" way :)

thanks,
raoul

Original comment by ra...@bhatia.at on 7 Feb 2012 at 11:14

GoogleCodeExporter commented 8 years ago

Original comment by ctrlal...@gmail.com on 12 Feb 2012 at 6:17

GoogleCodeExporter commented 8 years ago
so, there will be no change then and one should use the code parameter?

Original comment by ra...@bhatia.at on 13 Feb 2012 at 8:50

GoogleCodeExporter commented 8 years ago
I don't fully get your problem. You can use TSoapServer::fault() or directly 
throw a SoafFault exception from inside your soap provider's method 
implementation.
As you noticed, SoapFault's faultcode is not the right place to pass an 
internal database error code or other similar not-soap-fault code: you should 
probably use the details part of the soap message for that.
If you have an idea on how to enhance this, i'll be glad to discuss and 
implement it.

Original comment by ctrlal...@gmail.com on 14 Feb 2012 at 9:41