This library provides a PHP client for the DHL XML Services. DHL XML Services is an online web services integration capability that provides DHL’s service availability, transit times, rates, shipment and courier pickup booking along with shipment tracking from over 140 countries around the world. Using DHL’s XML Services, customers can incorporate DHL shipping functionality into their websites, customer service applications or order processing systems.
$client = new WebserviceClient('staging');
$xml = $client->call($request);
$response = new ShipmentResponse();
$response->initFromXML($xml);
The line - $response->initFromXML($xml);
gives :-
• Error in Base.php line 227
• at HandleExceptions->handleError('8', 'Trying to get property of non-object', '/var/www/dlogistics/vendor/alfallouji/dhl_api/DHL/Entity/Base.php', '227', array('xml' => object(SimpleXMLElement), 'this' => object(ShipmentResponse))) in Base.php line 227
I believe the code in the Base.php class
if ((string) $xml->Response->Status->Condition->ConditionCode != '')
{
$errorMsg = ((string) $xml->Response->Status->Condition->ConditionCode) . ' : ' . ((string) $xml->Response->Status->Condition->ConditionData);
throw new \Exception('Error returned from DHL webservice : ' . $errorMsg);
}
Is failing because the entity “Condition code” does not exist in the XML returned by DHL (no errors).
Sample XML for request and response attached (label and licenceplates removed to avoid bloat).
When using the initFromXML method as below :-
$client = new WebserviceClient('staging'); $xml = $client->call($request); $response = new ShipmentResponse(); $response->initFromXML($xml);
The line - $response->initFromXML($xml); gives :-
• Error in Base.php line 227 • at HandleExceptions->handleError('8', 'Trying to get property of non-object', '/var/www/dlogistics/vendor/alfallouji/dhl_api/DHL/Entity/Base.php', '227', array('xml' => object(SimpleXMLElement), 'this' => object(ShipmentResponse))) in Base.php line 227
I believe the code in the Base.php class
Is failing because the entity “Condition code” does not exist in the XML returned by DHL (no errors).
Sample XML for request and response attached (label and licenceplates removed to avoid bloat).
XML.txt