Friday 18 July 2014

Magento fedex SoapFault exception

Well, when it comes to any third party Shipping API's it a big headache for the developers. Especially when the worlds largest Shipping company FedEx changed their URL for the webservice request without any prior notification and the URL's are hardcoded.

So, How does it affect Magento ?

I was using the FedEx shipping method and everything works good in the Frontend of the website. But when i create a Shipping Label from the Admin i got an error message "An error occured while creating shipping label". And when i checked the LOG file, there was only EXCEPTION log created.

Ok, so after checking the exception log i found that there was a "SoapFault exception" error.
Later i found that it was the FedEx the culprit.

FIXES

Go to the path: app/code/core/Mage/Usa/Model/Shipping/Carrier
open Fedex.php file

On the line number 135 you will find such code with the fedex webservice url hardcoded

$client->__setLocation($this->getConfigFlag('sandbox_mode')
            ? 'https://wsbeta.fedex.com:443/web-services/rate'
            : 'https://ws.fedex.com:443/web-services/rate'
        );

Replace this with this new code.

$client->__setLocation($this->getConfigFlag('sandbox_mode')
            ? 'https://wsbeta.fedex.com:443/web-services'
            : 'https://ws.fedex.com:443/web-services'
        );


and that's it. The error must be Fixed. If it still exists please check your server configuration for the SOAP and WSDL configuration. It must be using older version. Try upgrading it.

NOTE: If you are creating Shipping Labels you Need to change the URL on the WSDL file also. The URL will be found at the very bottom of the code. 

No comments:

Post a Comment