Padmalochan
Padmalochan

Reputation: 1090

Unable to obtain courtesy rates in Fed Ex Web Service

I am using Fed Ex Shipping Web Service but getting following error on Running the application. Unable to obtain courtesy rates. I am using Fed Ex test account and fedex meter number. I am using shipServiceDefination.wsdl.

Can any body suggest whats the problem?

Upvotes: 6

Views: 6769

Answers (3)

Wojtek
Wojtek

Reputation: 1530

Short answer

Wait a while and retry again; it's quite possibly a FedEx Sandbox test environment issue.

Note that the FedEx Sandbox environment might be unstable during your testing, and you might need to use FedEx API mocks instead of the Fed Ex Sandbox environment (either built in-house using Wiremock or ready-made by a vendor).

Long answer

The FedEx Sandbox has numerous stability and test data problems.

If you are performing a one-off manual integration test with the rates FedEx API, then using the FedEx Sandbox should be sufficient, and you can re-try your request, and it "hope" be successful after a while.

If, however, you are running automated regression or integration tests on a schedule or per commit, then the instability of the environment might hurt your testing. For example, you might see flaky tests and builds and have to spend time investigating them even though there is nothing wrong with your code or tests, and it's just an issue with the FedEx Sandbox API.

To resolve the issue with FedEx Sandbox environment stability, you have three options, which are essentially about using test-doubles instead of the actual FedEx Sandbox API:

  • Create and use function or method mocks in your code instead of using the FedEx Sandbox. For example, Mockito in Java or uniuttest.mock in Python. You will have to write the FedEx Mockito mocks yourself. And it comes with several tradeoffs. This is a popular option for developers that have time on their hands and can build solutions internally, and don't work on a tight deadline.
  • Create over-the-wire mocks with tools like Wiremock or Mountebank instead of using the FedEx Sandbox. There is a list of tools like that on Wikipedia. Again, the issue is that you have to build those over-the-wire mocks, which can be problematic if it's more than one API and you have a lot of work on your plate anyway.
  • Use ready-made FedEx API mocks like the one from Traffic Parrot instead of using the FedEx Sandbox. The advantage is that experts create them and can use them within minutes. Just copy their mock API URL and use it instead of the FedEx one. Good idea if you are on a tight deadline. You will have to pay for using them, which can sometimes be a downside of this option.

enter image description here

Upvotes: 1

Padmalochan
Padmalochan

Reputation: 1090

There is nothing wrong in the code this is mainly due to website issue. I tried the same thing after few hours and it was working perfectly.

Upvotes: 1

Dmitry
Dmitry

Reputation: 345

I have the same issue. First times all my test requests works properly, but then I start to get similar messages. I suppose that fedex test web service either not works sometimes or have limitation for test requests...

Upvotes: 4

Related Questions