You need to sign in to do that
Don't have an account?

Accessing the entire fault response from a CalloutException
This is an older problem but got no further than promoting the Salesforce Idea: SOAPFault Information for Apex. It came up again today with users of a managed package wanting better error messages when a web service callout fails.
When this gets handled by Apex it gets turned into a CalloutException:
System.CalloutException
Cause: null
Message: Web service callout failed: WebService returned a SOAP Fault: The creator of this fault did not specify a Reason. faultcode=s:Client faultactor=
The issue I have is that the getMessage() method doesn't return the entire SOAP reponse. It has been truncated before the useful information appears.
Is there some way to recover the entire response from the CalloutException in code so I can give a meaning error back to the user?
Thanks,
Venkat.
When this gets handled by Apex it gets turned into a CalloutException:
System.CalloutException
Cause: null
Message: Web service callout failed: WebService returned a SOAP Fault: The creator of this fault did not specify a Reason. faultcode=s:Client faultactor=
The issue I have is that the getMessage() method doesn't return the entire SOAP reponse. It has been truncated before the useful information appears.
Is there some way to recover the entire response from the CalloutException in code so I can give a meaning error back to the user?
Thanks,
Venkat.
Soap fault from salesforce always contains the stack trace with the error message as this is the default behavior. There is no option to control it.
The only option is to build a wrapper on client side which can catch it and truncate the message.
Refer: http://salesforce.stackexchange.com/questions/29384/accessing-the-entire-fault-response-from-a-calloutexception