function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
StreepieStreepie 

How to handle a call to a external webservice when the webservice is not "LIVE"

Can I get a mail from an apex code that calls a webservice when the request fails because the servcie is not Live or just fails.

 

or

 

just when there is no response from the external server 

 

 

I don't know how to debug the response (system.debug does nothing ?)

 

What does salesforce server do when a call to a webservice doesn't get a response and how can i tackle it?

aalbertaalbert

I think the answer is how you handle the different scenarios within your Apex. For example, if the webservice times out, apex throws an exception. So just catch that exception and you can then construct an Apex Email and send it as a notification, if you like. If the webservice returns a message, but its an error, the apex code needs to identify an error was received and handle it accordingly.

 

If you are calling the webservice from WSDL2Apex generated code, I have also had issues outputting the generated SOAP message in system.debug messages. I have had luck getting the output by using the Force.com IDE Execute Anonymous view. That outputs the entire SOAP message apex generates. Check out this article on the topic and there is a specific section on Debugging WSDL2Apex. 

 

I hope this helps.