christoph-schaeffer / dhl-business-shipping

An unofficial library for the DHL business shipping soap API (Version 3.3) and the dhl shipment tracking rest API written in PHP.
MIT License
29 stars 8 forks source link

setlocale(LC_ALL, "de_DE.UTF-8", "de_DE", "de", "de"); #6

Closed wolfgangmauer closed 3 years ago

wolfgangmauer commented 3 years ago

In my workflow i must set the locale to german.

Now i set $shipmentOrder->Shipment->ShipmentDetails->ShipmentItem->weightInKG = 0.4; ... $response = $client->validateShipment($request); Exception has occurred. SoapFault: Cannot convert string "0,4" to a double

christoph-schaeffer commented 3 years ago

Hi again @wolfgangmauer

Thanks for submitting this issue.

Just to be sure: The SOAP Client adds commas instead of dots when converting floats to strings for the xml request, right?

To be honest i didn't know that it does that until now.

I guess i'll have to add a conversion before submitting the xml. I've already implemented a similar workaround for booleans. DHL expects a 1 for true and a 0 for false. However the PHP Soap extension converts booleans to 'true' and 'false'...

I'll answer to this issue when i've done that. 👍

christoph-schaeffer commented 3 years ago

@wolfgangmauer

i have just released a new version with a fix for your issue. Could you please check if it works for you aswell? :-)

wolfgangmauer commented 3 years ago

Upgrading christoph-schaeffer/dhl-business-shipping (3.1.2 => 3.1.4): Extracting archive No, same error

Exception has occurred. Fatal error: Uncaught SoapFault exception: [soap:Server] Cannot convert string "0,4" to a double in C:\xampp7.4\htdocs\top-soft.online\vendor\christoph-schaeffer\dhl-business-shipping\src\Soap.php:53 Stack trace:

0 C:\xampp7.4\htdocs\top-soft.online\vendor\christoph-schaeffer\dhl-business-shipping\src\Soap.php(53): SoapClient->__call('validateShipmen...', Array)

1 C:\xampp7.4\htdocs\top-soft.online\vendor\christoph-schaeffer\dhl-business-shipping\src\Client.php(200): ChristophSchaeffer\Dhl\BusinessShipping\Soap->callSoapFunction('validateShipmen...', Object(ChristophSchaeffer\Dhl\BusinessShipping\Request\validateShipment))

2 C:\xampp7.4\htdocs\top-soft.online\functions\dhl.php(28): ChristophSchaeffer\Dhl\BusinessShipping\Client->validateShipment(Object(ChristophSchaeffer\Dhl\BusinessShipping\Request\validateShipment))

3 C:\xampp7.4\htdocs\top-soft.online\templates\admin.php(8): validateShipping(Array)

4 C:\xampp7.4\htdocs\top-soft.online\actions\admin.php(2): require_once('C:\xampp7.4\htd...')

5 C:\xampp7.4\htdocs

wolfgangmauer commented 3 years ago

works like a charm with 3.1.4.2