SoapClient 调用不断返回 null

发布于 2024-12-14 19:23:52 字数 1895 浏览 1 评论 0原文

我已经为此苦苦思索有一段时间了,但始终一无所获。

$client = new SoapClient($wsdl, array('trace' => 1));
print_r($client->__getFunctions());
$params->param1 = $cust;
$params->param2 = "1f0de966909641061b729d383bd41bb2f0c3f4db";
$response = $client->ValidateLicenseKey($params);
print_r($params);
print_r($response);
echo "Last Request: ".$client->__getLastRequest();
echo "Last Response: ".$client->__getLastResponse();

其输出如下:

Array
(
    [0] => ValidateLicenseKeyResponse ValidateLicenseKey(ValidateLicenseKey $parameters)
    [1] => CreateProviderResponse CreateProvider(CreateProvider $parameters)
    [2] => SetHardwareProfileResponse SetHardwareProfile(SetHardwareProfile $parameters)
    [3] => UpdateCurrentVersionResponse UpdateCurrentVersion(UpdateCurrentVersion $parameters)
    [4] => SoftwareUpdateAvailableResponse SoftwareUpdateAvailable(SoftwareUpdateAvailable $parameters)
    [5] => GetSoftwareUpdateResponse GetSoftwareUpdate(GetSoftwareUpdate $parameters)
)
stdClass Object
(
    [param1] => satsys
    [param2] => 1f0de966909641061b729d383bd41bb2f0c3f4db
)
stdClass Object
(
    [ValidateLicenseKeyResult] => 
)
Last Request: <?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://tempuri.org/"><SOAP-ENV:Body><ns1:ValidateLicenseKey/></SOAP-ENV:Body></SOAP-ENV:Envelope>
Last Response: <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><ValidateLicenseKeyResponse xmlns="http://tempuri.org/"><ValidateLicenseKeyResult>false</ValidateLicenseKeyResult></ValidateLicenseKeyResponse></s:Body></s:Envelope></pre>

到底为什么 print_r 提示返回为 null?这只是一个简单的调用,用于检查密钥是否在数据库中。其他函数也不返回结果。有人可以解释这里出了什么问题吗?

I've been banging my head on this for awhile now, and I keep getting nowhere.

$client = new SoapClient($wsdl, array('trace' => 1));
print_r($client->__getFunctions());
$params->param1 = $cust;
$params->param2 = "1f0de966909641061b729d383bd41bb2f0c3f4db";
$response = $client->ValidateLicenseKey($params);
print_r($params);
print_r($response);
echo "Last Request: ".$client->__getLastRequest();
echo "Last Response: ".$client->__getLastResponse();

The output of that is as follows:

Array
(
    [0] => ValidateLicenseKeyResponse ValidateLicenseKey(ValidateLicenseKey $parameters)
    [1] => CreateProviderResponse CreateProvider(CreateProvider $parameters)
    [2] => SetHardwareProfileResponse SetHardwareProfile(SetHardwareProfile $parameters)
    [3] => UpdateCurrentVersionResponse UpdateCurrentVersion(UpdateCurrentVersion $parameters)
    [4] => SoftwareUpdateAvailableResponse SoftwareUpdateAvailable(SoftwareUpdateAvailable $parameters)
    [5] => GetSoftwareUpdateResponse GetSoftwareUpdate(GetSoftwareUpdate $parameters)
)
stdClass Object
(
    [param1] => satsys
    [param2] => 1f0de966909641061b729d383bd41bb2f0c3f4db
)
stdClass Object
(
    [ValidateLicenseKeyResult] => 
)
Last Request: <?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://tempuri.org/"><SOAP-ENV:Body><ns1:ValidateLicenseKey/></SOAP-ENV:Body></SOAP-ENV:Envelope>
Last Response: <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><ValidateLicenseKeyResponse xmlns="http://tempuri.org/"><ValidateLicenseKeyResult>false</ValidateLicenseKeyResult></ValidateLicenseKeyResponse></s:Body></s:Envelope></pre>

Why on earth print_r suggest that the return is null? This is just a simple call that checks to see whether a key is in the database or not. None of the other functions return results either. Can someone explain what's going wrong here?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

晚雾 2024-12-21 19:23:52

返回值不为 null,而是 false。使用 var_dump 可以更清楚地查看变量类型。解析后的响应对象是响应 XML 的有效表示。

The return is not null, it is false. Use var_dump to see variable types more clearly. The parsed response object is valid representation of the response XML.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文