Estes rate quote PHP SOAP Requst 返回错误



我一直在尝试让它工作一段时间。 我希望熟悉它的人碰巧遇到这个问题,并可以解释为什么这不起作用以及代码有什么问题。 到目前为止,埃斯蒂斯在帮助方面毫无用处。 他们为我提供了一堆信息,但没有一个有效。

下面的代码返回此错误

致命错误: 未捕获的 Soap故障异常: [客户端] 肥皂错误: 编码:对象在 中没有"请求 ID"属性/home/xxxxxx/public_html/inc/estes/estesapi.php:41 堆栈跟踪:#0/home/xxxxxx/public_html/inc/estes/estesapi.php(41(: SoapClient->__call('getQuote', Array( #1 {main} throw in/home/xxxxx/public_html/inc/estes/estesapi.php 在第 41 行

$client = new SoapClient("https://www.estes-express.com/tools/rating/ratequote/v3.0/services/RateQuoteService?wsdl");
$request_object = array(
"header"=>array(
"auth"=>array(
"user"=>"xxxxxxxxx",
"password"=>"xxxx",
)
),
"rateRequest"=>array(
"requestID"=>"abc",
"account"=>"############",
"originPoint"=>array(
"countryCode"=>"US",
"postalCode"=>"28366",
"city"=>"Newton Grove",
"stateProvince"=>"NC",
),
"destinationPoint"=>array(
"countryCode"=>"US",
"postalCode"=>"28334",
),
"payor"=> "S",
"terms"=> "P",
"stackable"=> "N",
"baseCommodities"=>array(
"commodity"=>array(
"class"=>"50",
"weight"=>"1200",
)
)
)
);
$result = $client->getQuote($request_object);
var_dump($result);
print_r($result);

我不知道为什么 RequestID 没有传递到肥皂请求中。

这是我们的Estes Soap调用。看看你是否在其中看到任何有帮助的东西:

// define transaction arrays
$url = "http://www.estes-express.com/rating/ratequote/services/RateQuoteService?wsdl";
$username = 'xxxxxxxx';
$password = 'xxxxxxxx';
// setting a connection timeout of five seconds
$client = new SoapClient($url, array("trace" => true,
"exceptions" => true,
"connection_timeout" => 5,
"features" => SOAP_WAIT_ONE_WAY_CALLS,
"cache_wsdl" => WSDL_CACHE_NONE));
$old = ini_get('default_socket_timeout');
ini_set('default_socket_timeout', 5);
//Prepare SoapHeader parameters
$cred = array(
'user'      => $username,
'password'  => $password
);
$header = new SoapHeader('http://ws.estesexpress.com/ratequote', 'auth', $cred);
$client->__setSoapHeaders($header);
$params = array(
"requestID"         => "xxxxxxxx",
"account"           => "xxxxxxxx",
"originPoint"       => array('countryCode' => 'US', 'postalCode' => $fromzip),
"destinationPoint"  => array('countryCode' => 'US', 'postalCode' => $shipzip),
"payor"             => 'T',
"terms"             => 'PPD',
"stackable"         => 'N',
"baseCommodities"   => array('commodity' => $comArray ),
"accessorials"      => array('accessorialCode' => $accArray)
);
// remove accessorials entry if no accessorial codes
if(count($accArray) == 0){
$params = array_slice($params, 0, 8); // remove accesorials entry
}
// call Estes API and catch any errors
try {
$reply = $client->getQuote($params);
}
catch(SoapFault $e){
// handle issues returned by the web service
//echo "Estes soap fault<br>" . $e . "<br>";
$edit_error_msg = "Estes quote API timed out or failed to return a quote";
return "0.00";
}
catch(Exception $e){
// handle PHP issues with the request
//echo "PHP soap exception<br>" . $e . "<br>";
$edit_error_msg = "Estes quote API timed out or failed to return a quote";
return "0.00";
}
unset($client);
ini_set('default_socket_timeout', $old);
// print_r($reply);

相关内容

  • 没有找到相关文章

最新更新