PHP Soap 问题:服务器无法处理请求.--->你调用的对象是空的 [英] PHP Soap Issue: Server was unable to process request. ---> Object reference not set to an instance of an object

查看:50
本文介绍了PHP Soap 问题:服务器无法处理请求.--->你调用的对象是空的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 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.com/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.com/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.com/TimeService/TimeService.asmx?op=getTimeZoneTime

和:http://www.nanonull.com/TimeService/TimeService.asmx

杰克

这篇关于PHP Soap 问题:服务器无法处理请求.--->你调用的对象是空的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆