SoapClient 调用不断返回 null
我已经为此苦苦思索有一段时间了,但始终一无所获。
$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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
返回值不为 null,而是
false
。使用 var_dump 可以更清楚地查看变量类型。解析后的响应对象是响应 XML 的有效表示。The return is not null, it is
false
. Usevar_dump
to see variable types more clearly. The parsed response object is valid representation of the response XML.