I implemented a SoapClient interface for handling rate requests to the Federal Express Rate request web services. Last night at around 1 am the system was returning soap fault conditions that my code handled with it's response checking (it basically skips over and sends a generic message if it doesn't find a valid rate response) but which isn't handled specifically.
When the service itself is down, I would like to show a more useful message to customers specifically for such faults when the remote services are actually down to perhaps cut down the calls to our tech support. (the generic message says 'try again later', but if I know it's specifically a problem with the FedEx services being down, I can say 'FedEx Rate Service temporarily unavailable' so people will know it's not our site, but theirs)
I've already implemented code to handle a SoapFault condition, but now I have the problem of 'how to test it' as the FedEx rate service was only down briefly last night.
Is there a way to intentionally trigger a soap condition, perhaps even specific soap fault for testing purposes?
It is hard to know when the FedEx Rate (or any other) web service will be down; however, if you would belong FedEx Compatible Solutions Program (CSP), you would get an email with the official date and time in which the test and production services will be unavailable.
Even though that schedule is provided, I have seen the FedEx services (specially Rate) be down without any notice. I might get a fault exception, a failure notification, an error notification, or or time out exception.
Because it is hard to know when the service is actually down, I recommend you to provide the user with a message like "The shipment rates could not be calculated, please, try again later. If the problem persist, please, contact our support team." when the error that you get from the Rate web service has nothing to do with the data provided by the user.
Best!