gpt4 book ai didi

php - 使用 Temando API 创建预订

转载 作者:搜寻专家 更新时间:2023-10-31 22:12:49 24 4
gpt4 key购买 nike

我正在测试 Temando API 并尝试创建预订。我已按照他们的手册 Temando API R1_11 开发人员指南给出的说明进行操作。

我的问题是,当我使用以下必需信息创建调用 makeBookingByRequest 时:任何事物、任何地点、任何时间、一般信息、始发地、目的地、报价单、付款方式、说明、评论、促销代码。

它返回错误 500:内部服务器错误。如果它与权限有关,我已经解决了。

顺便说一句,这是我的其余代码:

ini_set("soap.wsdl_cache_enabled", "1");
$client = new SoapClient("https://training-api.temando.com/schema/XXXX/server.wsdl", array('soap_version' => SOAP_1_2));

$username = "xxxxxxxxxx";
$password = "xxxxxxxxxx";

$headerSecurityStr = "<Security><UsernameToken><Username>".$username."</Username><Password>".htmlentities($password)."</Password></UsernameToken></Security>";

$headerSecurityVar = new SoapVar($headerSecurityStr, XSD_ANYXML);

$soapHeader = new SoapHeader('wsse:http://schemas.xmlsoap.org/ws/2002/04/secext', 'soapenv:Header', $headerSecurityVar);

$client->__setSoapHeaders(array($soapHeader));

$destination = array();
$destination["destinationCountry"] = "AU";
$destination["destinationCode"] = "2000";
$destination["destinationSuburb"] = "Sydney";
$destination["destinationIs"] = "Residence";
$destination["destinationResPostalBox"] = "N";
$destination["destinationResUnattended"] = "N";
$destination["destinationResInside"] = "N";
$destination["destinationResLimitedAccess"] = "N";
$destination["destinationResHeavyLift"] = "N";

$origin = array();
$origin["originDescription"] = "ABC Suppliers";
$origin["originBusUnattended"] = "N";
$origin["originBusInside"] = "N";
$origin["originBusHeavyLift"] = "N";
$origin["originBusTailgateLifter"] = "N";
$origin["originBusContainerSwingLifter"] = "N";

$quote = array();
$quote["totalPrice"] = "110.00";
$quote["basePrice"] = "100.00";
$quote["tax"] = "10.00";
$quote["currency"] = "AUD";
$quote["deliveryMethod"] = "Off-peak";
$quote["etaFrom"] = "2";
$quote["etaTo"] = "3";
$quote["guaranteedEta"] = "Y";

$payment = array();
$payment["paymentType"] = "Credit Card";
$payment["cardType"] = "Mastercard";
$payment["cardExpiryDate"] = "05-2010";
$payment["cardNumber"] = "5163190000000000";
$payment["cardName"] = "JANE DOE";

$comments = "No Comment";
$reference = "ABC200000";

$makeBookingByRequest = array();
$makeBookingByRequest["anything"] = $anything1;
$makeBookingByRequest["anytime"] = $anytime;
$makeBookingByRequest["anywhere"] = $anywhere;
$makeBookingByRequest["general"] = $general;
$makeBookingByRequest["origin"] = $origin;
$makeBookingByRequest["destination"] = $destination;
$makeBookingByRequest["quote"] = $quote;
$makeBookingByRequest["payment"] = $payment;
$makeBookingByRequest["instructions"] = $instructions;
$makeBookingByRequest["comments"] = $comments;
$makeBookingByRequest["reference"] = $reference;

$anythings = array();

$anything1 = array();
$anything1["class"] = "Freight";
$anything1["mode"] = "Less than load";
$anything1["packaging"] = "Carton";
$anything1["qualifierFreightGeneralFragile"] = "N";
$anything1["distanceMeasurementType"] = "Centimetres";
$anything1["weightMeasurementType"] = "Kilograms";
/** get the data below from POST DATA **/
$anything1["length"] = "30";
$anything1["width"] = "10";
$anything1["height"] = "10";
$anything1["weight"] = "10";
$anything1["quantity"] = "1";
$anything1["description"] = "Contains bottle lids and liquors.";
/*****************/

array_push($anythings, $anything1);

$anywhere = array();
$anywhere["itemNature"] = "Domestic";
$anywhere["itemMethod"] = "Door to Door";

$anywhere["originCountry"] = "AU";
$anywhere["originCode"] = "4000";
$anywhere["originSuburb"] = "Brisbane";
$anywhere["originIs"] = "Business";
$anywhere["originBusUnattended"] = "N";
$anywhere["originBusDock"] = "Y";
$anywhere["originBusForklift"] = "N";
$anywhere["originBusLoadingFacilities"] = "N";
$anywhere["originBusInside"] = "N";
$anywhere["originBusLimitedAccess"] = "N";
$anywhere["originBusHeavyLift"] = "N";
$anywhere["originBusTailgateLifter"] = "N";
$anywhere["originBusContainerSwingLifter"] = "N";

$anywhere["destinationCountry"] = "AU";
$anywhere["destinationCode"] = "2000";
$anywhere["destinationSuburb"] = "Sydney";
$anywhere["destinationIs"] = "Residence";
$anywhere["destinationResPostalBox"] = "N";
$anywhere["destinationResUnattended"] = "N";
$anywhere["destinationResInside"] = "N";
$anywhere["destinationResLimitedAccess"] = "N";
$anywhere["destinationResHeavyLift"] = "N";

$anytime = array();
$anytime["readyDate"] = "2012-06-01";
$anytime["readyTime"] = "PM";

$general = array();
$general["goodsValue"] = "2000.00";

调用方法:

try{
$makeBookingByRequestResponse = $client->makeBookingByRequest($makeBookingByRequest);
p($makeBookingByRequestResponse);
}catch (SoapFault $exception){
p($exception);
// Nothing is done with the exception yet. Will be processed later in the display code.
}

function p($arr){
echo '<pre>';
print_r($arr);
echo '</pre>';
}

有没有人有使用Temando API的经验?任何帮助,将不胜感激。

最佳答案

尝试使用 soapUI 创建您的 SOAP 请求.它是一个对处理 SOAP 网络服务非常有用的免费软件。当它工作时,您可以专注于使用 PHP 构建此请求。

关于php - 使用 Temando API 创建预订,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10762869/

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