gpt4 book ai didi

php - SOAP 错误 : Encoding: object has no 'FinalBookingDate' property

转载 作者:可可西里 更新时间:2023-10-31 23:04:29 24 4
gpt4 key购买 nike

在开始之前,我知道,这个错误意味着我应该定义属性 FinalBookingDate,但只要继续阅读,您就会理解我的观点。

网址是:http://bestbuyhotel1.cangooroo.net/ws/2013/ClientBackOffice_b.asmx?op=getBookingList我首先使用 SoapUi 进行测试,并成功获得了我需要的列表: soapui

在 php 上,我只能得到这个响应:SOAP-ERROR: Encoding: object has no 'FinalBookingDate' property

来自 php 的 SoapClient 是:

$params = array('soap_version'   => SOAP_1_2, 'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP, 'encoding'=>'UTF-8', 'trace' => 1, 'exceptions' => true, 'cache_wsdl' => WSDL_CACHE_NONE, 'features' => SOAP_SINGLE_ELEMENT_ARRAYS);
$client = new \SoapClient('http://bestbuyhotel1.cangooroo.net/ws/2013/ClientBackOffice_b.asmx?wsdl', $params);

然后是检索数据的代码:

    /*
$query = array(
'InitialServiceDate' => '2015-01-20',
'InitialBookingDate' => '2015-01-20',
'FinalBookingDate' => '2015-01-20',
'FinalServiceDate' => '2015-01-20',
'CreationUserId' => 1338,
'CityId' => 4166,
'ServiceTypes' => array('eServiceType' => 'HOTEL')
);
*/
$query = array(
'InitialBookingDate' => '2015-01-20',
'ServiceTypes' => array('eServiceType' => 'HOTEL')
);
$args = new \stdClass;
$args->credential = new \stdClass;
$args->credential->UserName = $conn['userPass']['usr'];
$args->credential->Password = $conn['userPass']['pass'];
$args->searchBookingCriteria = new \stdClass;
$args->searchBookingCriteria->InitialBookingDate = '2015-01-20';
$args->searchBookingCriteria->ServiceTypes = new \stdClass;
$args->searchBookingCriteria->ServiceTypes->eServiceType = 'HOTEL';

//$args = array('credential'=>$credentials, 'searchBookingCriteria' => $query);
$data = $conn['client']->getBookingList($args);
print_r($data);
exit;

如您所见,我尝试了两种方法将 $args 发送到 getBookingList,据我所知,这两种方法都是有效的,但两者(使用数组或对象)都返回相同的错误。在最初评论的代码中,您可以看到我尝试定义 Web 服务要求的所有 does 属性,但在定义所有这些属性之后,我得到一个空结果。

我的问题是,我应该在 SoapClient 上定义一些额外的参数吗?为什么 SoapUI 可以成功呢?我在这里缺少什么?

奖励:带有默认请求的 SoapUI 全屏打印,包括可选参数 https://www.evernote.com/shard/s14/sh/fb5ac276-8147-4e09-95bb-afa0be66d7a6/d273441c74186bf1e600b42ab3303899/deep/0/SoapUI-5.0.0.png

最佳答案

你能试试这个更直接的方法吗:

   try { 
$params = array('soap_version' => SOAP_1_2, 'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP, 'encoding'=>'UTF-8', 'trace' => 1, 'exceptions' => true, 'cache_wsdl' => WSDL_CACHE_NONE, 'features' => SOAP_SINGLE_ELEMENT_ARRAYS);
$client = new SoapClient('http://bestbuyhotel1.cangooroo.net/ws/2013/ClientBackOffice_b.asmx?wsdl',$params);
} catch (SoapFault $E) {
echo $E->faultstring;
}
if ($client) {
$req_params = array('credential' =>
array('userName' => 'XXXXXXX',
'Password' => 'XXXXXXX'),
'searchBookingCriteria' =>
array('BookingNumber' => array('int' => 'XXXXXXXXX'),
'ServiceTypes' => array('eServiceType' => 'HOTEL'),
'PassengerName'=> 'XXXXXXXX',
'InitialBookingDate'=> '2015-01-16',
'FinalBookingDate'=> '2015-01-16',
'InitialServiceDate' => '2015-01-18',
'FinalServiceDate' => '2015-01-18',
'BookingStatus'=> array('eStatus' => 'ACTIVATED'),
'PaymentStatus'=> array('ePaymentStatus' => 'Payed'),
'CreationUserId'=> 'XXX',
'CityId'=> 'XXXX',
'ExternalReference'=> '')
);
$response = $client->__soapCall('getBookingList',array($req_params));
var_dump($response);
}

关于php - SOAP 错误 : Encoding: object has no 'FinalBookingDate' property,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28116412/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com