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

Invalid XML: cvc-datatype-valid.1.2.1: '' ist kein gültiger Wert für 'boolean' #7

Closed stych closed 3 years ago

stych commented 3 years ago

First of all really great work! I appreciate it very much.

Now to the problem. Somehow I get this error message when i try to create a shipping order (createShipmentOrder):

Fatal error: Uncaught SoapFault exception: [env:Client] Invalid XML: cvc-datatype-valid.1.2.1: '' ist kein gültiger Wert für 'boolean'. in /var/www/525/htdocs/vendor/christoph-schaeffer/dhl-business-shipping/src/Soap.php:60 Stack trace: #0 /var/www/525/htdocs/vendor/christoph-schaeffer/dhl-business-shipping/src/Soap.php(60): SoapClient->__call('createShipmentO...', Array) #1 /var/www/525/htdocs/vendor/christoph-schaeffer/dhl-business-shipping/src/Client.php(74): ChristophSchaeffer\Dhl\BusinessShipping\Soap->callSoapFunction('createShipmentO...', Object(ChristophSchaeffer\Dhl\BusinessShipping\Request\createShipmentOrder)) #2

Other functions like getVersion or validateOrder seem to work. I do everything as specified in the documentation. Maybe you can help me.

christoph-schaeffer commented 3 years ago

Hello @stych ,

thank you for your feedback!

To be honest with you i accidently added a bug with the last update (3.1.4), which most likely caused this. In this library, the request object will be sanitized before it's send to DHL's SOAP API. This will remove empty properties, converts booleans to integers, and now also converts floats to string to make sure setLocale doesn't cause issues when converting floats to strings(, instead of . for decimals...)

I have just released a new version (3.1.4.2) Which should fix your issue. Could you try updating the library and tell me if it works for you now?

stych commented 3 years ago

The problem is fixed. Thank you!