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
vinothvinoth 

Soap fault message

Hi, I want to get full fault message in SOAP API call. But right now, it’s not possible in Salesforce. I found the below workaround in one site. Can anyone guide me to get full message and how to implement the below workaround?

1.Add an 'error' string field to the response class. You then do your webservice call to an intermediate layer which hides these exceptions and always returns to salesforce a 'valid' response.
 
Daniel BallingerDaniel Ballinger
The first thing I'd do is go and vote for the Idea: SOAPFault Information for Apex (https://success.salesforce.com/ideaView?id=08730000000BqG9AAK)

The suggested solution appears to be to modify the external web service so that it never intentionally returns an error response using the standard SOAP fault message. Rather, it adds an additional field to the response that holds this information if applicable. The viability of this approach depends on if you control the external web service and can modify it.

If it is just a one off problem, I'd suggest using a developer edition org to make the callouts from Salesforce. Then you can use the DEBUG log to get the CALLOUT_REQUEST and CALLOUT_RESPONSE log messages. These include the full SOAP request and responses.

Another alternative is to not use Wsdl2Apex and WebServiceCallout.invoke at all. I've made a free tool that will create the HttpRequest/Response and parse the SOAP response for you. See FuseIT SFDC Explorer (http://www.fuseit.com/explorer).