问题描述
限时送ChatGPT账号..我使用 PHP 5.2.5.5 和 Moodle 1.9.
I'm using PHP 5.2.5.5 with Moodle 1.9.
当我进行不带参数的简单 SOAP 调用时,它可以工作.但是,一旦我使用带有参数的调用,它就会失败.如果我使用 Fiddler 捕获 SOAP 请求,我会发现它根本没有将参数添加到 soap 请求中.
When I make a simple SOAP call without parameters, it works. However, as soon as I use a call with a parameter, it fails. If I capture the SOAP request with Fiddler, I see that it's not adding the parameter to the soap request at all.
这是我的示例代码:
$WSDL = 'http://www.nanonull/TimeService/TimeService.asmx?WSDL';
$client = new SoapClient($WSDL);
$response = $client->getUTCTime(); // WORKS
$response = $client->getTimeZoneTime('ZULU'); // SOAP FAULT
有什么建议吗?
Any suggestions?
推荐答案
您还需要传递该参数的名称(并传入一个数组):
You need to pass the name of that parameter as well (and pass in an array):
$WSDL = 'http://www.nanonull/TimeService/TimeService.asmx?WSDL';
$client = new SoapClient($WSDL);
$response = $client->getUTCTime(); // WORKS
$response = $client->getTimeZoneTime(array('timezone'=>'ZULU')); //works
print_r( $response);
参见:http://www.nanonull/TimeService/TimeService.asmx?op=getTimeZoneTime
和:http://www.nanonull/TimeService/TimeService.asmx一个>
杰克
这篇关于PHP Soap 问题:服务器无法处理请求.--->你调用的对象是空的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论