RE: [SOAP] soap problems revisited

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



My server has both display_errors and log_errors set to on, but the
problem only manifests itself when the error parse error occurs within a
method invoked through SOAP.  If I try the same code but invoke the
method in the SOAP object directly and navigate to the page in a
browser, the correct error is reported.

I can get the errors to appear if I remove the '@' operator on the
call_user_func() parts of SOAP_Server::callMethod():

    function &callMethod($methodname, &$args) {
[snip]
        if ($args) {
            // call method with parameters
            if (isset($this->soapobject) &&
is_object($this->soapobject)) {
                $ret = call_user_func_array(array(&$this->soapobject,
$methodname),$args);
            } else {
                $ret = call_user_func_array($methodname,$args);
            }
        } else {
            // call method w/ no parameters
            if (is_object($this->soapobject)) {
                $ret = call_user_func(array(&$this->soapobject,
$methodname));
            } else {
                $ret = call_user_func($methodname);
            }
        }

What are the implications of not suppressing errors here? Obviously
these 'parser' errors originate from call_user_func rather than from the
code inside the actual function (as a run-time error would) and so get
suppressed by the '@'.  The SOAP_ServerErrorHandler still does not pick
up the error, but at least it gets spat out as html and I can debug my
code.

Tristan.

> -----Original Message-----
> From: LIMBOURG Arnaud [mailto:arnaud.limbourg.prestataire@cegetel.fr] 
> Sent: Thursday, 28 August 2003 5:12 PM
> To: soap@lists.php.net
> Subject: RE: [SOAP] soap problems revisited
> 
> 
> Ah, i got it.
> 
> SOAP_Client -> asks server
> 
> SOAP_Server has a parse error and crashes. If display_errors 
> is set to on on the server you should see the message.
> 
> I tried it, having display_errors set to on on the server, 
> SOAP is not installed on the server and i get
> 
> Notice: Undefined variable:  options in 
> C:\TEMP\test_soap_client.php on line 14
> 
> Call Stack:
>     0.0000          0   1. {main}() C:\TEMP\test_soap_client.php:0
> Failed: <br />
> <b>Warning</b>:  main(SOAP/Server.php) [<a
> href='http://www.php.net/function.main'>function.main</a>]: 
> failed to create
> stream: No such file or direct
> ory in <b>C:\websites\caladan\web\test_soap.php</b> on line 
> <b>2</b><br /> <br /> <b>Fatal error</b>:  main() [<a
> href='http://www.php.net/function.main'>function.main</a>]: 
> Failed opening required 'SOAP/Server.php' (include_path='.
> ;c:\php\pear;xxx') in <b>C:\xxxtest_soap.php</b> on line 
> <b>2</b><br />
> 
> I had similar problems doing XML_RPC calls, always ending up 
> in a conf problem.
> 
> hth,
> 
> Arnaud.
> 
> > Actually, no only for the server.  The following server
> > script will halt
> > without any output or php error.  The client receives no 
> > response data,
> > when the expected error would be something like:
> > 
> > Fatal error: Cannot instantiate non-existent class:  b in 
> > .../public_html/server.php on line 12
> > 
> > Try:
> > 
> > ****** [server.php]
> > 
> > <?php
> > require_once 'SOAP/Server.php';
> > 
> > error_reporting(E_ALL);
> > 
> > class A
> > {
> >     function methodA(){ return 0; }
> > }
> > 
> > class SOAP_Example_Server {
> >     function echoString($inputString)
> >     {
> >         // Script will die without error here
> >         $a = new B;
> > 
> > //        // Calling a non-existant method on a valid object also 
> > //        // causes the script to die without an error
> > //        $a = new A;
> > //        $a->methodA();
> > 
> >         return $inputString;
> >     }
> > }
> > 
> > $server =& new SOAP_Server;
> > $soapclass =& new SOAP_Example_Server(); 
> > $server->addObjectMap($soapclass,'urn:SOAP_Example_Server');
> > 
> > $server->service($HTTP_RAW_POST_DATA);
> > ?>
> > 
> > ****** [client.php]
> > 
> > <?php
> > include("SOAP/Client.php");
> > 
> > $soapclient =& new SOAP_Client("http://localhost/server.php";);
> > 
> > // this namespace is the same as declared in server.php $options = 
> > array('namespace' => 'urn:SOAP_Example_Server',
> >                  'trace' => 1);
> > 
> > 
> > $ret = $soapclient->call("echoString",
> >                         $params = array("inputString"=>
> >                                         "this is a test"),
> >                         $options);
> > 
> > if (PEAR::isError($ret))
> > {
> >     echo "Failed: " . $ret->getMessage();
> >     echo "\n" . $soapclient->__get_wire();
> > }
> > else
> > {
> >     echo $ret;
> > }
> > ?>
> > 
> > 
> > > -----Original Message-----
> > > From: Arnaud Limbourg [mailto:arnaud.limbourg@club-internet.fr]
> > > Sent: Thursday, 28 August 2003 3:26 PM
> > > To: soap@lists.php.net
> > > Subject: Re: [SOAP] soap problems revisited
> > > 
> > > 
> > > You mean,
> > > 
> > > $client = new SOAP_Client;
> > > 
> > > require_once 'SOAP/CLient.php';
> > > 
> > > ?
> > > 
> > > php soap_cli.php
> > >  
> > > Fatal error: Cannot instantiate non-existent class: 
> soap_client in 
> > > soap_cli.php on line 3
> > > 
> > > With the code above. Please check your php.ini display_errors 
> > > setting and/or error_reporting (php.ini too)
> > > 
> > > Arnaud.
> > > 
> > 
> > --
> > PHP Soap Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> > 
> 

-- 
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Kernel Newbies]     [PHP Database]     [Yosemite]

  Powered by Linux