Estes Rate Quote PHP SOAP 请求返回错误

Estes Rate Quote PHP SOAP Requst returning error

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

下面的代码返回了这个错误

Fatal error: Uncaught SoapFault exception: [Client] SOAP-ERROR: Encoding: object has no 'requestID' property in /home/xxxxxxxxxx/public_html/inc/estes/estesapi.php:41 Stack trace: #0 /home/xxxxxxxxxx/public_html/inc/estes/estesapi.php(41): SoapClient->__call('getQuote', Array) #1 {main} thrown in /home/xxxxxxxxxx/public_html/inc/estes/estesapi.php on line 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 传递到 soap 请求中。

这是我们的 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);