PHP Soap Call给我错误

时间:2013-09-08 15:17:30

标签: php web-services api soap

您好我正在尝试使用Limoanywhere系统设置api服务。但无论我做什么,我都会得到无效的ApiKey& ApiID。我进入后卫系统并更换了ApiKey& ApiId多次但仍然没有成功。

有人能告诉我我的代码是否正确吗?

<?php
$client = new SoapClient('https://qa.book.mylimobiz.com/api/ApiService.asmx?wsdl');
$options = array(
                'ApiKey' => '***api key here****',
                'ApiID'  => '***api id here****'
                );
$result = $client->__soapCall('Test', $options);
//var_dump($client->__getFunctions());
print_r($result);
?>

以下是服务的摘录

http://qa.book.mylimobiz.com/api/ApiService.asmx?op=Test

这是我运行php代码时得到的结果。

Array ( [TestResult] => Array ( [ResponseCode] => 1 [ResponseText] => Invalid ApiId or ApiKey ) )

1 个答案:

答案 0 :(得分:0)

检查这个而不是测试测试功能不起作用给出错误但是测试测试所有功能都在工作。

<?php
        $soapClient = new SoapClient("https://book.mylimobiz.com/api/ApiService.asmx?wsdl");

        // Prepare SoapHeader parameters
        $sh_param = array('apiId'    =>    'xxxxxx','apiKey' => 'xxxxxxxxxxxx');

        $headers = new SoapHeader('https://book.mylimobiz.com/api/ApiService.asmx?wsdl', 'GetVehicleTypes', $sh_param);

        // Prepare Soap Client
        $trans = $soapClient->GetVehicleTypes($sh_param)->GetVehicleTypesResult;

        echo "<pre>"; print_r($trans);

?>
相关问题