未定义的属性:stdClass::$GetDataResult 错误消息 [英] Undefined property: stdClass::$GetDataResult Error message

查看:36
本文介绍了未定义的属性:stdClass::$GetDataResult 错误消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 PHP Soap Client 功能使用此代码连接远程服务

I'm Using PHP Soap Client function to connect Remote service using this code

try
{
    $result = $soapClient->GetData($parameters);
}
catch (SoapFault $fault)
{
    echo "Fault code: {$fault->faultcode}" . NEWLINE;
    echo "Fault string: {$fault->faultstring}" . NEWLINE;
    if ($soapClient != null)
    {
        $soapClient = null;
    }
    exit();
}
$soapClient = null;

我终于要调用这个函数了,

Finally I'm calling this function,

echo "Return value: {$result->GetDataResult}" . NEWLINE;

但是它对我不起作用并且收到了这样的警告消息.

But It's not working for me and got warning message like this.

Notice: Undefined property: stdClass::$GetDataResult

推荐答案

您假设响应作为具有GetDataResult"属性的对象出现.是什么让你这么想的?事实并非如此,这就是您收到此错误消息的原因.

You are ASSUMING that the response comes as an object with the property "GetDataResult". What makes you think so? This is not the case, and that's why you get this error message.

转储 $result 的内容,看看你真正得到了什么.您还可以查看 WSDL 文件以了解服务承诺响应的内容.

Dump the content of $result to see what you really get. You can also look at the WSDL file to see what the service promises to respond with.

这篇关于未定义的属性:stdClass::$GetDataResult 错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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