我正在尝试使用SOAP从API服务获取数据。除数据外,其他工作正常。 这是代码
$body=array(
'Origin' => 'BOM',
'Destination' => 'DEL',
'DepartDate' => '2013-09-05',
'ReturnDate' => '2013-09-06',
'AdultPax' => '1',
'ChildPax' => '0',
'InfantPax' => '0',
'Currency' => 'INR',
'Clientid' => 'XXX',
'Clientpassword' => '*4X',
'Clienttype' => 'XXXX',
'Preferredclass' => 'E',
'mode' => 'ONE',
'PreferredAirline' => 'AI,G8,IC,6E,9W,S2,IT,9H,I7,SG');
用于执行SOAP的Php代码
$location_URL='http://59.162.33.102/ArzooWS/services/DOMFlightAvailability?wsdl';
$client = new SoapClient('http://59.162.33.102/ArzooWS/services/DOMFlightAvailability?wsdl');
try
{
print_r($client->__getFunctions());
$result = $client->__call('getAvailability',$body);
print_r($result);
}catch(Exception $e){
echo $e;
}
print_r($client->__getFunctions())
返回getAvailability
的结果,当尝试获取数据时,我将获得异常
SoapFault exception: [soap:Server] Index: 1, Size: 1 in C:\xampp\htdocs\apihack\index.php:80 Stack trace: #0 C:\xampp\htdocs\apihack\index.php(80): SoapClient->__call('getAvailability', Array) #1 {main}