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

I am getting error "Fatal error: Uncaught SoapFault exception: [soap:Client]" #13

Closed wdraghwendra closed 2 years ago

wdraghwendra commented 2 years ago

Fatal error: Uncaught SoapFault exception: [soap:Server] UNKNOWN_ERROR in \vendor\christoph-schaeffer\dhl-business-shipping\src\Soap.php:53 Stack trace: #0 \vendor\christoph-schaeffer\dhl-business-shipping\src\Soap.php(53): SoapClient->__call('createShipmentO...', Array) #1 \vendor\christoph-schaeffer\dhl-business-shipping\src\Client.php(73): ChristophSchaeffer\Dhl\BusinessShipping\Soap->callSoapFunction('createShipmentO...', Object(ChristophSchaeffer\Dhl\BusinessShipping\Request\createShipmentOrder)) #2 \dhl.php(71): ChristophSchaeffer\Dhl\BusinessShipping\Client->createShipmentOrder(Object(ChristophSchaeffer\Dhl\BusinessShipping\Request\createShipmentOrder)) #3 {main} thrown in \vendor\christoph-schaeffer\dhl-business-shipping\src\Soap.php on line 53

Please guide

ahmadtechnik commented 2 years ago

me too,

I think the problem from DHL servers. This library has nothing to do with this error.

wdraghwendra commented 2 years ago

Yes, it seems as I run this code before and I got the label, but today it is misbehaving and giving me errors. Any one can help me more?

christoph-schaeffer commented 2 years ago

Hello,

i can't really reproduce this behaviour... could you add the code you used to get the error? do you still get that error? It really seems like something DHL did, as @ahmadtechnik already has said.

wdraghwendra commented 2 years ago

No, i didn't get the error now, But if the DHL server is not working how can we know it or debug it?

christoph-schaeffer commented 2 years ago

There are several possibilities which arent included in my library. However im actually thinking of adding it now...

The DHL API Urls are inside constants in \ChristophSchaeffer\Dhl\BusinessShipping\Soap. You can grab them from there to write a function

Here is an example for a function to check if any url is available:

    $url = \ChristophSchaeffer\Dhl\BusinessShipping\Soap::PRODUCTION_URL;
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_TIMEOUT, 5);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $data = curl_exec($ch);
    if (curl_errno($ch)) {
       echo 'ERROR!';
    } else {
        if (curl_getinfo($ch, CURLINFO_HTTP_CODE) > 0) {
            echo 'SUCCESS!';
        } else {
            echo 'ERROR!';
        }
    }
    curl_close($ch);

This will return a 401 http error code, but we don't care about that, since we just want to know if its available or not.

If you then want to know if it's the input you have given the library is wrong or the library somehow has a bug i always use the simplest function available "getVersion". This can also be used to test your credentials. Even for production. I've added a function when the user saves their configuration with the dhl bussiness account, which validates their entered credentials with getVersion.

wdraghwendra commented 2 years ago

Ok, I will be trying at our end. Thank you for your effort.

christoph-schaeffer commented 2 years ago

I'm closing this issue, as the issue seems to be resolved