Search code examples
phpweb-servicesyiiwsdl

Wsdl methods not calling via SoapClient, server is create in YII


i have create yii framework based wsdl service:

from the link :- http://www.yiiframework.com/doc/guide/1.1/en/topics.webservice

and facing the issues that is their in the comment

http://www.yiiframework.com/doc/guide/1.1/en/topics.webservice#c6656

and server create fine as i am able to see the wsdl file

but when i try to access the method by the code from external file not in yii site folder

below file is inside another folder not in mysite_yii folder hope that not create any issue as it has to call the wsdl file

$client=new SoapClient('http://localhost/mysite_yii/index.php?r=stock/quote');

try
{
echo $client->getPrice('GOOGLE');
}
catch(Exception $e)
{
    echo "<pre>";
    print_r($e);

}

i am getting the following exception

  SoapFault Object
(
    [message:protected] => Function ("getPrice") is not a valid method for this service
    [string:Exception:private] => 
    [code:protected] => 0
    [file:protected] => /var/www/serverclient/stock.php
    [line:protected] => 9
    [trace:Exception:private] => Array
        (
        [0] => Array
            (
                [file] => /var/www/serverclient/stock.php
                [line] => 9
                [function] => __call
                [class] => SoapClient
                [type] => ->
                [args] => Array
                    (
                        [0] => getPrice
                        [1] => Array
                            (
                                [0] => GOOGLE
                            )

                    )

            )

        [1] => Array
            (
                [file] => /var/www/serverclient/stock.php
                [line] => 9
                [function] => getPrice
                [class] => SoapClient
                [type] => ->
                [args] => Array
                    (
                        [0] => GOOGLE
                    )

            )

    )

[previous:Exception:private] => 
[faultstring] => Function ("getPrice") is not a valid method for this service
[faultcode] => Client
[faultcodens] => http://schemas.xmlsoap.org/soap/envelope/

)

i have done the same changes as suggested in the comment but not able to call that method

any suggestions ? Thanks in advance


Solution

  • you must off the server cache for soap, u can off it by adding ini_set("soap.wsdl_cache_enabled", "0"); to your code