Undefined property: stdClass::$GetDataResult Error

2019-08-26 11:34发布

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

1条回答
成全新的幸福
2楼-- · 2019-08-26 11:56

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.

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.

查看更多
登录 后发表回答