Re: [SOAP] Common Error Catching Practice
| From: | Andrey Hristov | Date: | Thu, 31 Oct 2002 09:19:59 +0000 |
| Subject: | Re: [SOAP] Common Error Catching Practice | ||
| References: | 1 | Groups: | php.soap |
| Request: | Send a blank email to php-soap+get-295@lists.php.net to get a copy of this message | ||
Hi,
php -l script_name.php
This will check the syntax (lint-ing it).
When I used to write server side SOAP scripts I did it step by step,
adding code at small steps and then checking it - by linting and direct
excute.
To bypass the php_soap model that cleans all the output from the soap server
you can use a logging function. Mine is called log_printf() and is very
useful.
Kind regards,
Andrey
P.S.
$DEBUG_LOGGING_TYPE = 'ecfi:'.PATH_TO_DEBUG_FILE.'debug.log';
// you should use "file" instead of "ecfi"
function log_printf() {
$num_args = func_num_args();
$args = func_get_args();
if ($args > 0) {
$res = call_user_func_array("sprintf",$args);
if (!empty($GLOBALS['DEBUG_LOGGING_TYPE'])) {
switch (substr($GLOBALS['DEBUG_LOGGING_TYPE'],0,4)) {
case 'file':
$fd = fopen(substr($GLOBALS['DEBUG_LOGGING_TYPE'],5),'a+');
fwrite($fd, $res);
fclose($fd);
break;
case 'mail':
mail(substr($GLOBALS['DEBUG_LOGGING_TYPE'],5),'DEBUG',$res);
break;
case 'echo':
echo $res;
break;
case 'ecfi':
$fd = fopen(substr($GLOBALS['DEBUG_LOGGING_TYPE'],5),'a+');
fwrite($fd, $res);
fclose($fd);
echo $res;
break;
case 'ecma':
mail(substr($GLOBALS['DEBUG_LOGGING_TYPE'],5),'DEBUG',$res);
echo $res;
break;
}// switch
}// if
}// if
return $res;
}// log_printf
----- Original Message -----
From: "Emre Bastuz" <info@emre.de>
To: <soap@lists.php.net>
Sent: Thursday, October 31, 2002 11:11 AM
Subject: [SOAP] Common Error Catching Practice
> Hi,
>
> some time ago I wrote my first SOAP based script.
>
> The hardest thing was that common errors in the PHP script
> (missing brackets, missing ";" etc.) are not shown when
> a SOAP client communicates with a SOAP server - instead I
> usually got the message "Server could not build response".
>
> This usually leaves no clue to what is going wrong and makes
> troubleshooting/debugging quite painsome.
>
> What are you guys doing to catch those kind of errors and
> display them?
>
> Thanks,
>
> Emre
>
> --
> Emre Bastuz
> info@emre.de http://www.emre.de
> UIN: 561260 PGP Key ID: 0xAFAC77FD
>
> -------------------------------------------------
> This mail sent through IMP: http://horde.org/imp/
>
> --
> PHP Soap Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>