DHL XML API集成错误“ SV012a”和“ SV014a”

时间:2019-03-22 07:38:00

标签: php api dhl

嗯,实际上我正在通过在我们的应用程序中使用API​​来做一些步骤。

(注意:除运输和帐单帐号外,我从DHL Toolkit提供的测试xml文件中获取了以下所有详细信息)

use DHL\Entity\GB\ShipmentResponse;
use DHL\Entity\GB\ShipmentRequest;
use DHL\Client\Web as WebserviceClient;
use DHL\Datatype\GB\Piece;
use DHL\Datatype\GB\SpecialService;
//echo __DIR__ . '/../../init.php';exit;
require(__DIR__ . '/../../init.php');

// DHL Settings
$dhl = $config['dhl'];
//echo "<pre>";print_r($dhl);exit;
// Test a ShipmentRequestRequest using DHL XML API
$sample = new ShipmentRequest();
//echo "<pre>";print_r($dhl);exit;
// Set values of the request
$sample->MessageTime = '2019-03-17T09:30:47-05:00';  
$sample->MessageReference = '1234567890123456789012345678901'; 
$sample->SiteID = $dhl['id'];
$sample->Password = $dhl['pass'];

$sample->RegionCode = 'EU';
//$sample->RequestedPickupTime = 'Y';  
$sample->NewShipper = 'N';  
$sample->LanguageCode = 'en';
$sample->PiecesEnabled = 'Y';
$sample->Billing->ShipperAccountNumber = $dhl['shipperAccountNumber'];
$sample->Billing->ShippingPaymentType = 'S';
$sample->Billing->BillingAccountNumber = $dhl['billingAccountNumber']; 

$sample->Consignee->CompanyName = 'ABCDEFGHIJKLMNOPQRSTUV Life Centre';
$sample->Consignee->addAddressLine('Central 1');  
$sample->Consignee->City = 'Singapore';  
$sample->Consignee->PostalCode = '486048';  
$sample->Consignee->CountryCode = 'SG';
$sample->Consignee->CountryName = 'Singapore';
$sample->Consignee->Contact->PersonName = 'raobeert bere';
$sample->Consignee->Contact->PhoneNumber = '11234-325423';

$sample->Dutiable->DeclaredValue = '2.00';  
$sample->Dutiable->DeclaredCurrency = 'EUR';

$sample->ShipmentDetails->NumberOfPieces = 1;

// All optional but add some data
$piece = new Piece();
$piece->PieceID = '1';
$piece->PackageType = 'EE';
$piece->Weight = '5.0';
$piece->DimWeight = '1.0';
$piece->Width = '2';
$piece->Height = '2';
$piece->Depth = '2';
$sample->ShipmentDetails->addPiece($piece);

$sample->ShipmentDetails->Weight = '5.0';
$sample->ShipmentDetails->WeightUnit = 'K';
$sample->ShipmentDetails->GlobalProductCode = 'P';
$sample->ShipmentDetails->LocalProductCode = 'P';
$sample->ShipmentDetails->Date = date('Y-m-d');
$sample->ShipmentDetails->Contents = 'For testing purpose only. Please do not ship';
$sample->ShipmentDetails->DimensionUnit = 'C';  
$sample->ShipmentDetails->CurrencyCode = 'EUR';

$sample->Shipper->ShipperID = $dhl['shipperAccountNumber'];
$sample->Shipper->CompanyName = 'University of QA';
$sample->Shipper->addAddressLine('1 New Orchard Road');
$sample->Shipper->addAddressLine('Senate House');
$sample->Shipper->City = 'London';  
$sample->Shipper->PostalCode = 'WC1E 7HU';  
$sample->Shipper->CountryCode = 'GB';
$sample->Shipper->CountryName = 'United Kingdom';
$sample->Shipper->Contact->PersonName = 'Mr peter';
$sample->Shipper->Contact->PhoneNumber = '11234-325423';

//$sample->EProcShip = 'N';  
$sample->LabelImageFormat = 'PDF';  

// Call DHL XML API
$start = microtime(true);
//echo $sample->toXML();
$client = new WebserviceClient('staging');
$xml = $client->call($sample);
echo "<pre>";print_r($xml);exit;

与此同时,我收到如下错误:

  

SV012a        系统无法验证您的运送       帐号。请更正此号码,然后       重新提交。如需帮助,请致电DHL客户服务中心

     

SV014a        系统无法验证您的帐单       帐号。请更正此号码,然后       重新提交。如需帮助,请致电DHL客户服务中心

但是我只是测试从一个测试环境URL请求“运输确认”流程的流程。 网址为https://xmlpi-validation.dhl.com/serviceval/jsps/main/Main_menu.jsp

步骤:

1)点击“发货确认”

2)单击“ XML服务”

3)单击“ Request_Global_EU”

4)单击“提交”

在执行此过程时,出现类似“系统无法验证您的运输帐号。请更正此号码,然后重新提交。要获得帮助,请在您的测试环境中致电DHL客户服务。

因此,为此,我无法测试“货件确认”的请求和响应。

任何建议或指导将不胜感激。 谢谢。

1 个答案:

答案 0 :(得分:-1)

似乎您没有有效的ShippingAccount编号,或者您正在使用演示的ShippingAccount演示,无法使用其自己修改大多数运输请求参数。如果这样做,您将获得共享的响应。