我已经创建了基于ys框架的wsdl服务:
来自链接: - http://www.yiiframework.com/doc/guide/1.1/en/topics.webservice
并面对评论中的问题
http://www.yiiframework.com/doc/guide/1.1/en/topics.webservice#c6656
和服务器创建正常,因为我能够看到wsdl文件
但是当我尝试通过外部文件中的代码而不是在yii站点文件夹中访问该方法时
下面的文件是在mysite_yii文件夹中的另一个文件夹里面,希望不要创建任何问题,因为它必须调用wsdl文件
$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);
}
我收到以下异常
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/
)
我做了与评论中建议相同的更改,但无法调用该方法
有什么建议吗? 提前致谢
答案 0 :(得分:1)
你必须关闭服务器缓存肥皂,你可以通过添加来关闭它 ini_set(“soap.wsdl_cache_enabled”,“0”); 代码