Re: Re: E_ERROR in SoapClient

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

 



Thanks for your answer.
Your code is complaining about loading the extension, not the WSDL file.

I've tried this code:
$client = new SoapClient( "http://127.0.0.1/nonexiting.wsdl";,
    array(
        'exceptions' => true,
        'trace'    => true,
        'cache_wsdl' => WSDL_CACHE_NONE
    )
);

and it gives the error:
PHP Fatal error:  SOAP-ERROR: Parsing WSDL: Couldn't load from '
http://127.0.0.1/nonexiting.wsdl' : failed to load external entity "
http://127.0.0.1/nonexiting.wsdl";

As far as i know the 'exceptions' => true is set by default but it only
works for SoapFault exceptions.

2009/7/31 Richard Quadling <rquadling@googlemail.com>

> 2009/7/31 Richard Quadling <rquadling@googlemail.com>:
> > 2009/7/31 Paulo Azevedo <halufa@gmail.com>:
> >> My problem is that SoapClient triggers a E_ERROR ( Fatal Error ) instead
> of
> >> throwing an Exception.
> >> Since E_ERROR cannot be catchable I don't find a way to gracefully
> handly
> >> this problem.
> >>
> >> PHP Fatal error:  SOAP-ERROR: Encoding: object hasn't 'profileData'
> property
> >>
> >>
> >> Is there any way to gracefully catch this error?
> >>
> >> --
> >> -Paulo
> >> http://twitter.com/halufa
> >>
> >
> > You can tell the SoapClient to generate exceptions rather than errors.
> >
> > [1] "The exceptions option is a boolean value defining whether soap
> > errors throw exceptions of type SoapFault."
> >
> > Regards,
> >
> > Richard.
> >
> > [1] http://docs.php.net/manual/en/soapclient.soapclient.php
> > --
> > -----
> > Richard Quadling
> > Zend Certified Engineer :
> http://zend.com/zce.php?c=ZEND002498&r=213474731
> > "Standing on the shoulders of some very clever giants!"
> > ZOPA : http://uk.zopa.com/member/RQuadling
> >
>
> <?php
> try
>        {
>        $client=new SoapClient('
> http://api.rkd.reuters.com/schemas/wsdl/Charts_1_HttpAndRKDToken.wsdl',
> array('exceptions' => True));
>        }
> catch(Exception $exception)
>        {
>        echo $exception;
>        }
> echo 'Finished';
>
>
> outputs ...
>
> SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Unknown required
> WSDL extension 'http://schemas.xmlsoap.org/wsdl/soap/' in
> Z:\soapbad.php:4
> Stack trace:
> #0 Z:\soapbad.php(4): SoapClient->SoapClient('http://api.rkd....', Array)
> #1 {main}Finished
>
>
>
> --
> -----
> Richard Quadling
> Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
> "Standing on the shoulders of some very clever giants!"
> ZOPA : http://uk.zopa.com/member/RQuadling
>



-- 
-Paulo
http://twitter.com/halufa

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

  Powered by Linux